summaryrefslogtreecommitdiff
path: root/SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLButtonPressModeSpec.m
blob: eb6b2fa35cac56e75e60e1951b1f3f9c7d881a43 (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
//
//  SDLButtonPressModeSpec.m
//  SmartDeviceLink


#import <Foundation/Foundation.h>

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

#import "SDLButtonPressMode.h"

QuickSpecBegin(SDLButtonPressModeSpec)

describe(@"Individual Enum Value Tests", ^ {
    it(@"Should match internal values", ^ {
        expect([SDLButtonPressMode LONG].value).to(equal(@"LONG"));
        expect([SDLButtonPressMode SHORT].value).to(equal(@"SHORT"));
    });
});
describe(@"ValueOf Tests", ^ {
    it(@"Should return correct values when valid", ^ {
        expect([SDLButtonPressMode valueOf:@"LONG"]).to(equal([SDLButtonPressMode LONG]));
        expect([SDLButtonPressMode valueOf:@"SHORT"]).to(equal([SDLButtonPressMode SHORT]));
    });
    
    it(@"Should return nil when invalid", ^ {
        expect([SDLButtonPressMode valueOf:nil]).to(beNil());
        expect([SDLButtonPressMode valueOf:@"JKUYTFHYTHJGFRFGYTR"]).to(beNil());
    });
});
describe(@"Value List Tests", ^ {
    NSArray* storedValues = [SDLButtonPressMode values];
    __block NSArray* definedValues;
    beforeSuite(^ {
        definedValues = [@[[SDLButtonPressMode LONG],
                        [SDLButtonPressMode SHORT]] copy];
    });
    
    it(@"Should contain all defined enum values", ^ {
        for (int i = 0; i < definedValues.count; i++) {
            expect(storedValues).to(contain(definedValues[i]));
        }
    });
    
    it(@"Should contain only defined enum values", ^ {
        for (int i = 0; i < storedValues.count; i++) {
            expect(definedValues).to(contain(storedValues[i]));
        }
    });
});

QuickSpecEnd