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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
//
// SDLOnVehicleDataSpec.m
// SmartDeviceLink
#import <Foundation/Foundation.h>
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import "SmartDeviceLink.h"
#import "SDLNames.h"
QuickSpecBegin(SDLOnVehicleDataSpec)
SDLGPSData* gps = [[SDLGPSData alloc] init];
SDLTireStatus* tires = [[SDLTireStatus alloc] init];
SDLBeltStatus* belt = [[SDLBeltStatus alloc] init];
SDLBodyInformation* body = [[SDLBodyInformation alloc] init];
SDLDeviceStatus* device = [[SDLDeviceStatus alloc] init];
SDLHeadLampStatus* headLamp = [[SDLHeadLampStatus alloc] init];
SDLECallInfo* eCall = [[SDLECallInfo alloc] init];
SDLAirbagStatus* airbag = [[SDLAirbagStatus alloc] init];
SDLEmergencyEvent* event = [[SDLEmergencyEvent alloc] init];
SDLClusterModeStatus* clusterMode = [[SDLClusterModeStatus alloc] init];
SDLMyKey* myKey = [[SDLMyKey alloc] init];
describe(@"Getter/Setter Tests", ^ {
it(@"Should set and get correctly", ^ {
SDLOnVehicleData* testNotification = [[SDLOnVehicleData alloc] init];
testNotification.gps = gps;
testNotification.speed = @70.1;
testNotification.rpm = @4242;
testNotification.fuelLevel = @10.3;
testNotification.fuelLevel_State = SDLComponentVolumeStatusAlert;
testNotification.instantFuelConsumption = @4000.63;
testNotification.externalTemperature = @-10;
testNotification.vin = @"222222222722";
testNotification.prndl = SDLPRNDLDrive;
testNotification.tirePressure = tires;
testNotification.odometer = @100050;
testNotification.beltStatus = belt;
testNotification.bodyInformation = body;
testNotification.deviceStatus = device;
testNotification.driverBraking = SDLVehicleDataEventStatusYes;
testNotification.wiperStatus = SDLWiperStatusStalled;
testNotification.headLampStatus = headLamp;
testNotification.engineTorque = @-200.124;
testNotification.accPedalPosition = @99.99999999;
testNotification.steeringWheelAngle = @0.000000001;
testNotification.eCallInfo = eCall;
testNotification.airbagStatus = airbag;
testNotification.emergencyEvent = event;
testNotification.clusterModeStatus = clusterMode;
testNotification.myKey = myKey;
expect(testNotification.gps).to(equal(gps));
expect(testNotification.speed).to(equal(@70.1));
expect(testNotification.rpm).to(equal(@4242));
expect(testNotification.fuelLevel).to(equal(@10.3));
expect(testNotification.fuelLevel_State).to(equal(SDLComponentVolumeStatusAlert));
expect(testNotification.instantFuelConsumption).to(equal(@4000.63));
expect(testNotification.externalTemperature).to(equal(@-10));
expect(testNotification.vin).to(equal(@"222222222722"));
expect(testNotification.prndl).to(equal(SDLPRNDLDrive));
expect(testNotification.tirePressure).to(equal(tires));
expect(testNotification.odometer).to(equal(@100050));
expect(testNotification.beltStatus).to(equal(belt));
expect(testNotification.bodyInformation).to(equal(body));
expect(testNotification.deviceStatus).to(equal(device));
expect(testNotification.driverBraking).to(equal(SDLVehicleDataEventStatusYes));
expect(testNotification.wiperStatus).to(equal(SDLWiperStatusStalled));
expect(testNotification.headLampStatus).to(equal(headLamp));
expect(testNotification.engineTorque).to(equal(@-200.124));
expect(testNotification.accPedalPosition).to(equal(@99.99999999));
expect(testNotification.steeringWheelAngle).to(equal(@0.000000001));
expect(testNotification.eCallInfo).to(equal(eCall));
expect(testNotification.airbagStatus).to(equal(airbag));
expect(testNotification.emergencyEvent).to(equal(event));
expect(testNotification.clusterModeStatus).to(equal(clusterMode));
expect(testNotification.myKey).to(equal(myKey));
});
it(@"Should get correctly when initialized", ^ {
NSMutableDictionary* dict = [@{SDLNameNotification:
@{SDLNameParameters:
@{SDLNameGPS:gps,
SDLNameSpeed:@70.1,
SDLNameRPM:@4242,
SDLNameFuelLevel:@10.3,
SDLNameFuelLevelState:SDLComponentVolumeStatusAlert,
SDLNameInstantFuelConsumption:@4000.63,
SDLNameExternalTemperature:@-10,
SDLNameVIN:@"222222222722",
SDLNamePRNDL:SDLPRNDLDrive,
SDLNameTirePressure:tires,
SDLNameOdometer:@100050,
SDLNameBeltStatus:belt,
SDLNameBodyInformation:body,
SDLNameDeviceStatus:device,
SDLNameDriverBraking:SDLVehicleDataEventStatusYes,
SDLNameWiperStatus:SDLWiperStatusStalled,
SDLNameHeadLampStatus:headLamp,
SDLNameEngineTorque:@-200.124,
SDLNameAccelerationPedalPosition:@99.99999999,
SDLNameSteeringWheelAngle:@0.000000001,
SDLNameECallInfo:eCall,
SDLNameAirbagStatus:airbag,
SDLNameEmergencyEvent:event,
SDLNameClusterModeStatus:clusterMode,
SDLNameMyKey:myKey},
SDLNameOperationName:SDLNameOnVehicleData}} mutableCopy];
SDLOnVehicleData* testNotification = [[SDLOnVehicleData alloc] initWithDictionary:dict];
expect(testNotification.gps).to(equal(gps));
expect(testNotification.speed).to(equal(@70.1));
expect(testNotification.rpm).to(equal(@4242));
expect(testNotification.fuelLevel).to(equal(@10.3));
expect(testNotification.fuelLevel_State).to(equal(SDLComponentVolumeStatusAlert));
expect(testNotification.instantFuelConsumption).to(equal(@4000.63));
expect(testNotification.externalTemperature).to(equal(@-10));
expect(testNotification.vin).to(equal(@"222222222722"));
expect(testNotification.prndl).to(equal(SDLPRNDLDrive));
expect(testNotification.tirePressure).to(equal(tires));
expect(testNotification.odometer).to(equal(@100050));
expect(testNotification.beltStatus).to(equal(belt));
expect(testNotification.bodyInformation).to(equal(body));
expect(testNotification.deviceStatus).to(equal(device));
expect(testNotification.driverBraking).to(equal(SDLVehicleDataEventStatusYes));
expect(testNotification.wiperStatus).to(equal(SDLWiperStatusStalled));
expect(testNotification.headLampStatus).to(equal(headLamp));
expect(testNotification.engineTorque).to(equal(@-200.124));
expect(testNotification.accPedalPosition).to(equal(@99.99999999));
expect(testNotification.steeringWheelAngle).to(equal(@0.000000001));
expect(testNotification.eCallInfo).to(equal(eCall));
expect(testNotification.airbagStatus).to(equal(airbag));
expect(testNotification.emergencyEvent).to(equal(event));
expect(testNotification.clusterModeStatus).to(equal(clusterMode));
expect(testNotification.myKey).to(equal(myKey));
});
it(@"Should return nil if not set", ^ {
SDLOnVehicleData* testNotification = [[SDLOnVehicleData alloc] init];
expect(testNotification.gps).to(beNil());
expect(testNotification.speed).to(beNil());
expect(testNotification.rpm).to(beNil());
expect(testNotification.fuelLevel).to(beNil());
expect(testNotification.fuelLevel_State).to(beNil());
expect(testNotification.instantFuelConsumption).to(beNil());
expect(testNotification.externalTemperature).to(beNil());
expect(testNotification.vin).to(beNil());
expect(testNotification.prndl).to(beNil());
expect(testNotification.tirePressure).to(beNil());
expect(testNotification.odometer).to(beNil());
expect(testNotification.beltStatus).to(beNil());
expect(testNotification.bodyInformation).to(beNil());
expect(testNotification.deviceStatus).to(beNil());
expect(testNotification.driverBraking).to(beNil());
expect(testNotification.wiperStatus).to(beNil());
expect(testNotification.headLampStatus).to(beNil());
expect(testNotification.engineTorque).to(beNil());
expect(testNotification.accPedalPosition).to(beNil());
expect(testNotification.steeringWheelAngle).to(beNil());
expect(testNotification.eCallInfo).to(beNil());
expect(testNotification.airbagStatus).to(beNil());
expect(testNotification.emergencyEvent).to(beNil());
expect(testNotification.clusterModeStatus).to(beNil());
expect(testNotification.myKey).to(beNil());
});
});
QuickSpecEnd
|