Skip to content

Commit

Permalink
added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Gluck committed Jan 22, 2020
1 parent 77cfd53 commit 683d636
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
1 change: 0 additions & 1 deletion SmartDeviceLink/SDLRadioControlData.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink/SDLRadioControlData.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ - (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequenc
if(!self) {
return nil;
}

self.band = SDLRadioBandFM;
self.frequencyInteger = frequencyInteger;
self.frequencyFraction = frequencyFraction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,44 @@
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

0 comments on commit 683d636

Please sign in to comment.