diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-07-31 15:09:12 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-07-31 15:09:12 -0400 |
commit | d66d6e5833076fec3c3b17a574e76115a04896ef (patch) | |
tree | ea795f11004554a7f3ce216a9d455c5f1472cab0 | |
parent | 2d2d9b2bff74d780251baaa133487be5cbf66fe2 (diff) | |
download | sdl_ios-d66d6e5833076fec3c3b17a574e76115a04896ef.tar.gz |
Add numerous control payload tests
* Remove / alter protocol version inputs to always be string
12 files changed, 381 insertions, 19 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index fb69eff2f..086f20f23 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -872,6 +872,10 @@ 5DA22CBD1D075DE800245F5F /* OHHTTPStubs.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5DA22CB51D075CF200245F5F /* OHHTTPStubs.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 5DA22CBE1D075DE800245F5F /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5DA22CB61D075CF200245F5F /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 5DA22CBF1D075DEC00245F5F /* SmartDeviceLink.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5D61FA1C1A84237100846EE7 /* SmartDeviceLink.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 5DA23FF01F2FA0FF009C0313 /* SDLControlFramePayloadEndServiceSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DA23FEF1F2FA0FF009C0313 /* SDLControlFramePayloadEndServiceSpec.m */; }; + 5DA23FF31F2FA35C009C0313 /* SDLControlFramePayloadAudioStartServiceAckSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DA23FF21F2FA35C009C0313 /* SDLControlFramePayloadAudioStartServiceAckSpec.m */; }; + 5DA23FF61F2FAA31009C0313 /* SDLControlFramePayloadRPCStartServiceSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DA23FF51F2FAA31009C0313 /* SDLControlFramePayloadRPCStartServiceSpec.m */; }; + 5DA23FF81F2FAF2D009C0313 /* SDLControlFramePayloadRPCStartServiceAckSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DA23FF71F2FAF2D009C0313 /* SDLControlFramePayloadRPCStartServiceAckSpec.m */; }; 5DA3F3541BC448060026F2D0 /* NSMapTable+Subscripting.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DA3F3521BC448060026F2D0 /* NSMapTable+Subscripting.h */; }; 5DA3F3551BC448060026F2D0 /* NSMapTable+Subscripting.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DA3F3531BC448060026F2D0 /* NSMapTable+Subscripting.m */; }; 5DA3F35A1BC448480026F2D0 /* SDLError.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DA3F3581BC448480026F2D0 /* SDLError.h */; }; @@ -909,6 +913,7 @@ 5DB996611F28C6ED002D8795 /* SDLControlFramePayloadVideoStartServiceAck.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB9965F1F28C6ED002D8795 /* SDLControlFramePayloadVideoStartServiceAck.m */; }; 5DBAE0AB1D3588AC00CE00BF /* SDLNotificationDispatcherSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DBAE0AA1D3588AC00CE00BF /* SDLNotificationDispatcherSpec.m */; }; 5DBAE0AD1D368D1A00CE00BF /* SDLResponseDispatcherSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DBAE0AC1D368D1A00CE00BF /* SDLResponseDispatcherSpec.m */; }; + 5DC09EDA1F2F7FEC00F4AB1D /* SDLControlFramePayloadNakSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DC09ED91F2F7FEC00F4AB1D /* SDLControlFramePayloadNakSpec.m */; }; 5DC978261B7A38640012C2F1 /* SDLGlobalsSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DC978251B7A38640012C2F1 /* SDLGlobalsSpec.m */; }; 5DCC19A01B8221F3004FFAD9 /* SDLURLSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DCC199E1B8221F3004FFAD9 /* SDLURLSession.h */; }; 5DCC19A11B8221F3004FFAD9 /* SDLURLSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DCC199F1B8221F3004FFAD9 /* SDLURLSession.m */; }; @@ -1958,6 +1963,10 @@ 5DA22CB41D075CF200245F5F /* OCMock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OCMock.framework; path = sdl_ios/Carthage/Build/iOS/OCMock.framework; sourceTree = "<group>"; }; 5DA22CB51D075CF200245F5F /* OHHTTPStubs.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OHHTTPStubs.framework; path = sdl_ios/Carthage/Build/iOS/OHHTTPStubs.framework; sourceTree = "<group>"; }; 5DA22CB61D075CF200245F5F /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = sdl_ios/Carthage/Build/iOS/Quick.framework; sourceTree = "<group>"; }; + 5DA23FEF1F2FA0FF009C0313 /* SDLControlFramePayloadEndServiceSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadEndServiceSpec.m; sourceTree = "<group>"; }; + 5DA23FF21F2FA35C009C0313 /* SDLControlFramePayloadAudioStartServiceAckSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadAudioStartServiceAckSpec.m; sourceTree = "<group>"; }; + 5DA23FF51F2FAA31009C0313 /* SDLControlFramePayloadRPCStartServiceSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadRPCStartServiceSpec.m; sourceTree = "<group>"; }; + 5DA23FF71F2FAF2D009C0313 /* SDLControlFramePayloadRPCStartServiceAckSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadRPCStartServiceAckSpec.m; sourceTree = "<group>"; }; 5DA3F3521BC448060026F2D0 /* NSMapTable+Subscripting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMapTable+Subscripting.h"; sourceTree = "<group>"; }; 5DA3F3531BC448060026F2D0 /* NSMapTable+Subscripting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMapTable+Subscripting.m"; sourceTree = "<group>"; }; 5DA3F3581BC448480026F2D0 /* SDLError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLError.h; sourceTree = "<group>"; }; @@ -1996,6 +2005,7 @@ 5DB9965F1F28C6ED002D8795 /* SDLControlFramePayloadVideoStartServiceAck.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadVideoStartServiceAck.m; sourceTree = "<group>"; }; 5DBAE0AA1D3588AC00CE00BF /* SDLNotificationDispatcherSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLNotificationDispatcherSpec.m; path = DevAPISpecs/SDLNotificationDispatcherSpec.m; sourceTree = "<group>"; }; 5DBAE0AC1D368D1A00CE00BF /* SDLResponseDispatcherSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLResponseDispatcherSpec.m; path = DevAPISpecs/SDLResponseDispatcherSpec.m; sourceTree = "<group>"; }; + 5DC09ED91F2F7FEC00F4AB1D /* SDLControlFramePayloadNakSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLControlFramePayloadNakSpec.m; path = ControlFramePayloadSpecs/SDLControlFramePayloadNakSpec.m; sourceTree = "<group>"; }; 5DC978251B7A38640012C2F1 /* SDLGlobalsSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLGlobalsSpec.m; path = UtilitiesSpecs/SDLGlobalsSpec.m; sourceTree = "<group>"; }; 5DCA93821EE0844D0015768E /* SmartDeviceLink.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = SmartDeviceLink.podspec; sourceTree = SOURCE_ROOT; }; 5DCC199E1B8221F3004FFAD9 /* SDLURLSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLURLSession.h; sourceTree = "<group>"; }; @@ -2462,6 +2472,7 @@ 1680B1041A9CD7AD00DBD79E /* ProtocolSpecs */ = { isa = PBXGroup; children = ( + 5DC09ED71F2F7F1A00F4AB1D /* Control Frame Payloads */, 1680B1051A9CD7AD00DBD79E /* HeaderSpecs */, 1680B1091A9CD7AD00DBD79E /* MessageSpecs */, 1680B10E1A9CD7AD00DBD79E /* SDLAbstractProtocolSpec.m */, @@ -3674,6 +3685,30 @@ name = Permissions; sourceTree = "<group>"; }; + 5DA23FF11F2FA32A009C0313 /* Audio Service */ = { + isa = PBXGroup; + children = ( + 5DA23FF21F2FA35C009C0313 /* SDLControlFramePayloadAudioStartServiceAckSpec.m */, + ); + name = "Audio Service"; + sourceTree = "<group>"; + }; + 5DA23FF41F2FAA06009C0313 /* RPC Service */ = { + isa = PBXGroup; + children = ( + 5DA23FF51F2FAA31009C0313 /* SDLControlFramePayloadRPCStartServiceSpec.m */, + 5DA23FF71F2FAF2D009C0313 /* SDLControlFramePayloadRPCStartServiceAckSpec.m */, + ); + name = "RPC Service"; + sourceTree = "<group>"; + }; + 5DA23FF91F2FB485009C0313 /* Video Service */ = { + isa = PBXGroup; + children = ( + ); + name = "Video Service"; + sourceTree = "<group>"; + }; 5DA3F3511BC4477B0026F2D0 /* Developer API */ = { isa = PBXGroup; children = ( @@ -3922,6 +3957,26 @@ name = Dispatchers; sourceTree = "<group>"; }; + 5DC09ED71F2F7F1A00F4AB1D /* Control Frame Payloads */ = { + isa = PBXGroup; + children = ( + 5DA23FF11F2FA32A009C0313 /* Audio Service */, + 5DC09ED81F2F7FC000F4AB1D /* General */, + 5DA23FF41F2FAA06009C0313 /* RPC Service */, + 5DA23FF91F2FB485009C0313 /* Video Service */, + ); + name = "Control Frame Payloads"; + sourceTree = "<group>"; + }; + 5DC09ED81F2F7FC000F4AB1D /* General */ = { + isa = PBXGroup; + children = ( + 5DC09ED91F2F7FEC00F4AB1D /* SDLControlFramePayloadNakSpec.m */, + 5DA23FEF1F2FA0FF009C0313 /* SDLControlFramePayloadEndServiceSpec.m */, + ); + name = General; + sourceTree = "<group>"; + }; 5DCC199D1B8221D2004FFAD9 /* HTTP Connection */ = { isa = PBXGroup; children = ( @@ -4977,6 +5032,7 @@ 5DA026901AD44EE700019F86 /* SDLDialNumberResponseSpec.m in Sources */, 162E83901A9BDE8B00906325 /* SDLTireStatusSpec.m in Sources */, 162E82E01A9BDE8B00906325 /* SDLHMILevelSpec.m in Sources */, + 5DC09EDA1F2F7FEC00F4AB1D /* SDLControlFramePayloadNakSpec.m in Sources */, 162E83041A9BDE8B00906325 /* SDLUpdateModeSpec.m in Sources */, 162E83801A9BDE8B00906325 /* SDLHMIPermissionsSpec.m in Sources */, 5D1654561D3E754F00554D93 /* SDLLifecycleManagerSpec.m in Sources */, @@ -5007,6 +5063,7 @@ 162E83991A9BDE8B00906325 /* SDLEnumSpec.m in Sources */, 162E82ED1A9BDE8B00906325 /* SDLMaintenanceModeStatusSpec.m in Sources */, 5DB92D2D1AC4A34F00C15BB0 /* SDLPrioritizedObjectCollectionSpec.m in Sources */, + 5DA23FF31F2FA35C009C0313 /* SDLControlFramePayloadAudioStartServiceAckSpec.m in Sources */, 1680B11C1A9CD7AD00DBD79E /* SDLProtocolMessageAssemblerSpec.m in Sources */, 162E83181A9BDE8B00906325 /* SDLOnKeyboardInputSpec.m in Sources */, 162E83701A9BDE8B00906325 /* SDLUpdateTurnListResponseSpec.m in Sources */, @@ -5043,6 +5100,7 @@ 162E82F31A9BDE8B00906325 /* SDLPrerecordedSpeechSpec.m in Sources */, 162E83691A9BDE8B00906325 /* SDLSubscribeButtonResponseSpec.m in Sources */, 5DAE06751BDEC6D600F9B498 /* SDLArtworkSpec.m in Sources */, + 5DA23FF01F2FA0FF009C0313 /* SDLControlFramePayloadEndServiceSpec.m in Sources */, 162E83591A9BDE8B00906325 /* SDLListFilesResponseSpec.m in Sources */, 162E832A1A9BDE8B00906325 /* SDLDeleteInteractionChoiceSetSpec.m in Sources */, 162E839D1A9BDE8B00906325 /* SDLRPCResponseSpec.m in Sources */, @@ -5106,6 +5164,7 @@ 162E836A1A9BDE8B00906325 /* SDLSubscribeVehicleDataResponseSpec.m in Sources */, 162E83761A9BDE8B00906325 /* SDLChoiceSpec.m in Sources */, 162E83571A9BDE8B00906325 /* SDLGetDTCsResponseSpec.m in Sources */, + 5DA23FF61F2FAA31009C0313 /* SDLControlFramePayloadRPCStartServiceSpec.m in Sources */, 162E83201A9BDE8B00906325 /* SDLOnVehicleDataSpec.m in Sources */, 162E83141A9BDE8B00906325 /* SDLOnDriverDistractionSpec.m in Sources */, 162E83371A9BDE8B00906325 /* SDLResetGlobalPropertiesSpec.m in Sources */, @@ -5174,6 +5233,7 @@ 162E83301A9BDE8B00906325 /* SDLGetVehicleDataSpec.m in Sources */, 162E833F1A9BDE8B00906325 /* SDLSliderSpec.m in Sources */, 162E838C1A9BDE8B00906325 /* SDLSoftButtonSpec.m in Sources */, + 5DA23FF81F2FAF2D009C0313 /* SDLControlFramePayloadRPCStartServiceAckSpec.m in Sources */, 162E83191A9BDE8B00906325 /* SDLOnLanguageChangeSpec.m in Sources */, 5DB1BCDD1D243DC3002FFC37 /* SDLLifecycleConfigurationSpec.m in Sources */, 162E83611A9BDE8B00906325 /* SDLSetAppIconResponseSpec.m in Sources */, diff --git a/SmartDeviceLink-iOS.xcodeproj/project.xcworkspace/xcshareddata/SmartDeviceLink-iOS.xcscmblueprint b/SmartDeviceLink-iOS.xcodeproj/project.xcworkspace/xcshareddata/SmartDeviceLink-iOS.xcscmblueprint index 586c654a9..fe46776ac 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.xcworkspace/xcshareddata/SmartDeviceLink-iOS.xcscmblueprint +++ b/SmartDeviceLink-iOS.xcodeproj/project.xcworkspace/xcshareddata/SmartDeviceLink-iOS.xcscmblueprint @@ -7,7 +7,7 @@ "66020812E25F835F7E461E1F36EFF9E212E74787" : 9223372036854775807, "56518C5F548896A9F8039D14FD50ECBB0A40BE1B" : 9223372036854775807 }, - "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "A4F52DD4-4143-49E9-BA3C-33826959F665", + "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "C6E6E3FF-2162-4DF5-AA1E-650AF27E7D3F", "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { "66020812E25F835F7E461E1F36EFF9E212E74787" : "sdl_ios\/", "56518C5F548896A9F8039D14FD50ECBB0A40BE1B" : "sdl_ios\/bson_c_lib\/" diff --git a/SmartDeviceLink/SDLControlFramePayloadNak.m b/SmartDeviceLink/SDLControlFramePayloadNak.m index 447f7b9b6..2c353cbf8 100644 --- a/SmartDeviceLink/SDLControlFramePayloadNak.m +++ b/SmartDeviceLink/SDLControlFramePayloadNak.m @@ -59,8 +59,6 @@ NS_ASSUME_NONNULL_BEGIN } bson_object_put_array(&payloadObject, SDLControlFrameRejectedParams, &arrayObject); - - bson_array_deinitialize(&arrayObject); } BytePtr bsonData = bson_object_to_bytes(&payloadObject); @@ -78,15 +76,15 @@ NS_ASSUME_NONNULL_BEGIN NSMutableArray<NSString *> *rejectedParams = [NSMutableArray array]; char *paramString; size_t index = 0; - do { - paramString = bson_array_get_string(arrayObject, index); + + paramString = bson_array_get_string(arrayObject, index); + while (paramString != NULL) { [rejectedParams addObject:[NSString stringWithUTF8String:paramString]]; index++; - } while (paramString != NULL); + paramString = bson_array_get_string(arrayObject, index); + } self.rejectedParams = [rejectedParams copy]; - - bson_array_deinitialize(arrayObject); bson_object_deinitialize(&payloadObject); } diff --git a/SmartDeviceLink/SDLControlFramePayloadRPCStartService.h b/SmartDeviceLink/SDLControlFramePayloadRPCStartService.h index 7519e26f9..af3d97a12 100644 --- a/SmartDeviceLink/SDLControlFramePayloadRPCStartService.h +++ b/SmartDeviceLink/SDLControlFramePayloadRPCStartService.h @@ -17,7 +17,6 @@ NS_ASSUME_NONNULL_BEGIN /// The max version of protocol version supported by client requesting service to start. Must be in the format "Major.Minor.Patch" @property (copy, nonatomic, readonly, nullable) NSString *protocolVersion; -- (instancetype)initWithMajorVersion:(NSUInteger)majorVersion minorVersion:(NSUInteger)minorVersion patchVersion:(NSUInteger)patchVersion; - (instancetype)initWithVersion:(NSString *)stringVersion; @end diff --git a/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m b/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m index 28001d48f..222370d24 100644 --- a/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m +++ b/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m @@ -23,13 +23,6 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLControlFramePayloadRPCStartService -- (instancetype)initWithMajorVersion:(NSUInteger)majorVersion minorVersion:(NSUInteger)minorVersion patchVersion:(NSUInteger)patchVersion { - self = [self initWithVersion:[NSString stringWithFormat:@"%lu.%lu.%lu", majorVersion, minorVersion, patchVersion]]; - if (!self) return nil; - - return self; -} - - (instancetype)initWithVersion:(NSString *)stringVersion { self = [super init]; if (!self) return nil; diff --git a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.h b/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.h index 50ad5b1d0..078405e1e 100644 --- a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.h +++ b/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.h @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN /// The negotiated version of the protocol. Must be in the format "Major.Minor.Patch" @property (copy, nonatomic, readonly, nullable) NSString *protocolVersion; -- (instancetype)initWithHashId:(int32_t)hashId mtu:(int64_t)mtu majorVersion:(NSUInteger)major minorVersion:(NSUInteger)minor patchVersion:(NSUInteger)patch; +- (instancetype)initWithHashId:(int32_t)hashId mtu:(int64_t)mtu protocolVersion:(nullable NSString *)protocolVersion; @end diff --git a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m b/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m index 9d635de34..e4b8347fa 100644 --- a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m +++ b/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m @@ -25,13 +25,13 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLControlFramePayloadRPCStartServiceAck -- (instancetype)initWithHashId:(int32_t)hashId mtu:(int64_t)mtu majorVersion:(NSUInteger)major minorVersion:(NSUInteger)minor patchVersion:(NSUInteger)patch { +- (instancetype)initWithHashId:(int32_t)hashId mtu:(int64_t)mtu protocolVersion:(nullable NSString *)protocolVersion { self = [super init]; if (!self) return nil; _hashId = hashId; _mtu = mtu; - _protocolVersion = [NSString stringWithFormat:@"%lu.%lu.%lu", (unsigned long)major, (unsigned long)minor, (unsigned long)patch]; + _protocolVersion = protocolVersion; return self; } diff --git a/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadNakSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadNakSpec.m new file mode 100644 index 000000000..ef0d8fae2 --- /dev/null +++ b/SmartDeviceLinkTests/ProtocolSpecs/ControlFramePayloadSpecs/SDLControlFramePayloadNakSpec.m @@ -0,0 +1,57 @@ + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLControlFramePayloadNak.h" + +QuickSpecBegin(SDLControlFramePayloadNakSpec) + +describe(@"Test encoding data", ^{ + __block SDLControlFramePayloadNak *testPayload = nil; + __block NSArray<NSString *> *testParams = nil; + + context(@"with paramaters", ^{ + beforeEach(^{ + testParams = @[@"testParam1", @"testParam2"]; + testPayload = [[SDLControlFramePayloadNak alloc] initWithRejectedParams:testParams]; + }); + + it(@"should create the correct data", ^{ + expect(testPayload.data.description).to(equal(@"<3e000000 0472656a 65637465 64506172 616d7300 29000000 0230000b 00000074 65737450 6172616d 31000231 000b0000 00746573 74506172 616d3200 0000>")); + }); + }); + + context(@"without parameters", ^{ + beforeEach(^{ + testParams = nil; + testPayload = [[SDLControlFramePayloadNak alloc] initWithRejectedParams:testParams]; + }); + + it(@"should create no data", ^{ + expect(testPayload.data.length).to(equal(0)); + }); + }); +}); + +describe(@"Test decoding data", ^{ + __block SDLControlFramePayloadNak *testPayload = nil; + __block NSData *testData = nil; + __block NSArray<NSString *> *testParams = nil; + + beforeEach(^{ + testParams = @[@"testParam1", @"testParam2"]; + + SDLControlFramePayloadNak *firstPayload = [[SDLControlFramePayloadNak alloc] initWithRejectedParams:testParams]; + testData = firstPayload.data; + + testPayload = [[SDLControlFramePayloadNak alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.rejectedParams).to(equal(testParams)); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadAudioStartServiceAckSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadAudioStartServiceAckSpec.m new file mode 100644 index 000000000..18f42bd2a --- /dev/null +++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadAudioStartServiceAckSpec.m @@ -0,0 +1,66 @@ + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLControlFramePayloadConstants.h" +#import "SDLControlFramePayloadAudioStartServiceAck.h" + +QuickSpecBegin(SDLControlFramePayloadAudioStartServiceAckSpec) + +describe(@"Test encoding data", ^{ + __block SDLControlFramePayloadAudioStartServiceAck *testPayload = nil; + __block int32_t testHashId = 0; + __block int64_t testMTU = 0; + + context(@"with paramaters", ^{ + beforeEach(^{ + testHashId = 1457689; + testMTU = 598464979; + + testPayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU]; + }); + + it(@"should create the correct data", ^{ + expect(testPayload.data.description).to(equal(@"<1e000000 10686173 68496400 193e1600 126d7475 00d3d9ab 23000000 0000>")); + }); + }); + + context(@"without parameters", ^{ + beforeEach(^{ + testHashId = SDLControlFrameInt32NotFound; + testMTU = SDLControlFrameInt64NotFound; + + testPayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU]; + }); + + it(@"should create no data", ^{ + expect(testPayload.data.length).to(equal(0)); + }); + }); +}); + +describe(@"Test decoding data", ^{ + __block SDLControlFramePayloadAudioStartServiceAck *testPayload = nil; + __block NSData *testData = nil; + __block int32_t testHashId = 0; + __block int64_t testMTU = 0; + + beforeEach(^{ + testHashId = 1545784; + testMTU = 989786483; + + SDLControlFramePayloadAudioStartServiceAck *firstPayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU]; + testData = firstPayload.data; + + testPayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.hashId).to(equal(testHashId)); + expect(testPayload.mtu).to(equal(testMTU)); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadEndServiceSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadEndServiceSpec.m new file mode 100644 index 000000000..8f7a0c3d2 --- /dev/null +++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadEndServiceSpec.m @@ -0,0 +1,58 @@ + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLControlFramePayloadConstants.h" +#import "SDLControlFramePayloadEndService.h" + +QuickSpecBegin(SDLControlFramePayloadEndServiceSpec) + +describe(@"Test encoding data", ^{ + __block SDLControlFramePayloadEndService *testPayload = nil; + __block int32_t testHashId = 0; + + context(@"with paramaters", ^{ + beforeEach(^{ + testHashId = 145768957; + testPayload = [[SDLControlFramePayloadEndService alloc] initWithHashId:testHashId]; + }); + + it(@"should create the correct data", ^{ + expect(testPayload.data.description).to(equal(@"<11000000 10686173 68496400 fd41b008 00>")); + }); + }); + + context(@"without parameters", ^{ + beforeEach(^{ + testHashId = SDLControlFrameInt32NotFound; + testPayload = [[SDLControlFramePayloadEndService alloc] initWithHashId:testHashId]; + }); + + it(@"should create no data", ^{ + expect(testPayload.data.length).to(equal(0)); + }); + }); +}); + +describe(@"Test decoding data", ^{ + __block SDLControlFramePayloadEndService *testPayload = nil; + __block NSData *testData = nil; + __block int32_t testHashId = 0; + + beforeEach(^{ + testHashId = 15457845; + + SDLControlFramePayloadEndService *firstPayload = [[SDLControlFramePayloadEndService alloc] initWithHashId:testHashId]; + testData = firstPayload.data; + + testPayload = [[SDLControlFramePayloadEndService alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.hashId).to(equal(testHashId)); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m new file mode 100644 index 000000000..ee6793249 --- /dev/null +++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m @@ -0,0 +1,71 @@ + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLControlFramePayloadConstants.h" +#import "SDLControlFramePayloadRPCStartServiceAck.h" + +QuickSpecBegin(SDLControlFramePayloadRPCStartServiceAckSpec) + +describe(@"Test encoding data", ^{ + __block SDLControlFramePayloadRPCStartServiceAck *testPayload = nil; + __block int32_t testHashId = 0; + __block int64_t testMTU = 0; + __block NSString *testProtocolVersion = nil; + + context(@"with paramaters", ^{ + beforeEach(^{ + testHashId = 1457689; + testMTU = 5984649; + testProtocolVersion = @"1.32.32"; + + testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU protocolVersion:testProtocolVersion]; + }); + + it(@"should create the correct data", ^{ + expect(testPayload.data.description).to(equal(@"<3b000000 10686173 68496400 193e1600 126d7475 0089515b 00000000 00027072 6f746f63 6f6c5665 7273696f 6e000800 0000312e 33322e33 320000>")); + }); + }); + + context(@"without parameters", ^{ + beforeEach(^{ + testHashId = SDLControlFrameInt32NotFound; + testMTU = SDLControlFrameInt64NotFound; + + testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU protocolVersion:nil]; + }); + + it(@"should create no data", ^{ + expect(testPayload.data.length).to(equal(0)); + }); + }); +}); + +describe(@"Test decoding data", ^{ + __block SDLControlFramePayloadRPCStartServiceAck *testPayload = nil; + __block NSData *testData = nil; + __block int32_t testHashId = 0; + __block int64_t testMTU = 0; + __block NSString *testProtocolVersion = nil; + + beforeEach(^{ + testHashId = 1545784; + testMTU = 989786483; + testProtocolVersion = @"3.89.5"; + + SDLControlFramePayloadRPCStartServiceAck *firstPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU protocolVersion:testProtocolVersion]; + testData = firstPayload.data; + + testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.hashId).to(equal(testHashId)); + expect(testPayload.mtu).to(equal(testMTU)); + expect(testPayload.protocolVersion).to(equal(testProtocolVersion)); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceSpec.m new file mode 100644 index 000000000..e8e773c8a --- /dev/null +++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceSpec.m @@ -0,0 +1,60 @@ + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLControlFramePayloadConstants.h" +#import "SDLControlFramePayloadRPCStartService.h" + +QuickSpecBegin(SDLControlFramePayloadRPCStartServiceSpec) + +describe(@"Test encoding data", ^{ + __block SDLControlFramePayloadRPCStartService *testPayload = nil; + __block NSString *testProtocolVersion = nil; + + context(@"with paramaters", ^{ + beforeEach(^{ + testProtocolVersion = @"74.32.2"; + + testPayload = [[SDLControlFramePayloadRPCStartService alloc] initWithVersion:testProtocolVersion]; + }); + + it(@"should create the correct data", ^{ + expect(testPayload.data.description).to(equal(@"<22000000 0270726f 746f636f 6c566572 73696f6e 00080000 0037342e 33322e32 0000>")); + }); + }); + + context(@"without parameters", ^{ + beforeEach(^{ + testProtocolVersion = nil; + + testPayload = [[SDLControlFramePayloadRPCStartService alloc] initWithVersion:testProtocolVersion]; + }); + + it(@"should create no data", ^{ + expect(testPayload.data.length).to(equal(0)); + }); + }); +}); + +describe(@"Test decoding data", ^{ + __block SDLControlFramePayloadRPCStartService *testPayload = nil; + __block NSData *testData = nil; + __block NSString *testProtocolVersion = nil; + + beforeEach(^{ + testProtocolVersion = @"59.63.47"; + + SDLControlFramePayloadRPCStartService *firstPayload = [[SDLControlFramePayloadRPCStartService alloc] initWithVersion:testProtocolVersion]; + testData = firstPayload.data; + + testPayload = [[SDLControlFramePayloadRPCStartService alloc] initWithData:testData]; + }); + + it(@"should output the correct params", ^{ + expect(testPayload.protocolVersion).to(equal(testProtocolVersion)); + }); +}); + +QuickSpecEnd |