blob: f4ba0eacd1d62e00133c2e412f25a23bcb13650f (
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
63
64
65
66
67
68
69
70
71
72
73
|
//
// SDLStartTimeSpec.m
// SmartDeviceLink
#import <Foundation/Foundation.h>
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import "SDLStartTime.h"
#import "SDLRPCParameterNames.h"
QuickSpecBegin(SDLStartTimeSpec)
describe(@"StartTime Spec", ^ {
describe(@"when initialized", ^{
__block UInt8 testHours = 22;
__block UInt8 testMinutes = 39;
__block UInt8 testSeconds = 11;
__block NSTimeInterval testTimeInterval = 81551;
it(@"should properly initialize with init", ^{
SDLStartTime *testStruct = [[SDLStartTime alloc] init];
expect(testStruct.hours).to(beNil());
expect(testStruct.minutes).to(beNil());
expect(testStruct.seconds).to(beNil());
});
it(@"should properly initialize with initWithDictionary:", ^{
NSDictionary<NSString *, id> *dict = @{SDLRPCParameterNameHours:@(testHours),
SDLRPCParameterNameMinutes:@(testMinutes),
SDLRPCParameterNameSeconds:@(testSeconds)};
SDLStartTime *testStruct = [[SDLStartTime alloc] initWithDictionary:dict];
expect(testStruct.hours).to(equal(@(testHours)));
expect(testStruct.minutes).to(equal(@(testMinutes)));
expect(testStruct.seconds).to(equal(@(testSeconds)));
});
it(@"should properly initialize with initWithTimeInterval:", ^{
SDLStartTime *testStruct = [[SDLStartTime alloc] initWithTimeInterval:testTimeInterval];
expect(testStruct.hours).to(equal(@(testHours)));
expect(testStruct.minutes).to(equal(@(testMinutes)));
expect(testStruct.seconds).to(equal(@(testSeconds)));
});
it(@"should properly initialize with initWithHours:minutes:seconds:", ^{
SDLStartTime *testStruct = [[SDLStartTime alloc] initWithHours:testHours minutes:testMinutes seconds:testSeconds];
expect(testStruct.hours).to(equal(@(testHours)));
expect(testStruct.minutes).to(equal(@(testMinutes)));
expect(testStruct.seconds).to(equal(@(testSeconds)));
});
});
it(@"Should set and get correctly", ^ {
SDLStartTime* testStruct = [[SDLStartTime alloc] init];
testStruct.hours = @22;
testStruct.minutes = @39;
testStruct.seconds = @11;
expect(testStruct.hours).to(equal(@22));
expect(testStruct.minutes).to(equal(@39));
expect(testStruct.seconds).to(equal(@11));
});
});
QuickSpecEnd
|