diff options
author | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2020-12-05 21:59:07 +0200 |
---|---|---|
committer | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2020-12-05 21:59:07 +0200 |
commit | ff672d27e6a80177f00f9cb6f2b5e560cd5a1878 (patch) | |
tree | 8ea905aa7a2fa811443fb9279eeaa7546995cd18 | |
parent | fec4dba6c3605c2814c6c570f61fc4f541ec479c (diff) | |
download | sdl_ios-ff672d27e6a80177f00f9cb6f2b5e560cd5a1878.tar.gz |
SDL-0262 'New vehicle data SeatOccupancy': implement new tests for seat occupancy and seat status structs
3 files changed, 140 insertions, 0 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 7c36f8839..2fa86b74b 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -1667,6 +1667,8 @@ B360F9DF255F52A50027CA17 /* SDLSeatStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = B360F9DD255F52A40027CA17 /* SDLSeatStatus.m */; }; B360F9E4255F52BA0027CA17 /* SDLSeatOccupancy.m in Sources */ = {isa = PBXBuildFile; fileRef = B360F9E2255F52B90027CA17 /* SDLSeatOccupancy.m */; }; B360F9E5255F52BA0027CA17 /* SDLSeatOccupancy.h in Headers */ = {isa = PBXBuildFile; fileRef = B360F9E3255F52B90027CA17 /* SDLSeatOccupancy.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B38389D6257C187500420C11 /* SDLSeatOccupancySpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B38389D4257C187400420C11 /* SDLSeatOccupancySpec.m */; }; + B38389D7257C187500420C11 /* SDLSeatStatusSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B38389D5257C187500420C11 /* SDLSeatStatusSpec.m */; }; B38D8E7E24A118BD00B977D0 /* SDLGearStatusSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B38D8E7D24A118BD00B977D0 /* SDLGearStatusSpec.m */; }; B38D8E8024A1E3D000B977D0 /* SDLTransmissionTypeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B38D8E7F24A1E3D000B977D0 /* SDLTransmissionTypeSpec.m */; }; B38D8E8224A1F53500B977D0 /* SDLCapacityUnitSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B38D8E8124A1F53500B977D0 /* SDLCapacityUnitSpec.m */; }; @@ -3494,6 +3496,8 @@ B360F9DD255F52A40027CA17 /* SDLSeatStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLSeatStatus.m; path = public/SDLSeatStatus.m; sourceTree = "<group>"; }; B360F9E2255F52B90027CA17 /* SDLSeatOccupancy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLSeatOccupancy.m; path = public/SDLSeatOccupancy.m; sourceTree = "<group>"; }; B360F9E3255F52B90027CA17 /* SDLSeatOccupancy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLSeatOccupancy.h; path = public/SDLSeatOccupancy.h; sourceTree = "<group>"; }; + B38389D4257C187400420C11 /* SDLSeatOccupancySpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLSeatOccupancySpec.m; path = SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSeatOccupancySpec.m; sourceTree = SOURCE_ROOT; }; + B38389D5257C187500420C11 /* SDLSeatStatusSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLSeatStatusSpec.m; path = SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSeatStatusSpec.m; sourceTree = SOURCE_ROOT; }; B38D8E7D24A118BD00B977D0 /* SDLGearStatusSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLGearStatusSpec.m; sourceTree = "<group>"; }; B38D8E7F24A1E3D000B977D0 /* SDLTransmissionTypeSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLTransmissionTypeSpec.m; sourceTree = "<group>"; }; B38D8E8124A1F53500B977D0 /* SDLCapacityUnitSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLCapacityUnitSpec.m; sourceTree = "<group>"; }; @@ -4029,6 +4033,8 @@ 5DADA7771F4E059E0084D17D /* SDLRectangleSpec.m */, 5D92934F20AF526200FCC775 /* SDLRGBColorSpec.m */, 162E82A71A9BDE8A00906325 /* SDLScreenParamsSpec.m */, + B38389D4257C187400420C11 /* SDLSeatOccupancySpec.m */, + B38389D5257C187500420C11 /* SDLSeatStatusSpec.m */, 1E89B0E1203196B800A47992 /* SDLSeatControlCapabilitiesSpec.m */, 1E89B0DD2031636000A47992 /* SDLSeatControlDataSpec.m */, 1EB59CD9202DCEEC00343A61 /* SDLSeatMemoryActionSpec.m */, @@ -8649,6 +8655,7 @@ 162E835D1A9BDE8B00906325 /* SDLReadDIDResponseSpec.m in Sources */, 5DAD5F87205087430025624C /* SDLTextAndGraphicManagerSpec.m in Sources */, 162E82D41A9BDE8A00906325 /* SDLCharacterSetSpec.m in Sources */, + B38389D7257C187500420C11 /* SDLSeatStatusSpec.m in Sources */, 162E830F1A9BDE8B00906325 /* SDLOnAppInterfaceUnregisteredSpec.m in Sources */, 162E83971A9BDE8B00906325 /* SDLVehicleTypeSpec.m in Sources */, 887BE4D422272B2200B397C2 /* SDLControlFramePayloadConstantsSpec.m in Sources */, @@ -8708,6 +8715,7 @@ 1EE8C4501F38629200FDC2CF /* SDLRemoteControlCapabilitiesSpec.m in Sources */, 1EAA47662035B8D3000FE74B /* SDLLightControlDataSpec.m in Sources */, 162E82CF1A9BDE8A00906325 /* SDLBitsPerSampleSpec.m in Sources */, + B38389D6257C187500420C11 /* SDLSeatOccupancySpec.m in Sources */, 883581B022D659BE00405C42 /* SDLCloseApplicationResponseSpec.m in Sources */, 162E831E1A9BDE8B00906325 /* SDLOnTBTClientStateSpec.m in Sources */, 162E83351A9BDE8B00906325 /* SDLReadDIDSpec.m in Sources */, diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSeatOccupancySpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSeatOccupancySpec.m new file mode 100644 index 000000000..26ebe24b7 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSeatOccupancySpec.m @@ -0,0 +1,66 @@ +// +// SDLUnsubscribeVehicleDataResponseSpec.m +// SmartDeviceLink + + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLSeatOccupancy.h" +#import "SDLSeatStatus.h" +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" + +QuickSpecBegin(SDLSeatOccupancySpec) + +SDLSeatStatus *seatStatus = [[SDLSeatStatus alloc] init]; +NSArray *seatStatusArr = @[seatStatus]; + +describe(@"getter/setter tests", ^{ + context(@"init", ^{ + SDLSeatOccupancy* testStruct = [[SDLSeatOccupancy alloc] init]; + testStruct.seatsBelted = seatStatusArr; + testStruct.seatsOccupied = seatStatusArr; + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.seatsBelted).to(equal(seatStatusArr)); + expect(testStruct.seatsOccupied).to(equal(seatStatusArr)); + }); + }); + + context(@"initWithDictionary:", ^{ + NSDictionary *dict = @{ + SDLRPCParameterNameSeatsBelted:seatStatusArr, + SDLRPCParameterNameSeatsOccupied:seatStatusArr, + }; + + SDLSeatOccupancy* testStruct = [[SDLSeatOccupancy alloc] initWithDictionary:dict]; + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.seatsBelted).to(equal(seatStatusArr)); + expect(testStruct.seatsOccupied).to(equal(seatStatusArr)); + }); + }); + + context(@"init", ^{ + SDLSeatOccupancy* testStruct = [[SDLSeatOccupancy alloc] init]; + + it(@"expect all properties to be nil", ^{ + expect(testStruct.seatsBelted).to(beNil()); + expect(testStruct.seatsOccupied).to(beNil()); + }); + }); + + context(@"initWithSeatsOccupied:seatsBelted:", ^{ + SDLSeatOccupancy* testStruct = [[SDLSeatOccupancy alloc] initWithSeatsOccupied:seatStatusArr seatsBelted:seatStatusArr]; + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.seatsBelted).to(equal(seatStatusArr)); + expect(testStruct.seatsOccupied).to(equal(seatStatusArr)); + }); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSeatStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSeatStatusSpec.m new file mode 100644 index 000000000..e2d13b15b --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSeatStatusSpec.m @@ -0,0 +1,66 @@ +// +// SDLUnsubscribeVehicleDataResponseSpec.m +// SmartDeviceLink + + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLSeatStatus.h" +#import "SDLSeatLocation.h" +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" + +QuickSpecBegin(SDLSeatStatusSpec) + +SDLSeatLocation *seatLocation = [[SDLSeatLocation alloc] init]; +NSNumber<SDLBool> *conditionActive = @YES; + +describe(@"getter/setter tests", ^{ + context(@"init", ^{ + SDLSeatStatus* testStruct = [[SDLSeatStatus alloc] init]; + testStruct.conditionActive = conditionActive; + testStruct.seatLocation = seatLocation; + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.conditionActive).to(equal(conditionActive)); + expect(testStruct.seatLocation).to(equal(seatLocation)); + }); + }); + + context(@"initWithDictionary:", ^{ + NSDictionary *dict = @{ + SDLRPCParameterNameConditionActive:conditionActive, + SDLRPCParameterNameSeatLocation:seatLocation, + }; + + SDLSeatStatus* testStruct = [[SDLSeatStatus alloc] initWithDictionary:dict]; + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.conditionActive).to(equal(conditionActive)); + expect(testStruct.seatLocation).to(equal(seatLocation)); + }); + }); + + context(@"init", ^{ + SDLSeatStatus* testStruct = [[SDLSeatStatus alloc] init]; + + it(@"expect all properties to be nil", ^{ + expect(testStruct.conditionActive).to(beNil()); + expect(testStruct.seatLocation).to(beNil()); + }); + }); + + context(@"initWithSeatsOccupied:seatsBelted:", ^{ + SDLSeatStatus* testStruct = [[SDLSeatStatus alloc] initWithSeatLocation:seatLocation conditionActive:conditionActive]; + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.conditionActive).to(equal(conditionActive)); + expect(testStruct.seatLocation).to(equal(seatLocation)); + }); + }); +}); + +QuickSpecEnd |