summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com>2021-01-21 13:13:33 +0200
committerleonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com>2021-01-21 13:13:33 +0200
commit8d4e364a0103a73846522cbf6667844a1acc4c33 (patch)
tree5d0292c8497136a5647680f176da24f542da7a0d
parentcc27ffe2336a9de677708a1636874dbfe80b9ba8 (diff)
downloadsdl_ios-8d4e364a0103a73846522cbf6667844a1acc4c33.tar.gz
[0255] 'Enhance BodyInformation vehicle data': apply review comments
-rw-r--r--SmartDeviceLink/public/SDLBodyInformation.m18
-rw-r--r--SmartDeviceLink/public/SDLDoorStatus.m7
-rw-r--r--SmartDeviceLink/public/SDLGateStatus.m7
-rw-r--r--SmartDeviceLink/public/SDLRoofStatus.m12
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLBodyInformationSpec.m8
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDoorStatusSpec.m13
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGateStatusSpec.m8
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRoofStatusSpec.m8
8 files changed, 35 insertions, 46 deletions
diff --git a/SmartDeviceLink/public/SDLBodyInformation.m b/SmartDeviceLink/public/SDLBodyInformation.m
index dff2f98b7..d3d6f917e 100644
--- a/SmartDeviceLink/public/SDLBodyInformation.m
+++ b/SmartDeviceLink/public/SDLBodyInformation.m
@@ -17,21 +17,23 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithParkBrakeActive:(BOOL)parkBrakeActive ignitionStableStatus:(SDLIgnitionStableStatus)ignitionStableStatus ignitionStatus:(SDLIgnitionStatus)ignitionStatus {
self = [self init];
- if (self) {
- self.parkBrakeActive = @(parkBrakeActive);
- self.ignitionStableStatus = ignitionStableStatus;
- self.ignitionStatus = ignitionStatus;
+ if (!self) {
+ return nil;
}
+ self.parkBrakeActive = @(parkBrakeActive);
+ self.ignitionStableStatus = ignitionStableStatus;
+ self.ignitionStatus = ignitionStatus;
return self;
}
- (instancetype)initWithParkBrakeActive:(BOOL)parkBrakeActive ignitionStableStatus:(SDLIgnitionStableStatus)ignitionStableStatus ignitionStatus:(SDLIgnitionStatus)ignitionStatus doorStatuses:(nullable NSArray<SDLDoorStatus *> *)doorStatuses gateStatuses:(nullable NSArray<SDLGateStatus *> *)gateStatuses roofStatuses:(nullable NSArray<SDLRoofStatus *> *)roofStatuses {
self = [self initWithParkBrakeActive:parkBrakeActive ignitionStableStatus:ignitionStableStatus ignitionStatus:ignitionStatus];
- if (self) {
- self.doorStatuses = doorStatuses;
- self.gateStatuses = gateStatuses;
- self.roofStatuses = roofStatuses;
+ if (!self) {
+ return nil;
}
+ self.doorStatuses = doorStatuses;
+ self.gateStatuses = gateStatuses;
+ self.roofStatuses = roofStatuses;
return self;
}
diff --git a/SmartDeviceLink/public/SDLDoorStatus.m b/SmartDeviceLink/public/SDLDoorStatus.m
index 1e82caaa1..0c1e6e8ea 100644
--- a/SmartDeviceLink/public/SDLDoorStatus.m
+++ b/SmartDeviceLink/public/SDLDoorStatus.m
@@ -42,10 +42,11 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithLocation:(SDLGrid *)location status:(SDLDoorStatusType)status {
self = [self init];
- if (self) {
- self.location = location;
- self.status = status;
+ if (!self) {
+ return nil;
}
+ self.location = location;
+ self.status = status;
return self;
}
diff --git a/SmartDeviceLink/public/SDLGateStatus.m b/SmartDeviceLink/public/SDLGateStatus.m
index bc6ac33bd..f82885f90 100644
--- a/SmartDeviceLink/public/SDLGateStatus.m
+++ b/SmartDeviceLink/public/SDLGateStatus.m
@@ -41,10 +41,11 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithLocation:(SDLGrid *)location status:(SDLDoorStatusType)status {
self = [self init];
- if (self) {
- self.location = location;
- self.status = status;
+ if (!self) {
+ return nil;
}
+ self.location = location;
+ self.status = status;
return self;
}
diff --git a/SmartDeviceLink/public/SDLRoofStatus.m b/SmartDeviceLink/public/SDLRoofStatus.m
index 60a104666..666286575 100644
--- a/SmartDeviceLink/public/SDLRoofStatus.m
+++ b/SmartDeviceLink/public/SDLRoofStatus.m
@@ -43,18 +43,20 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithLocation:(SDLGrid *)location status:(SDLDoorStatusType)status {
self = [self init];
- if (self) {
- self.location = location;
- self.status = status;
+ if (!self) {
+ return nil;
}
+ self.location = location;
+ self.status = status;
return self;
}
- (instancetype)initWithLocation:(SDLGrid *)location status:(SDLDoorStatusType)status state:(nullable SDLWindowState *)state {
self = [self initWithLocation:location status:status];
- if (self) {
- self.state = state;
+ if (!self) {
+ return nil;
}
+ self.state = state;
return self;
}
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLBodyInformationSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLBodyInformationSpec.m
index 8222e7593..a7fa46263 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLBodyInformationSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLBodyInformationSpec.m
@@ -23,13 +23,9 @@ NSArray<SDLGateStatus *> *gateStatuses = @[[[SDLGateStatus alloc] init]];
NSArray<SDLRoofStatus *> *roofStatuses = @[[[SDLRoofStatus alloc] init]];
SDLIgnitionStableStatus ignitionStableStatus = SDLIgnitionStableStatusStable;
SDLIgnitionStatus ignitionStatus = SDLIgnitionStatusStart;
-__block SDLBodyInformation* testStruct = nil;
+__block SDLBodyInformation *testStruct = nil;
describe(@"getter/setter tests", ^{
- afterEach(^{
- testStruct = nil;
- });
-
context(@"init and assign", ^{
beforeEach(^{
testStruct = [[SDLBodyInformation alloc] init];
@@ -71,7 +67,7 @@ describe(@"getter/setter tests", ^{
context(@"initWithDictionary:", ^{
beforeEach(^{
- NSDictionary* dict = @{
+ NSDictionary *dict = @{
SDLRPCParameterNameParkBrakeActive:@YES,
SDLRPCParameterNameIgnitionStableStatus:SDLIgnitionStableStatusNotStable,
SDLRPCParameterNameIgnitionStatus:SDLIgnitionStatusStart,
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDoorStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDoorStatusSpec.m
index 43ac7c91e..17eed73b7 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDoorStatusSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLDoorStatusSpec.m
@@ -17,13 +17,9 @@ QuickSpecBegin(SDLDoorStatusSpec)
SDLGrid *location = [[SDLGrid alloc] init];
SDLDoorStatusType status = SDLDoorStatusTypeAjar;
-__block SDLDoorStatus* testStruct = nil;
+__block SDLDoorStatus *testStruct = nil;
describe(@"getter/setter tests", ^{
- afterEach(^{
- testStruct = nil;
- });
-
context(@"init and assign", ^{
beforeEach(^{
testStruct = [[SDLDoorStatus alloc] init];
@@ -43,7 +39,7 @@ describe(@"getter/setter tests", ^{
context(@"initWithDictionary:", ^{
beforeEach(^{
- NSDictionary* dict = @{
+ NSDictionary *dict = @{
SDLRPCParameterNameLocation:location,
SDLRPCParameterNameStatus:status,
};
@@ -78,15 +74,14 @@ describe(@"getter/setter tests", ^{
context(@"initWithLocation:status:", ^{
beforeEach(^{
testStruct = [[SDLDoorStatus alloc] initWithLocation:location status:status];
+ testStruct.location = location;
+ testStruct.status = status;
});
it(@"expect struct is not nil", ^{
expect(testStruct).notTo(beNil());
});
- testStruct.location = location;
- testStruct.status = status;
-
it(@"expect all properties to be set correctly", ^{
expect(testStruct.location).to(equal(location));
expect(testStruct.status).to(equal(status));
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGateStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGateStatusSpec.m
index 00b52f961..d35517cea 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGateStatusSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLGateStatusSpec.m
@@ -1,5 +1,5 @@
//
-// SDLGateStatus.m
+// SDLGateStatusSpec.m
// SmartDeviceLink
@@ -21,10 +21,6 @@ SDLDoorStatusType status = SDLDoorStatusTypeAjar;
__block SDLGateStatus *testStruct = nil;
describe(@"getter/setter tests", ^{
- afterEach(^{
- testStruct = nil;
- });
-
context(@"init and assign", ^{
beforeEach(^{
testStruct = [[SDLGateStatus alloc] init];
@@ -44,7 +40,7 @@ describe(@"getter/setter tests", ^{
context(@"initWithDictionary:", ^{
beforeEach(^{
- NSDictionary* dict = @{
+ NSDictionary *dict = @{
SDLRPCParameterNameLocation:location,
SDLRPCParameterNameStatus:status,
};
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRoofStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRoofStatusSpec.m
index 80781b5c0..933ad1d0c 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRoofStatusSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRoofStatusSpec.m
@@ -19,13 +19,9 @@ QuickSpecBegin(SDLRoofStatusSpec)
SDLGrid *location = [[SDLGrid alloc] init];
SDLDoorStatusType status = SDLDoorStatusTypeAjar;
SDLWindowState *state = [[SDLWindowState alloc] init];
-__block SDLRoofStatus* testStruct = nil;
+__block SDLRoofStatus *testStruct = nil;
describe(@"getter/setter tests", ^{
- afterEach(^{
- testStruct = nil;
- });
-
context(@"init and assign", ^{
beforeEach(^{
testStruct = [[SDLRoofStatus alloc] init];
@@ -47,7 +43,7 @@ describe(@"getter/setter tests", ^{
context(@"initWithDictionary:", ^{
beforeEach(^{
- NSDictionary* dict = @{
+ NSDictionary *dict = @{
SDLRPCParameterNameLocation:location,
SDLRPCParameterNameStatus:status,
SDLRPCParameterNameState:state,