summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLStartTimeSpec.m
diff options
context:
space:
mode:
Diffstat (limited to 'SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLStartTimeSpec.m')
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLStartTimeSpec.m64
1 files changed, 44 insertions, 20 deletions
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLStartTimeSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLStartTimeSpec.m
index 4de9c43f4..209b8d75d 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLStartTimeSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLStartTimeSpec.m
@@ -13,7 +13,50 @@
QuickSpecBegin(SDLStartTimeSpec)
-describe(@"Getter/Setter Tests", ^ {
+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 = @{SDLNameHours:@(testHours),
+ SDLNameMinutes:@(testMinutes),
+ SDLNameSeconds:@(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];
@@ -25,25 +68,6 @@ describe(@"Getter/Setter Tests", ^ {
expect(testStruct.minutes).to(equal(@39));
expect(testStruct.seconds).to(equal(@11));
});
-
- it(@"Should get correctly when initialized", ^ {
- NSMutableDictionary<NSString *, id> *dict = [@{SDLNameHours:@22,
- SDLNameMinutes:@39,
- SDLNameSeconds:@11} mutableCopy];
- SDLStartTime* testStruct = [[SDLStartTime alloc] initWithDictionary:dict];
-
- expect(testStruct.hours).to(equal(@22));
- expect(testStruct.minutes).to(equal(@39));
- expect(testStruct.seconds).to(equal(@11));
- });
-
- it(@"Should return nil if not set", ^ {
- SDLStartTime* testStruct = [[SDLStartTime alloc] init];
-
- expect(testStruct.hours).to(beNil());
- expect(testStruct.minutes).to(beNil());
- expect(testStruct.seconds).to(beNil());
- });
});
QuickSpecEnd