1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
//
// SDLSubscribeVehicleDataSpec.m
// SmartDeviceLink
#import <Foundation/Foundation.h>
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import "SDLSubscribeVehicleData.h"
#import "SDLNames.h"
QuickSpecBegin(SDLSubscribeVehicleDataSpec)
describe(@"Getter/Setter Tests", ^ {
it(@"Should set and get correctly", ^ {
SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] init];
testRequest.gps = @YES;
testRequest.speed = @NO;
testRequest.rpm = @YES;
testRequest.fuelLevel = @NO;
testRequest.fuelLevel_State = @YES;
testRequest.instantFuelConsumption = @NO;
testRequest.externalTemperature = @YES;
testRequest.prndl = @YES;
testRequest.tirePressure = @NO;
testRequest.odometer = @YES;
testRequest.beltStatus = @NO;
testRequest.bodyInformation = @YES;
testRequest.deviceStatus = @NO;
testRequest.driverBraking = @YES;
testRequest.wiperStatus = @NO;
testRequest.headLampStatus = @YES;
testRequest.engineTorque = @NO;
testRequest.accPedalPosition = @YES;
testRequest.steeringWheelAngle = @NO;
testRequest.eCallInfo = @YES;
testRequest.airbagStatus = @NO;
testRequest.emergencyEvent = @YES;
testRequest.clusterModeStatus = @NO;
testRequest.myKey = @YES;
expect(testRequest.gps).to(equal(@YES));
expect(testRequest.speed).to(equal(@NO));
expect(testRequest.rpm).to(equal(@YES));
expect(testRequest.fuelLevel).to(equal(@NO));
expect(testRequest.fuelLevel_State).to(equal(@YES));
expect(testRequest.instantFuelConsumption).to(equal(@NO));
expect(testRequest.externalTemperature).to(equal(@YES));
expect(testRequest.prndl).to(equal(@YES));
expect(testRequest.tirePressure).to(equal(@NO));
expect(testRequest.odometer).to(equal(@YES));
expect(testRequest.beltStatus).to(equal(@NO));
expect(testRequest.bodyInformation).to(equal(@YES));
expect(testRequest.deviceStatus).to(equal(@NO));
expect(testRequest.driverBraking).to(equal(@YES));
expect(testRequest.wiperStatus).to(equal(@NO));
expect(testRequest.headLampStatus).to(equal(@YES));
expect(testRequest.engineTorque).to(equal(@NO));
expect(testRequest.accPedalPosition).to(equal(@YES));
expect(testRequest.steeringWheelAngle).to(equal(@NO));
expect(testRequest.eCallInfo).to(equal(@YES));
expect(testRequest.airbagStatus).to(equal(@NO));
expect(testRequest.emergencyEvent).to(equal(@YES));
expect(testRequest.clusterModeStatus).to(equal(@NO));
expect(testRequest.myKey).to(equal(@YES));
});
it(@"Should get correctly when initialized", ^ {
NSMutableDictionary* dict = [@{SDLNameRequest:
@{SDLNameParameters:
@{SDLNameGps:@YES,
SDLNameSpeed:@NO,
SDLNameRpm:@YES,
SDLNameFuelLevel:@NO,
SDLNameFuelLevelState:@YES,
SDLNameInstantFuelConsumption:@NO,
SDLNameExternalTemperature:@YES,
SDLNamePrndl:@YES,
SDLNameTirePressure:@NO,
SDLNameOdometer:@YES,
SDLNameBeltStatus:@NO,
SDLNameBodyInformation:@YES,
SDLNameDeviceStatus:@NO,
SDLNameDriverBraking:@YES,
SDLNameWiperStatus:@NO,
SDLNameHeadLampStatus:@YES,
SDLNameEngineTorque:@NO,
SDLNameAccPedalPosition:@YES,
SDLNameSteeringWheelAngle:@NO,
SDLNameECallInfo:@YES,
SDLNameAirbagStatus:@NO,
SDLNameEmergencyEvent:@YES,
SDLNameClusterModeStatus:@NO,
SDLNameMyKey:@YES},
SDLNameOperationName:SDLNameSubscribeVehicleData}} mutableCopy];
SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithDictionary:dict];
expect(testRequest.gps).to(equal(@YES));
expect(testRequest.speed).to(equal(@NO));
expect(testRequest.rpm).to(equal(@YES));
expect(testRequest.fuelLevel).to(equal(@NO));
expect(testRequest.fuelLevel_State).to(equal(@YES));
expect(testRequest.instantFuelConsumption).to(equal(@NO));
expect(testRequest.externalTemperature).to(equal(@YES));
expect(testRequest.prndl).to(equal(@YES));
expect(testRequest.tirePressure).to(equal(@NO));
expect(testRequest.odometer).to(equal(@YES));
expect(testRequest.beltStatus).to(equal(@NO));
expect(testRequest.bodyInformation).to(equal(@YES));
expect(testRequest.deviceStatus).to(equal(@NO));
expect(testRequest.driverBraking).to(equal(@YES));
expect(testRequest.wiperStatus).to(equal(@NO));
expect(testRequest.headLampStatus).to(equal(@YES));
expect(testRequest.engineTorque).to(equal(@NO));
expect(testRequest.accPedalPosition).to(equal(@YES));
expect(testRequest.steeringWheelAngle).to(equal(@NO));
expect(testRequest.eCallInfo).to(equal(@YES));
expect(testRequest.airbagStatus).to(equal(@NO));
expect(testRequest.emergencyEvent).to(equal(@YES));
expect(testRequest.clusterModeStatus).to(equal(@NO));
expect(testRequest.myKey).to(equal(@YES));
});
it(@"Should return nil if not set", ^ {
SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] init];
expect(testRequest.gps).to(beNil());
expect(testRequest.speed).to(beNil());
expect(testRequest.rpm).to(beNil());
expect(testRequest.fuelLevel).to(beNil());
expect(testRequest.fuelLevel_State).to(beNil());
expect(testRequest.instantFuelConsumption).to(beNil());
expect(testRequest.externalTemperature).to(beNil());
expect(testRequest.prndl).to(beNil());
expect(testRequest.tirePressure).to(beNil());
expect(testRequest.odometer).to(beNil());
expect(testRequest.beltStatus).to(beNil());
expect(testRequest.bodyInformation).to(beNil());
expect(testRequest.deviceStatus).to(beNil());
expect(testRequest.driverBraking).to(beNil());
expect(testRequest.wiperStatus).to(beNil());
expect(testRequest.headLampStatus).to(beNil());
expect(testRequest.engineTorque).to(beNil());
expect(testRequest.accPedalPosition).to(beNil());
expect(testRequest.steeringWheelAngle).to(beNil());
expect(testRequest.eCallInfo).to(beNil());
expect(testRequest.airbagStatus).to(beNil());
expect(testRequest.emergencyEvent).to(beNil());
expect(testRequest.clusterModeStatus).to(beNil());
expect(testRequest.myKey).to(beNil());
});
});
QuickSpecEnd
|