diff options
author | Frank Elias <francois.elias@livio.io> | 2021-03-04 14:09:18 -0500 |
---|---|---|
committer | Frank Elias <francois.elias@livio.io> | 2021-03-04 14:09:18 -0500 |
commit | 3baa380fc9dd7f1945f2126671cf4e931e45e71e (patch) | |
tree | dc0b0ebb7031750478b633547c8ada3c612541e7 /SmartDeviceLinkTests/DevAPISpecs/NSArray+ExtensionsSpec.m | |
parent | ab95191870654e556caa5448dbccfb1d72cef612 (diff) | |
parent | 19055a83e82f5883335aafbf646e750022055ac9 (diff) | |
download | sdl_ios-3baa380fc9dd7f1945f2126671cf4e931e45e71e.tar.gz |
Merge branch 'develop' into bugfix/issue-1928-main-menu-ui-updates-do-not-take-textFieldName-imageFieldName-into-consideration
Diffstat (limited to 'SmartDeviceLinkTests/DevAPISpecs/NSArray+ExtensionsSpec.m')
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/NSArray+ExtensionsSpec.m | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/NSArray+ExtensionsSpec.m b/SmartDeviceLinkTests/DevAPISpecs/NSArray+ExtensionsSpec.m new file mode 100644 index 000000000..7a8bf1277 --- /dev/null +++ b/SmartDeviceLinkTests/DevAPISpecs/NSArray+ExtensionsSpec.m @@ -0,0 +1,60 @@ +// +// NSArray+ExtensionsSpec.m +// SmartDeviceLinkTests +// +// Created by Joel Fischer on 2/22/21. +// Copyright © 2021 smartdevicelink. All rights reserved. +// + +#import "NSArray+Extensions.h" + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +QuickSpecBegin(NSArray_ExtensionsSpec) + +describe(@"checking the dynamic hash of an array", ^{ + __block NSArray *testArray = nil; + + beforeEach(^{ + testArray = nil; + }); + + context(@"when the array has no objects", ^{ + beforeEach(^{ + testArray = @[]; + }); + + it(@"should return a dynamic hash of 0", ^{ + expect(testArray.dynamicHash).to(equal(0)); + }); + }); + + context(@"when the array contains one string", ^{ + beforeEach(^{ + testArray = @[@"test string"]; + }); + + it(@"should return a consistent dynamic hash", ^{ + expect(testArray.dynamicHash).to(equal(testArray.dynamicHash)); + }); + + it(@"should return a different hash than the normal hash function", ^{ + expect(testArray.dynamicHash).toNot(equal(testArray.hash)); + }); + }); + + context(@"when the array contains multiple strings", ^{ + it(@"should return different numbers depending on where the strings are in the array", ^{ + testArray = @[@"test string", @"test string 2"]; + NSUInteger hash1 = testArray.dynamicHash; + + testArray = @[@"test string 2", @"test string"]; + NSUInteger hash2 = testArray.dynamicHash; + + expect(hash1).toNot(equal(hash2)); + }); + }); +}); + +QuickSpecEnd |