summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLHeadLampStatusSpec.m
blob: b418b962b6183d86d2cec4ca274b26270d8c6325 (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
//
//  SDLHeadLampStatusSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

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

#import "SDLAmbientLightStatus.h"
#import "SDLHeadLampStatus.h"
#import "SDLNames.h"


QuickSpecBegin(SDLHeadLampStatusSpec)

describe(@"Getter/Setter Tests", ^ {
    it(@"Should set and get correctly", ^ {
        SDLHeadLampStatus* testStruct = [[SDLHeadLampStatus alloc] init];
        
        testStruct.lowBeamsOn = @YES;
        testStruct.highBeamsOn = @NO;
        testStruct.ambientLightSensorStatus = [SDLAmbientLightStatus TWILIGHT_3];
        
        expect(testStruct.lowBeamsOn).to(equal(@YES));
        expect(testStruct.highBeamsOn).to(equal(@NO));
        expect(testStruct.ambientLightSensorStatus).to(equal([SDLAmbientLightStatus TWILIGHT_3]));
    });
    
    it(@"Should get correctly when initialized", ^ {
        NSMutableDictionary* dict = [@{NAMES_lowBeamsOn:@YES,
                                       NAMES_highBeamsOn:@NO,
                                       NAMES_ambientLightSensorStatus:[SDLAmbientLightStatus TWILIGHT_3]} mutableCopy];
        SDLHeadLampStatus* testStruct = [[SDLHeadLampStatus alloc] initWithDictionary:dict];
        
        expect(testStruct.lowBeamsOn).to(equal(@YES));
        expect(testStruct.highBeamsOn).to(equal(@NO));
        expect(testStruct.ambientLightSensorStatus).to(equal([SDLAmbientLightStatus TWILIGHT_3]));
    });
    
    it(@"Should return nil if not set", ^ {
        SDLHeadLampStatus* testStruct = [[SDLHeadLampStatus alloc] init];
        
        expect(testStruct.lowBeamsOn).to(beNil());
        expect(testStruct.highBeamsOn).to(beNil());
        expect(testStruct.ambientLightSensorStatus).to(beNil());
    });
});

QuickSpecEnd