summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Gluck <justin.gluck@livio.io>2020-01-22 13:25:04 -0500
committerJustin Gluck <justin.gluck@livio.io>2020-01-22 13:25:04 -0500
commit683d636540498f863e89c2a8d7a024f5649dee3f (patch)
treeb0220721b4312a0483c48c4c33db049e03961bfb
parent77cfd53d41459ae0ded67ff3c2234e64465f1ebe (diff)
downloadsdl_ios-683d636540498f863e89c2a8d7a024f5649dee3f.tar.gz
added unit tests
-rw-r--r--SmartDeviceLink/SDLRadioControlData.h1
-rw-r--r--SmartDeviceLink/SDLRadioControlData.m2
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m38
3 files changed, 39 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLRadioControlData.h b/SmartDeviceLink/SDLRadioControlData.h
index bea276856..8a940e96f 100644
--- a/SmartDeviceLink/SDLRadioControlData.h
+++ b/SmartDeviceLink/SDLRadioControlData.h
@@ -41,7 +41,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (instancetype)initWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction band:(nullable SDLRadioBand)band hdChannel:(nullable NSNumber<SDLInt> *)hdChannel radioEnable:(nullable NSNumber<SDLBool> *)radioEnable hdRadioEnable:(nullable NSNumber<SDLBool> *)hdRadioEnable;
-
/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
///
/// @param frequencyInteger Must be between 875 and 1080
diff --git a/SmartDeviceLink/SDLRadioControlData.m b/SmartDeviceLink/SDLRadioControlData.m
index 5d40ca372..cc4c37154 100644
--- a/SmartDeviceLink/SDLRadioControlData.m
+++ b/SmartDeviceLink/SDLRadioControlData.m
@@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
if(!self) {
return nil;
}
-
+
self.band = SDLRadioBandFM;
self.frequencyInteger = frequencyInteger;
self.frequencyFraction = frequencyFraction;
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m
index fd74e0f38..d6e56fb3d 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m
@@ -155,6 +155,44 @@ describe(@"Initialization tests", ^{
expect(testStruct.hdRadioEnable).to(equal(@YES));
});
+ it(@"Should get correctly when initialized FM radio control capabilities parameters", ^ {
+ SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initFMWithFrequencyInteger:@101 frequencyFraction:@7];
+
+ expect(testStruct.frequencyInteger).to(equal(@101));
+ expect(testStruct.frequencyFraction).to(equal(@7));
+ expect(testStruct.band).to(equal(SDLRadioBandFM));
+ });
+
+ it(@"Should get correctly when initialized FM radio control capabilities parameters", ^ {
+ SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initFMWithHdChannel:@5];
+
+ expect(testStruct.hdChannel).to(equal(@5));
+ expect(testStruct.band).to(equal(SDLRadioBandFM));
+ });
+
+ it(@"Should get correctly when initialized AM radio control capabilities parameters", ^ {
+ SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initAMWithFrequencyInteger:@101];
+
+ expect(testStruct.frequencyInteger).to(equal(@101));
+ expect(testStruct.band).to(equal(SDLRadioBandAM));
+ });
+
+ it(@"Should get correctly when initialized AM radio control capabilities parameters", ^ {
+ SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initAMWithHdChannel:@5];
+
+ expect(testStruct.hdChannel).to(equal(@5));
+ expect(testStruct.band).to(equal(SDLRadioBandAM));
+ });
+
+ it(@"Should get correctly when initialized XM radio control capabilities parameters", ^ {
+ SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initXMWithFrequencyInteger:@101];
+
+ expect(testStruct.frequencyInteger).to(equal(@101));
+ expect(testStruct.band).to(equal(SDLRadioBandXM));
+ });
+
+
+
});
QuickSpecEnd