Skip to content

Commit

Permalink
PR issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Gluck committed Jan 24, 2020
1 parent 63bb31a commit 3a3be8b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 55 deletions.
14 changes: 2 additions & 12 deletions SmartDeviceLink/SDLRadioControlData.h
Expand Up @@ -45,26 +45,16 @@ NS_ASSUME_NONNULL_BEGIN
///
/// @param frequencyInteger Must be between 0 and 1710
/// @param frequencyFraction Must be between 0 and 9
/// @return An instance of the SDLRadioControlData class
- (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction;

/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
///
/// @param hdChannel Must be between 0 and 7
/// @return An instance of the SDLRadioControlData class
- (instancetype)initFMWithHdChannel:(nullable NSNumber<SDLInt> *)hdChannel;
- (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction hdChannel:(nullable NSNumber<SDLInt> *)hdChannel;

/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
///
/// @param frequencyInteger Must be between 0 and 1710
/// @return An instance of the SDLRadioControlData class
- (instancetype)initAMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger;

/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
///
/// @param hdChannel Must be between 0 and 7
/// @return An instance of the SDLRadioControlData class
- (instancetype)initAMWithHdChannel:(nullable NSNumber<SDLInt> *)hdChannel;
- (instancetype)initAMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger hdChannel:(nullable NSNumber<SDLInt> *)hdChannel;

/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
///
Expand Down
32 changes: 5 additions & 27 deletions SmartDeviceLink/SDLRadioControlData.m
Expand Up @@ -43,7 +43,7 @@ - (instancetype)initWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyI
return self;
}

- (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction {
- (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction hdChannel:(nullable NSNumber<SDLInt> *)hdChannel {
self = [self init];
if(!self) {
return nil;
Expand All @@ -52,18 +52,20 @@ - (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequenc
self.band = SDLRadioBandFM;
self.frequencyInteger = frequencyInteger;
self.frequencyFraction = frequencyFraction;
self.hdChannel = hdChannel;

return self;
}

- (instancetype)initAMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger {
- (instancetype)initAMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger hdChannel:(nullable NSNumber<SDLInt> *)hdChannel {
self = [self init];
if(!self) {
return nil;
}

self.frequencyInteger = frequencyInteger;
self.band = SDLRadioBandAM;
self.frequencyInteger = frequencyInteger;
self.hdChannel = hdChannel;

return self;
}
Expand All @@ -80,30 +82,6 @@ - (instancetype)initXMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequenc
return self;
}

- (instancetype)initFMWithHdChannel:(nullable NSNumber<SDLInt> *)hdChannel {
self = [self init];
if(!self) {
return nil;
}

self.hdChannel = hdChannel;
self.band = SDLRadioBandFM;

return self;
}

- (instancetype)initAMWithHdChannel:(nullable NSNumber<SDLInt> *)hdChannel {
self = [self init];
if(!self) {
return nil;
}

self.hdChannel = hdChannel;
self.band = SDLRadioBandAM;

return self;
}

- (void)setFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger {
[self.store sdl_setObject:frequencyInteger forName:SDLRPCParameterNameFrequencyInteger];
}
Expand Down
Expand Up @@ -156,32 +156,20 @@
});

it(@"Should get correctly when initialized FM radio control capabilities parameters", ^ {
SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initFMWithFrequencyInteger:@101 frequencyFraction:@7];
SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initFMWithFrequencyInteger:@101 frequencyFraction:@7 hdChannel:@2];

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));
expect(testStruct.hdChannel).to(equal(@2));
});

it(@"Should get correctly when initialized AM radio control capabilities parameters", ^ {
SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initAMWithFrequencyInteger:@101];
SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initAMWithFrequencyInteger:@101 hdChannel:@2];

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));
expect(testStruct.hdChannel).to(equal(@2));
});

it(@"Should get correctly when initialized XM radio control capabilities parameters", ^ {
Expand Down

0 comments on commit 3a3be8b

Please sign in to comment.