diff options
author | Justin Beharry <justin.beharry@livio.io> | 2022-09-01 14:28:49 -0400 |
---|---|---|
committer | Justin Beharry <justin.beharry@livio.io> | 2022-09-01 14:28:49 -0400 |
commit | 1d50cc2f21bcd1dbbe2b810e058c757a1f516c96 (patch) | |
tree | dad179ec8b41ad6f5f0d934a75c77c75fe4d9c9b | |
parent | 95da8e724d1d8599a30586539e5eca08b37f5be8 (diff) | |
download | sdl_ios-1d50cc2f21bcd1dbbe2b810e058c757a1f516c96.tar.gz |
Add data to SDLProtocolHeader test
-rw-r--r-- | SmartDeviceLinkTests/ProtocolSpecs/HeaderSpecs/SDLProtocolHeaderSpec.m | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/SmartDeviceLinkTests/ProtocolSpecs/HeaderSpecs/SDLProtocolHeaderSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/HeaderSpecs/SDLProtocolHeaderSpec.m index 0e042ba4b..9dac0203f 100644 --- a/SmartDeviceLinkTests/ProtocolSpecs/HeaderSpecs/SDLProtocolHeaderSpec.m +++ b/SmartDeviceLinkTests/ProtocolSpecs/HeaderSpecs/SDLProtocolHeaderSpec.m @@ -15,6 +15,18 @@ QuickSpecBegin(SDLProtocolHeaderSpec) +__block SDLProtocolHeader *testHeader; + +beforeSuite(^ { + testHeader = [[SDLProtocolHeader alloc] init]; + testHeader.encrypted = YES; + testHeader.frameType = SDLFrameTypeControl; + testHeader.serviceType = SDLServiceTypeRPC; + testHeader.frameData = SDLFrameInfoStartService; + testHeader.sessionID = 0x53; + testHeader.bytesInPayload = 0x1234; +}); + describe(@"HeaderForVersion Tests", ^ { it(@"Should return the correct header", ^ { expect([SDLProtocolHeader headerForVersion:1]).to(beAKindOf(SDLV1ProtocolHeader.class)); @@ -40,16 +52,25 @@ describe(@"DetermineVersion Tests", ^ { describe(@"hashing tests", ^ { it(@"should return equivalent hash values", ^ { - SDLProtocolHeader *testHeader = [[SDLProtocolHeader alloc] init]; SDLProtocolHeader *equalHeader = [[SDLProtocolHeader alloc] init]; + equalHeader.encrypted = YES; + equalHeader.frameType = SDLFrameTypeControl; + equalHeader.serviceType = SDLServiceTypeRPC; + equalHeader.frameData = SDLFrameInfoStartService; + equalHeader.sessionID = 0x53; + equalHeader.bytesInPayload = 0x1234; expect([testHeader hash]).to(equal([equalHeader hash])); }); it(@"should return unequivalent hash values", ^ { - SDLProtocolHeader *testHeader = [[SDLProtocolHeader alloc] init]; SDLProtocolHeader *unequalHeader = [[SDLProtocolHeader alloc] init]; + unequalHeader.encrypted = NO; unequalHeader.frameType = SDLFrameTypeFirst; + unequalHeader.serviceType = SDLServiceTypeVideo; + unequalHeader.frameData = SDLFrameInfoStartService; + unequalHeader.sessionID = 0x54; + unequalHeader.bytesInPayload = 0x1234; expect([testHeader hash]).toNot(equal([unequalHeader hash])); }); |