summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m
diff options
context:
space:
mode:
Diffstat (limited to 'SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m')
-rw-r--r--SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m45
1 files changed, 19 insertions, 26 deletions
diff --git a/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m b/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m
index b09d1b4e5..f730c17c1 100644
--- a/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m
+++ b/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m
@@ -2,6 +2,7 @@
#import <Nimble/Nimble.h>
#import "SDLGlobals.h"
+#import "SDLVersion.h"
QuickSpecBegin(SDLGlobalsSpec)
@@ -14,68 +15,60 @@ describe(@"The SDLGlobals class", ^{
describe(@"when just initialized", ^{
it(@"should properly set parameters", ^{
- expect(testGlobals.protocolVersion).to(equal(@"1.0.0"));
- expect(testGlobals.majorProtocolVersion).to(equal(1));
- expect(testGlobals.maxHeadUnitVersion).to(equal(@"0.0.0"));
+ expect(testGlobals.protocolVersion.stringVersion).to(equal(@"1.0.0"));
+ expect(testGlobals.protocolVersion.major).to(equal(1));
+ expect(testGlobals.maxHeadUnitProtocolVersion.stringVersion).to(equal(@"0.0.0"));
expect([testGlobals mtuSizeForServiceType:SDLServiceTypeRPC]).to(equal(SDLV1MTUSize));
- expect(testGlobals.rpcVersion).to(equal([[SDLSyncMsgVersion alloc] initWithMajorVersion:1 minorVersion:0 patchVersion:0]));
- });
- });
-
- describe(@"setting the RPC version", ^{
- it(@"should properly set", ^{
- testGlobals.rpcVersion = [[SDLSyncMsgVersion alloc] initWithMajorVersion:4 minorVersion:2 patchVersion:3];
-
- expect(testGlobals.rpcVersion).to(equal([[SDLSyncMsgVersion alloc] initWithMajorVersion:4 minorVersion:2 patchVersion:3]));
+ expect(testGlobals.rpcVersion).to(equal([[SDLVersion alloc] initWithMajor:1 minor:0 patch:0]));
});
});
describe(@"setting maxHeadUnitVersion should alter negotiated protocol version", ^{
it(@"should use the max head unit version when lower than max proxy version", ^{
- NSString *someVersionLowerThanMaxProxyVersion = @"2.0.0";
- testGlobals.maxHeadUnitVersion = someVersionLowerThanMaxProxyVersion;
+ SDLVersion *someVersionLowerThanMaxProxyVersion = [SDLVersion versionWithString:@"2.0.0"];
+ testGlobals.maxHeadUnitProtocolVersion = someVersionLowerThanMaxProxyVersion;
expect(testGlobals.protocolVersion).to(equal(someVersionLowerThanMaxProxyVersion));
- expect(testGlobals.maxHeadUnitVersion).to(equal(someVersionLowerThanMaxProxyVersion));
+ expect(testGlobals.maxHeadUnitProtocolVersion).to(equal(someVersionLowerThanMaxProxyVersion));
});
it(@"should use the max proxy version when lower than max head unit version", ^{
- NSString *someVersionHigherThanMaxProxyVersion = @"1000.0.0";
- testGlobals.maxHeadUnitVersion = someVersionHigherThanMaxProxyVersion;
+ SDLVersion *someVersionHigherThanMaxProxyVersion = [SDLVersion versionWithString:@"1000.0.0"];
+ testGlobals.maxHeadUnitProtocolVersion = someVersionHigherThanMaxProxyVersion;
- expect(([testGlobals.protocolVersion compare:someVersionHigherThanMaxProxyVersion options:NSNumericSearch] == NSOrderedDescending)).to(beFalsy());
- expect(testGlobals.maxHeadUnitVersion).to(equal(someVersionHigherThanMaxProxyVersion));
+ expect([testGlobals.protocolVersion isGreaterThanVersion:someVersionHigherThanMaxProxyVersion]).to(beFalse());
+ expect(testGlobals.maxHeadUnitProtocolVersion).to(equal(someVersionHigherThanMaxProxyVersion));
});
});
describe(@"getting the max MTU version", ^{
context(@"when protocol version is 1 - 2", ^{
it(@"should return the correct value when protocol version is 1", ^{
- testGlobals.maxHeadUnitVersion = @"1.0.0";
+ testGlobals.maxHeadUnitProtocolVersion = [SDLVersion versionWithString:@"1.0.0"];
expect([testGlobals mtuSizeForServiceType:SDLServiceTypeRPC]).to(equal(SDLV1MTUSize));
});
it(@"should return the correct value when protocol version is 2", ^{
- testGlobals.maxHeadUnitVersion = @"2.0.0";
+ testGlobals.maxHeadUnitProtocolVersion = [SDLVersion versionWithString:@"2.0.0"];
expect([testGlobals mtuSizeForServiceType:SDLServiceTypeRPC]).to(equal(SDLV1MTUSize));
});
});
context(@"when protocol version is 3 - 4", ^{
it(@"should return the correct value when protocol version is 3", ^{
- testGlobals.maxHeadUnitVersion = @"3.0.0";
+ testGlobals.maxHeadUnitProtocolVersion = [SDLVersion versionWithString:@"3.0.0"];
expect([testGlobals mtuSizeForServiceType:SDLServiceTypeRPC]).to(equal(SDLV3MTUSize));
});
it(@"should return the correct value when protocol version is 4", ^{
- testGlobals.maxHeadUnitVersion = @"4.0.0";
+ testGlobals.maxHeadUnitProtocolVersion = [SDLVersion versionWithString:@"4.0.0"];
expect([testGlobals mtuSizeForServiceType:SDLServiceTypeRPC]).to(equal(SDLV3MTUSize));
});
describe(@"when the max proxy version is lower than max head unit version", ^{
beforeEach(^{
- NSString *someVersionHigherThanMaxProxyVersion = @"1000.0.0";
- testGlobals.maxHeadUnitVersion = someVersionHigherThanMaxProxyVersion;
+ SDLVersion *someVersionHigherThanMaxProxyVersion = [SDLVersion versionWithString:@"1000.0.0"];
+ testGlobals.maxHeadUnitProtocolVersion = someVersionHigherThanMaxProxyVersion;
});
it(@"should return the v1 - 2 value", ^{
@@ -91,7 +84,7 @@ describe(@"The SDLGlobals class", ^{
__block NSUInteger dynamicMTUSize2 = 54321;
beforeEach(^{
- testGlobals.maxHeadUnitVersion = @"5.0.0";
+ testGlobals.maxHeadUnitProtocolVersion = [SDLVersion versionWithString:@"5.0.0"];
});
context(@"Setting the RPC service MTU", ^{