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