summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAirbagStatusSpec.m
blob: 01a535ce40fe9c9b19f4b622da73d3697b2ee618 (plain)
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
//
//  SDLAirbagStatusSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

#import <Quick/Quick.h>
#import <Nimble/Nimble.h>

#import "SDLAirbagStatus.h"
#import "SDLNames.h"
#import "SDLVehicleDataEventStatus.h"


QuickSpecBegin(SDLAirbagStatusSpec)

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLAirbagStatus* testStruct = [[SDLAirbagStatus alloc] init];
        
        testStruct.driverAirbagDeployed = SDLVehicleDataEventStatusYes;
        testStruct.driverSideAirbagDeployed = SDLVehicleDataEventStatusNoEvent;
        testStruct.driverCurtainAirbagDeployed = SDLVehicleDataEventStatusNo;
        testStruct.passengerAirbagDeployed = SDLVehicleDataEventStatusNotSupported;
        testStruct.passengerCurtainAirbagDeployed = SDLVehicleDataEventStatusFault;
        testStruct.driverKneeAirbagDeployed = SDLVehicleDataEventStatusNo;
        testStruct.passengerSideAirbagDeployed = SDLVehicleDataEventStatusYes;
        testStruct.passengerKneeAirbagDeployed = SDLVehicleDataEventStatusNoEvent;
        
        expect(testStruct.driverAirbagDeployed).to(equal(SDLVehicleDataEventStatusYes));
        expect(testStruct.driverSideAirbagDeployed).to(equal(SDLVehicleDataEventStatusNoEvent));
        expect(testStruct.driverCurtainAirbagDeployed).to(equal(SDLVehicleDataEventStatusNo));
        expect(testStruct.passengerAirbagDeployed).to(equal(SDLVehicleDataEventStatusNotSupported));
        expect(testStruct.passengerCurtainAirbagDeployed).to(equal(SDLVehicleDataEventStatusFault));
        expect(testStruct.driverKneeAirbagDeployed).to(equal(SDLVehicleDataEventStatusNo));
        expect(testStruct.passengerSideAirbagDeployed).to(equal(SDLVehicleDataEventStatusYes));
        expect(testStruct.passengerKneeAirbagDeployed).to(equal(SDLVehicleDataEventStatusNoEvent));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary* dict = [@{SDLNameDriverAirbagDeployed:SDLVehicleDataEventStatusYes,
                                       SDLNameDriverSideAirbagDeployed:SDLVehicleDataEventStatusNoEvent,
                                       SDLNameDriverCurtainAirbagDeployed:SDLVehicleDataEventStatusNo,
                                       SDLNamePassengerAirbagDeployed:SDLVehicleDataEventStatusNotSupported,
                                       SDLNamePassengerCurtainAirbagDeployed:SDLVehicleDataEventStatusFault,
                                       SDLNameDriverKneeAirbagDeployed:SDLVehicleDataEventStatusNo,
                                       SDLNamePassengerSideAirbagDeployed:SDLVehicleDataEventStatusYes,
                                       SDLNamePassengerKneeAirbagDeployed:SDLVehicleDataEventStatusNoEvent} mutableCopy];
        SDLAirbagStatus* testStruct = [[SDLAirbagStatus alloc] initWithDictionary:dict];
        
        expect(testStruct.driverAirbagDeployed).to(equal(SDLVehicleDataEventStatusYes));
        expect(testStruct.driverSideAirbagDeployed).to(equal(SDLVehicleDataEventStatusNoEvent));
        expect(testStruct.driverCurtainAirbagDeployed).to(equal(SDLVehicleDataEventStatusNo));
        expect(testStruct.passengerAirbagDeployed).to(equal(SDLVehicleDataEventStatusNotSupported));
        expect(testStruct.passengerCurtainAirbagDeployed).to(equal(SDLVehicleDataEventStatusFault));
        expect(testStruct.driverKneeAirbagDeployed).to(equal(SDLVehicleDataEventStatusNo));
        expect(testStruct.passengerSideAirbagDeployed).to(equal(SDLVehicleDataEventStatusYes));
        expect(testStruct.passengerKneeAirbagDeployed).to(equal(SDLVehicleDataEventStatusNoEvent));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLAirbagStatus* testStruct = [[SDLAirbagStatus alloc] init];
        
        expect(testStruct.driverAirbagDeployed).to(beNil());
        expect(testStruct.driverSideAirbagDeployed).to(beNil());
        expect(testStruct.driverCurtainAirbagDeployed).to(beNil());
        expect(testStruct.passengerAirbagDeployed).to(beNil());
        expect(testStruct.passengerCurtainAirbagDeployed).to(beNil());
        expect(testStruct.driverKneeAirbagDeployed).to(beNil());
        expect(testStruct.passengerSideAirbagDeployed).to(beNil());
        expect(testStruct.passengerKneeAirbagDeployed).to(beNil());
    });
});

QuickSpecEnd