diff options
author | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2020-12-06 03:56:27 +0200 |
---|---|---|
committer | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2020-12-06 03:56:27 +0200 |
commit | 76600a588b18d5c6cee36b6fcbc96ee02d1959db (patch) | |
tree | d758e4f1a49afed8eaa5357cd0554df39ce77701 | |
parent | 8361c03ac636824a857d83c2d9178c23a6e9a63b (diff) | |
download | sdl_ios-76600a588b18d5c6cee36b6fcbc96ee02d1959db.tar.gz |
SDL0255 'enhance body info': improve test coverage
4 files changed, 117 insertions, 0 deletions
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLBodyInformationSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLBodyInformationSpec.m index fb6085b6e..4b20c169d 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLBodyInformationSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLBodyInformationSpec.m @@ -21,11 +21,17 @@ QuickSpecBegin(SDLBodyInformationSpec) NSArray<SDLDoorStatus *> *doorStatuses = @[[[SDLDoorStatus alloc] init]]; NSArray<SDLGateStatus *> *gateStatuses = @[[[SDLGateStatus alloc] init]]; NSArray<SDLRoofStatus *> *roofStatuses = @[[[SDLRoofStatus alloc] init]]; +SDLIgnitionStableStatus ignitionStableStatus = SDLIgnitionStableStatusStable; +SDLIgnitionStatus ignitionStatus = SDLIgnitionStatusStart; describe(@"getter/setter tests", ^{ context(@"init and assign", ^{ SDLBodyInformation* testStruct = [[SDLBodyInformation alloc] init]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + testStruct.parkBrakeActive = @YES; testStruct.ignitionStableStatus = SDLIgnitionStableStatusStable; testStruct.ignitionStatus = SDLIgnitionStatusStart; @@ -75,6 +81,10 @@ describe(@"getter/setter tests", ^{ }; SDLBodyInformation* testStruct = [[SDLBodyInformation alloc] initWithDictionary:dict]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be set correctly", ^{ expect(testStruct.parkBrakeActive).to(equal(@YES)); expect(testStruct.ignitionStableStatus).to(equal(SDLIgnitionStableStatusNotStable)); @@ -95,6 +105,10 @@ describe(@"getter/setter tests", ^{ context(@"init", ^{ SDLBodyInformation* testStruct = [[SDLBodyInformation alloc] init]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be nil", ^{ expect(testStruct.parkBrakeActive).to(beNil()); expect(testStruct.ignitionStableStatus).to(beNil()); @@ -111,6 +125,54 @@ describe(@"getter/setter tests", ^{ expect(testStruct.roofStatuses).to(beNil()); }); }); + + context(@"initWithParkBrakeActive:ignitionStableStatus:ignitionStatus:", ^{ + SDLBodyInformation* testStruct = [[SDLBodyInformation alloc] initWithParkBrakeActive:YES ignitionStableStatus:ignitionStableStatus ignitionStatus:ignitionStatus]; + + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + + it(@"expect all properties to be set correctly", ^{ + expect(testStruct.parkBrakeActive).to(equal(@YES)); + expect(testStruct.ignitionStableStatus).to(equal(ignitionStableStatus)); + expect(testStruct.ignitionStatus).to(equal(ignitionStatus)); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testStruct.driverDoorAjar).to(beNil()); + expect(testStruct.passengerDoorAjar).to(beNil()); + expect(testStruct.rearLeftDoorAjar).to(beNil()); + expect(testStruct.rearRightDoorAjar).to(beNil()); +#pragma clang diagnostic pop + expect(testStruct.doorStatuses).to(beNil()); + expect(testStruct.gateStatuses).to(beNil()); + expect(testStruct.roofStatuses).to(beNil()); + }); + }); + + context(@"initWithParkBrakeActive:ignitionStableStatus:ignitionStatus:", ^{ + SDLBodyInformation* testStruct = [[SDLBodyInformation alloc] initWithParkBrakeActive:YES ignitionStableStatus:ignitionStableStatus ignitionStatus:ignitionStatus doorStatuses:doorStatuses gateStatuses:gateStatuses roofStatuses:roofStatuses]; + + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + + it(@"expect all properties to be set correctly", ^{ + expect(testStruct.parkBrakeActive).to(equal(@YES)); + expect(testStruct.ignitionStableStatus).to(equal(ignitionStableStatus)); + expect(testStruct.ignitionStatus).to(equal(ignitionStatus)); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testStruct.driverDoorAjar).to(beNil()); + expect(testStruct.passengerDoorAjar).to(beNil()); + expect(testStruct.rearLeftDoorAjar).to(beNil()); + expect(testStruct.rearRightDoorAjar).to(beNil()); +#pragma clang diagnostic pop + expect(testStruct.doorStatuses).to(equal(doorStatuses)); + expect(testStruct.gateStatuses).to(equal(gateStatuses)); + expect(testStruct.roofStatuses).to(equal(roofStatuses)); + }); + }); }); QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDoorStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDoorStatusSpec.m index 4453addac..fda597e88 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDoorStatusSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDoorStatusSpec.m @@ -21,6 +21,11 @@ SDLDoorStatusType status = SDLDoorStatusTypeAjar; describe(@"getter/setter tests", ^{ context(@"init and assign", ^{ SDLDoorStatus* testStruct = [[SDLDoorStatus alloc] init]; + + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + testStruct.location = location; testStruct.status = status; @@ -37,6 +42,10 @@ describe(@"getter/setter tests", ^{ }; SDLDoorStatus *testStruct = [[SDLDoorStatus alloc] initWithDictionary:dict]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be set correctly", ^{ expect(testStruct.location).to(equal(location)); expect(testStruct.status).to(equal(status)); @@ -46,6 +55,10 @@ describe(@"getter/setter tests", ^{ context(@"init", ^{ SDLDoorStatus *testStruct = [[SDLDoorStatus alloc] init]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be nil", ^{ expect(testStruct.location).to(beNil()); expect(testStruct.status).to(beNil()); @@ -54,6 +67,11 @@ describe(@"getter/setter tests", ^{ context(@"initWithLocation:status:", ^{ SDLDoorStatus *testStruct = [[SDLDoorStatus alloc] initWithLocation:location status:status]; + + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + testStruct.location = location; testStruct.status = status; diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGateStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGateStatusSpec.m index 46d24eb94..846c00b18 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGateStatusSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGateStatusSpec.m @@ -22,6 +22,11 @@ SDLDoorStatusType status = SDLDoorStatusTypeAjar; describe(@"getter/setter tests", ^{ context(@"init and assign", ^{ SDLGateStatus *testStruct = [[SDLGateStatus alloc] init]; + + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + testStruct.location = location; testStruct.status = status; @@ -38,6 +43,10 @@ describe(@"getter/setter tests", ^{ }; SDLGateStatus *testStruct = [[SDLGateStatus alloc] initWithDictionary:dict]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be set correctly", ^{ expect(testStruct.location).to(equal(location)); expect(testStruct.status).to(equal(status)); @@ -47,6 +56,10 @@ describe(@"getter/setter tests", ^{ context(@"init", ^{ SDLGateStatus *testStruct = [[SDLGateStatus alloc] init]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be nil", ^{ expect(testStruct.location).to(beNil()); expect(testStruct.status).to(beNil()); @@ -55,6 +68,10 @@ describe(@"getter/setter tests", ^{ context(@"initWithLocation:status:", ^{ SDLGateStatus *testStruct = [[SDLGateStatus alloc] initWithLocation:location status:status]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + testStruct.location = location; testStruct.status = status; diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRoofStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRoofStatusSpec.m index a4e2e4e4c..cbb6efad7 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRoofStatusSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRoofStatusSpec.m @@ -27,6 +27,10 @@ describe(@"getter/setter tests", ^{ testStruct.status = status; testStruct.state = state; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be set correctly", ^{ expect(testStruct.location).to(equal(location)); expect(testStruct.status).to(equal(status)); @@ -42,6 +46,10 @@ describe(@"getter/setter tests", ^{ }; SDLRoofStatus* testStruct = [[SDLRoofStatus alloc] initWithDictionary:dict]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be set correctly", ^{ expect(testStruct.location).to(equal(location)); expect(testStruct.status).to(equal(status)); @@ -52,6 +60,10 @@ describe(@"getter/setter tests", ^{ context(@"init", ^{ SDLRoofStatus* testStruct = [[SDLRoofStatus alloc] init]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be nil", ^{ expect(testStruct.location).to(beNil()); expect(testStruct.status).to(beNil()); @@ -62,6 +74,10 @@ describe(@"getter/setter tests", ^{ context(@"initWithLocation:status:", ^{ SDLRoofStatus* testStruct = [[SDLRoofStatus alloc] initWithLocation:location status:status]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be set correctly", ^{ expect(testStruct.location).to(equal(location)); expect(testStruct.status).to(equal(status)); @@ -72,6 +88,10 @@ describe(@"getter/setter tests", ^{ context(@"initWithLocation:status:state:", ^{ SDLRoofStatus* testStruct = [[SDLRoofStatus alloc] initWithLocation:location status:status state:state]; + it(@"expect struct is not nil", ^{ + expect(testStruct).notTo(beNil()); + }); + it(@"expect all properties to be set correctly", ^{ expect(testStruct.location).to(equal(location)); expect(testStruct.status).to(equal(status)); |