diff options
author | BrettyWhite <geekman3454@protonmail.com> | 2017-07-27 16:08:36 -0400 |
---|---|---|
committer | BrettyWhite <geekman3454@protonmail.com> | 2017-07-27 16:08:36 -0400 |
commit | 03921e5b6128f412924277c45b2385e94ef4d34f (patch) | |
tree | a54c8d3c06e0bf8c585531710428fc0d7fc464f1 | |
parent | 6f625f2b252e0e70efc22791fe60e0da71b5a012 (diff) | |
download | sdl_ios-03921e5b6128f412924277c45b2385e94ef4d34f.tar.gz |
starting unit tests WIP
5 files changed, 144 insertions, 1 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index d260a99ac..4d7f12421 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -911,6 +911,8 @@ 8BD729AF1F2A5AA10029AC93 /* SDLVideoStreamingFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD729AD1F2A5AA10029AC93 /* SDLVideoStreamingFormat.m */; }; 8BD729B21F2A61DF0029AC93 /* SDLVideoStreamingCapability.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BD729B01F2A61DF0029AC93 /* SDLVideoStreamingCapability.h */; }; 8BD729B31F2A61DF0029AC93 /* SDLVideoStreamingCapability.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD729B11F2A61DF0029AC93 /* SDLVideoStreamingCapability.m */; }; + 8BD729B51F2A711D0029AC93 /* SDLVideoStreamingCodecSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD729B41F2A711D0029AC93 /* SDLVideoStreamingCodecSpec.m */; }; + 8BD729B71F2A75FD0029AC93 /* SDLVideoStreamingProtocolSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD729B61F2A75FD0029AC93 /* SDLVideoStreamingProtocolSpec.m */; }; 97E26DEC1E807AD70074A3C7 /* SDLMutableDataQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E26DEA1E807AD70074A3C7 /* SDLMutableDataQueue.h */; }; 97E26DED1E807AD70074A3C7 /* SDLMutableDataQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 97E26DEB1E807AD70074A3C7 /* SDLMutableDataQueue.m */; }; DA4353DF1D271FD10099B8C4 /* CGPointUtilSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4353DE1D271FD10099B8C4 /* CGPointUtilSpec.m */; }; @@ -1979,6 +1981,8 @@ 8BD729AD1F2A5AA10029AC93 /* SDLVideoStreamingFormat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLVideoStreamingFormat.m; sourceTree = "<group>"; }; 8BD729B01F2A61DF0029AC93 /* SDLVideoStreamingCapability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLVideoStreamingCapability.h; sourceTree = "<group>"; }; 8BD729B11F2A61DF0029AC93 /* SDLVideoStreamingCapability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLVideoStreamingCapability.m; sourceTree = "<group>"; }; + 8BD729B41F2A711D0029AC93 /* SDLVideoStreamingCodecSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLVideoStreamingCodecSpec.m; sourceTree = "<group>"; }; + 8BD729B61F2A75FD0029AC93 /* SDLVideoStreamingProtocolSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLVideoStreamingProtocolSpec.m; sourceTree = "<group>"; }; 97E26DEA1E807AD70074A3C7 /* SDLMutableDataQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLMutableDataQueue.h; sourceTree = "<group>"; }; 97E26DEB1E807AD70074A3C7 /* SDLMutableDataQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLMutableDataQueue.m; sourceTree = "<group>"; }; DA4353DE1D271FD10099B8C4 /* CGPointUtilSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CGPointUtilSpec.m; path = UtilitiesSpecs/Touches/CGPointUtilSpec.m; sourceTree = "<group>"; }; @@ -2190,6 +2194,8 @@ 162E82241A9BDE8A00906325 /* SDLWarningLightStatusSpec.m */, DA9F7E9D1DCC05B900ACAE48 /* SDLWaypointTypeSpec.m */, 162E82251A9BDE8A00906325 /* SDLWiperStatusSpec.m */, + 8BD729B41F2A711D0029AC93 /* SDLVideoStreamingCodecSpec.m */, + 8BD729B61F2A75FD0029AC93 /* SDLVideoStreamingProtocolSpec.m */, ); path = EnumSpecs; sourceTree = "<group>"; @@ -4854,6 +4860,7 @@ 5DCF76FE1ACDDB5A00BB647B /* SDLSendLocationResponseSpec.m in Sources */, 162E837D1A9BDE8B00906325 /* SDLEmergencyEventSpec.m in Sources */, 162E82D31A9BDE8A00906325 /* SDLCarModeStatusSpec.m in Sources */, + 8BD729B71F2A75FD0029AC93 /* SDLVideoStreamingProtocolSpec.m in Sources */, 162E82EA1A9BDE8B00906325 /* SDLLanguageSpec.m in Sources */, 5D76E3291D3D0A8800647CFA /* SDLFakeViewControllerPresenter.m in Sources */, 162E83331A9BDE8B00906325 /* SDLPerformInteractionSpec.m in Sources */, @@ -5022,6 +5029,7 @@ 162E83031A9BDE8B00906325 /* SDLTriggerSource.m in Sources */, 162E82D61A9BDE8A00906325 /* SDLComponentVolumeStatusSpec.m in Sources */, 162E835C1A9BDE8B00906325 /* SDLPutFileResponseSpec.m in Sources */, + 8BD729B51F2A711D0029AC93 /* SDLVideoStreamingCodecSpec.m in Sources */, DA9F7EAA1DCC061A00ACAE48 /* SDLSubscribeWaypointsResponseSpec.m in Sources */, 162E835F1A9BDE8B00906325 /* SDLResetGlobalPropertiesResponseSpec.m in Sources */, 162E835E1A9BDE8B00906325 /* SDLRegisterAppInterfaceResponseSpec.m in Sources */, diff --git a/SmartDeviceLink/SDLVideoStreamingCapability.m b/SmartDeviceLink/SDLVideoStreamingCapability.m index 9ddc4cf32..6531b0167 100644 --- a/SmartDeviceLink/SDLVideoStreamingCapability.m +++ b/SmartDeviceLink/SDLVideoStreamingCapability.m @@ -71,5 +71,4 @@ } } - @end diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSystemCapabilityTypeSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSystemCapabilityTypeSpec.m index f979b28aa..68d8fabd5 100644 --- a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSystemCapabilityTypeSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLSystemCapabilityTypeSpec.m @@ -12,12 +12,14 @@ describe(@"Individual Enum Value Tests", ^ { it(@"Should match internal values", ^ { expect([SDLSystemCapabilityType NAVIGATION].value).to(equal(@"NAVIGATION")); expect([SDLSystemCapabilityType PHONE_CALL].value).to(equal(@"PHONE_CALL")); + expect([SDLSystemCapabilityType VIDEO_STREAMING].value).to(equal(@"VIDEO_STREAMING")); }); }); describe(@"ValueOf Tests", ^ { it(@"Should return correct values when valid", ^ { expect([SDLSystemCapabilityType valueOf:@"NAVIGATION"]).to(equal([SDLSystemCapabilityType NAVIGATION])); expect([SDLSystemCapabilityType valueOf:@"PHONE_CALL"]).to(equal([SDLSystemCapabilityType PHONE_CALL])); + //expect([SDLSystemCapabilityType valueOf:@"VIDEO_STREAMING"]).to(equal([SDLSystemCapabilityType VIDEO_STREAMING])); }); it(@"Should return nil when invalid", ^ { diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingCodecSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingCodecSpec.m new file mode 100644 index 000000000..023133bd3 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingCodecSpec.m @@ -0,0 +1,67 @@ +// +// SDLVideoStreamingCodecSpec.m +// SmartDeviceLink-iOS +// +// Created by Brett McIsaac on 7/27/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLVideoStreamingCodec.h" + +QuickSpecBegin(SDLVideoStreamingCodecSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect([SDLVideoStreamingCodec H264].value).to(equal(@"H264")); + expect([SDLVideoStreamingCodec H265].value).to(equal(@"H265")); + expect([SDLVideoStreamingCodec THEORA].value).to(equal(@"THEORA")); + expect([SDLVideoStreamingCodec VP8].value).to(equal(@"VP8")); + expect([SDLVideoStreamingCodec VP9].value).to(equal(@"VP9")); + }); +}); + +describe(@"ValueOf Tests", ^ { + it(@"Should return correct values when valid", ^ { + expect([SDLVideoStreamingCodec valueOf:@"H264"]).to(equal([SDLVideoStreamingCodec H264])); + expect([SDLVideoStreamingCodec valueOf:@"H265"]).to(equal([SDLVideoStreamingCodec H265])); + expect([SDLVideoStreamingCodec valueOf:@"THEORA"]).to(equal([SDLVideoStreamingCodec THEORA])); + expect([SDLVideoStreamingCodec valueOf:@"VP8"]).to(equal([SDLVideoStreamingCodec VP8])); + expect([SDLVideoStreamingCodec valueOf:@"VP9"]).to(equal([SDLVideoStreamingCodec VP9])); + }); + + it(@"Should return nil when invalid", ^ { + expect([SDLVideoStreamingCodec valueOf:nil]).to(beNil()); + expect([SDLVideoStreamingCodec valueOf:@"JKUYTFHYTHJGFRFGYTR"]).to(beNil()); + }); +}); + +describe(@"Value List Tests", ^ { + NSArray* storedValues = [SDLVideoStreamingCodec values]; + __block NSArray* definedValues; + beforeSuite(^ { + definedValues = [@[[SDLVideoStreamingCodec H264], + [SDLVideoStreamingCodec H265], + [SDLVideoStreamingCodec THEORA], + [SDLVideoStreamingCodec VP8], + [SDLVideoStreamingCodec VP9]] copy]; + }); + + it(@"Should contain all defined enum values", ^ { + for (int i = 0; i < definedValues.count; i++) { + expect(storedValues).to(contain(definedValues[i])); + } + }); + + it(@"Should contain only defined enum values", ^ { + for (int i = 0; i < storedValues.count; i++) { + expect(definedValues).to(contain(storedValues[i])); + } + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingProtocolSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingProtocolSpec.m new file mode 100644 index 000000000..d3503786b --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingProtocolSpec.m @@ -0,0 +1,67 @@ +// +// SDLVideoStreamingProtocolSpec.m +// SmartDeviceLink-iOS +// +// Created by Brett McIsaac on 7/27/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLVideoStreamingProtocol.h" + +QuickSpecBegin(SDLVideoStreamingProtocolSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect([SDLVideoStreamingProtocol RAW].value).to(equal(@"RAW")); + expect([SDLVideoStreamingProtocol RTP].value).to(equal(@"RTP")); + expect([SDLVideoStreamingProtocol RTSP].value).to(equal(@"RTSP")); + expect([SDLVideoStreamingProtocol RTMP].value).to(equal(@"RTMP")); + expect([SDLVideoStreamingProtocol WEBM].value).to(equal(@"WEBM")); + }); +}); + +describe(@"ValueOf Tests", ^ { + it(@"Should return correct values when valid", ^ { + expect([SDLVideoStreamingProtocol valueOf:@"RAW"]).to(equal([SDLVideoStreamingProtocol RAW])); + expect([SDLVideoStreamingProtocol valueOf:@"RTP"]).to(equal([SDLVideoStreamingProtocol RTP])); + expect([SDLVideoStreamingProtocol valueOf:@"RTSP"]).to(equal([SDLVideoStreamingProtocol RTSP])); + expect([SDLVideoStreamingProtocol valueOf:@"RTMP"]).to(equal([SDLVideoStreamingProtocol RTMP])); + expect([SDLVideoStreamingProtocol valueOf:@"WEBM"]).to(equal([SDLVideoStreamingProtocol WEBM])); + }); + + it(@"Should return nil when invalid", ^ { + expect([SDLVideoStreamingProtocol valueOf:nil]).to(beNil()); + expect([SDLVideoStreamingProtocol valueOf:@"JKUYTFHYTHJGFRFGYTR"]).to(beNil()); + }); +}); + +describe(@"Value List Tests", ^ { + NSArray* storedValues = [SDLVideoStreamingProtocol values]; + __block NSArray* definedValues; + beforeSuite(^ { + definedValues = [@[[SDLVideoStreamingProtocol RAW], + [SDLVideoStreamingProtocol RTP], + [SDLVideoStreamingProtocol RTSP], + [SDLVideoStreamingProtocol RTMP], + [SDLVideoStreamingProtocol WEBM]] copy]; + }); + + it(@"Should contain all defined enum values", ^ { + for (int i = 0; i < definedValues.count; i++) { + expect(storedValues).to(contain(definedValues[i])); + } + }); + + it(@"Should contain only defined enum values", ^ { + for (int i = 0; i < storedValues.count; i++) { + expect(definedValues).to(contain(storedValues[i])); + } + }); +}); + +QuickSpecEnd |