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


#import <Foundation/Foundation.h>

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

#import "SDLHMIZoneCapabilities.h"

QuickSpecBegin(SDLHmiZoneCapabilitiesSpec)

describe(@"Individual Enum Value Tests", ^ {
    it(@"Should match internal values", ^ {
        expect([SDLHMIZoneCapabilities FRONT].value).to(equal(@"FRONT"));
        expect([SDLHMIZoneCapabilities BACK].value).to(equal(@"BACK"));
    });
});
describe(@"ValueOf Tests", ^ {
    it(@"Should return correct values when valid", ^ {
        expect([SDLHMIZoneCapabilities valueOf:@"FRONT"]).to(equal([SDLHMIZoneCapabilities FRONT]));
        expect([SDLHMIZoneCapabilities valueOf:@"BACK"]).to(equal([SDLHMIZoneCapabilities BACK]));
    });
    
    it(@"Should return nil when invalid", ^ {
        expect([SDLHMIZoneCapabilities valueOf:nil]).to(beNil());
        expect([SDLHMIZoneCapabilities valueOf:@"JKUYTFHYTHJGFRFGYTR"]).to(beNil());
    });
});
describe(@"Value List Tests", ^ {
    NSArray* storedValues = [SDLHMIZoneCapabilities values];
    __block NSArray* definedValues;
    beforeSuite(^ {
        definedValues = [@[[SDLHMIZoneCapabilities FRONT],
                        [SDLHMIZoneCapabilities BACK]] 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