diff options
Diffstat (limited to 'SmartDeviceLinkTests/UtilitiesSpecs/SDLHexUtilitySpec.m')
-rw-r--r-- | SmartDeviceLinkTests/UtilitiesSpecs/SDLHexUtilitySpec.m | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/SmartDeviceLinkTests/UtilitiesSpecs/SDLHexUtilitySpec.m b/SmartDeviceLinkTests/UtilitiesSpecs/SDLHexUtilitySpec.m new file mode 100644 index 000000000..f9a539103 --- /dev/null +++ b/SmartDeviceLinkTests/UtilitiesSpecs/SDLHexUtilitySpec.m @@ -0,0 +1,36 @@ +// +// SDLHexUtilitySpec.m +// SmartDeviceLink-iOS + +#import <UIKit/UIKit.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLHexUtility.h" + + +QuickSpecBegin(SDLHexUtilitySpec) + +describe(@"getting a hex string", ^{ + context(@"from a byte array", ^{ + it(@"correctly returns a hex string", ^{ + UInt8 byteArray[] = {0x00, 0x0F, 0xFF, 0x13}; + NSString *hexString = [SDLHexUtility getHexString:byteArray length:4]; + + expect(hexString).to(equal(@"000FFF13")); + }); + }); + + context(@"From a data object", ^{ + it(@"correctly returns a hex string", ^{ + UInt8 byteArray[] = {0x00, 0x0F, 0xFF, 0x13}; + NSData *byteData = [NSData dataWithBytes:byteArray length:4]; + NSString *hexString = [SDLHexUtility getHexString:byteData]; + + expect(hexString).to(equal(@"000FFF13")); + }); + }); +}); + +QuickSpecEnd |