blob: 694247a1daaeb677660fac24986d37a992b4362c (
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
|
//
// SDLSystemContextSpec.m
// SmartDeviceLink
#import <Foundation/Foundation.h>
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import "SDLSystemContext.h"
QuickSpecBegin(SDLSystemContextSpec)
describe(@"Individual Enum Value Tests", ^ {
it(@"Should match internal values", ^ {
expect([SDLSystemContext MAIN].value).to(equal(@"MAIN"));
expect([SDLSystemContext VRSESSION].value).to(equal(@"VRSESSION"));
expect([SDLSystemContext MENU].value).to(equal(@"MENU"));
expect([SDLSystemContext HMI_OBSCURED].value).to(equal(@"HMI_OBSCURED"));
expect([SDLSystemContext ALERT].value).to(equal(@"ALERT"));
});
});
describe(@"ValueOf Tests", ^ {
it(@"Should return correct values when valid", ^ {
expect([SDLSystemContext valueOf:@"MAIN"]).to(equal([SDLSystemContext MAIN]));
expect([SDLSystemContext valueOf:@"VRSESSION"]).to(equal([SDLSystemContext VRSESSION]));
expect([SDLSystemContext valueOf:@"MENU"]).to(equal([SDLSystemContext MENU]));
expect([SDLSystemContext valueOf:@"HMI_OBSCURED"]).to(equal([SDLSystemContext HMI_OBSCURED]));
expect([SDLSystemContext valueOf:@"ALERT"]).to(equal([SDLSystemContext ALERT]));
});
it(@"Should return nil when invalid", ^ {
expect([SDLSystemContext valueOf:nil]).to(beNil());
expect([SDLSystemContext valueOf:@"JKUYTFHYTHJGFRFGYTR"]).to(beNil());
});
});
describe(@"Value List Tests", ^ {
NSArray* storedValues = [SDLSystemContext values];
__block NSArray* definedValues;
beforeSuite(^ {
definedValues = [@[[SDLSystemContext MAIN],
[SDLSystemContext VRSESSION],
[SDLSystemContext MENU],
[SDLSystemContext HMI_OBSCURED],
[SDLSystemContext ALERT]] 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
|