diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-05-08 13:45:37 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-05-08 13:45:37 -0400 |
commit | f7ef5bfbf7f4680f4f1e42e71cf1e02c12a8dfe7 (patch) | |
tree | bed979e084835e3c023c223b9dec13f76786745c | |
parent | 7e1306d3800fafcc290d32430aba0593403fddcf (diff) | |
download | sdl_ios-f7ef5bfbf7f4680f4f1e42e71cf1e02c12a8dfe7.tar.gz |
Add tests for #612hotfix/issue_612
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMenuParamsSpec.m | 64 |
1 files changed, 43 insertions, 21 deletions
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMenuParamsSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMenuParamsSpec.m index 3d6bc6462..ec9cc2457 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMenuParamsSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLMenuParamsSpec.m @@ -13,8 +13,49 @@ QuickSpecBegin(SDLMenuParamsSpec) +describe(@"Initialization tests", ^{ + __block UInt32 testParentId = 504320489; + __block UInt16 testPosition = testPosition; + __block NSString *testMenuName = @"Test Menu"; + + it(@"should properly initialize init", ^{ + SDLMenuParams* testStruct = [[SDLMenuParams alloc] init]; + + expect(testStruct.parentID).to(beNil()); + expect(testStruct.position).to(beNil()); + expect(testStruct.menuName).to(beNil()); + }); + + it(@"should properly initialize initWithDictionary", ^{ + NSMutableDictionary* dict = [@{NAMES_parentID:@(testParentId), + NAMES_position:@(testPosition), + NAMES_menuName:testMenuName} mutableCopy]; + SDLMenuParams* testStruct = [[SDLMenuParams alloc] initWithDictionary:dict]; + + expect(testStruct.parentID).to(equal(@(testParentId))); + expect(testStruct.position).to(equal(@(testPosition))); + expect(testStruct.menuName).to(equal(testMenuName)); + }); + + it(@"should properly initialize initWithMenuName", ^{ + SDLMenuParams* testStruct = [[SDLMenuParams alloc] initWithMenuName:testMenuName]; + + expect(testStruct.parentID).to(beNil()); + expect(testStruct.position).to(beNil()); + expect(testStruct.menuName).to(equal(testMenuName)); + }); + + it(@"should properly initialize initWithMenuName:parentId:position:", ^{ + SDLMenuParams* testStruct = [[SDLMenuParams alloc] initWithMenuName:testMenuName parentId:testParentId position:testPosition]; + + expect(testStruct.parentID).to(equal(@(testParentId))); + expect(testStruct.position).to(equal(@(testPosition))); + expect(testStruct.menuName).to(equal(testMenuName)); + }); +}); + describe(@"Getter/Setter Tests", ^ { - it(@"Should set and get correctly", ^ { + it(@"Should set and get correctly", ^{ SDLMenuParams* testStruct = [[SDLMenuParams alloc] init]; testStruct.parentID = @504320489; @@ -25,25 +66,6 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.position).to(equal(@256)); expect(testStruct.menuName).to(equal(@"Menu")); }); - - it(@"Should get correctly when initialized", ^ { - NSMutableDictionary* dict = [@{NAMES_parentID:@504320489, - NAMES_position:@256, - NAMES_menuName:@"Menu"} mutableCopy]; - SDLMenuParams* testStruct = [[SDLMenuParams alloc] initWithDictionary:dict]; - - expect(testStruct.parentID).to(equal(@504320489)); - expect(testStruct.position).to(equal(@256)); - expect(testStruct.menuName).to(equal(@"Menu")); - }); - - it(@"Should return nil if not set", ^ { - SDLMenuParams* testStruct = [[SDLMenuParams alloc] init]; - - expect(testStruct.parentID).to(beNil()); - expect(testStruct.position).to(beNil()); - expect(testStruct.menuName).to(beNil()); - }); }); -QuickSpecEnd
\ No newline at end of file +QuickSpecEnd |