OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2015 Google Inc. All rights reserved. | 2 // Copyright 2015 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 | 668 |
669 #pragma mark - Subset from from map_tests.cc | 669 #pragma mark - Subset from from map_tests.cc |
670 | 670 |
671 // TEST(GeneratedMapFieldTest, CopyFromMessageMap) | 671 // TEST(GeneratedMapFieldTest, CopyFromMessageMap) |
672 - (void)testMap_CopyFromMessageMap { | 672 - (void)testMap_CopyFromMessageMap { |
673 TestMessageMap *msg1 = [[TestMessageMap alloc] init]; | 673 TestMessageMap *msg1 = [[TestMessageMap alloc] init]; |
674 TestMessageMap *msg2 = [[TestMessageMap alloc] init]; | 674 TestMessageMap *msg2 = [[TestMessageMap alloc] init]; |
675 | 675 |
676 TestAllTypes *subMsg = [TestAllTypes message]; | 676 TestAllTypes *subMsg = [TestAllTypes message]; |
677 subMsg.repeatedInt32Array = [GPBInt32Array arrayWithValue:100]; | 677 subMsg.repeatedInt32Array = [GPBInt32Array arrayWithValue:100]; |
678 msg1.mapInt32Message = [GPBInt32ObjectDictionary dictionary]; | |
679 [msg1.mapInt32Message setObject:subMsg forKey:0]; | 678 [msg1.mapInt32Message setObject:subMsg forKey:0]; |
680 subMsg = nil; | 679 subMsg = nil; |
681 | 680 |
682 subMsg = [TestAllTypes message]; | 681 subMsg = [TestAllTypes message]; |
683 subMsg.repeatedInt32Array = [GPBInt32Array arrayWithValue:101]; | 682 subMsg.repeatedInt32Array = [GPBInt32Array arrayWithValue:101]; |
684 msg2.mapInt32Message = [GPBInt32ObjectDictionary dictionary]; | 683 |
685 | |
686 [msg2.mapInt32Message setObject:subMsg forKey:0]; | 684 [msg2.mapInt32Message setObject:subMsg forKey:0]; |
687 subMsg = nil; | 685 subMsg = nil; |
688 | 686 |
689 [msg1 mergeFrom:msg2]; | 687 [msg1 mergeFrom:msg2]; |
690 | 688 |
691 // Checks repeated field is overwritten. | 689 // Checks repeated field is overwritten. |
692 XCTAssertEqual(msg1.mapInt32Message.count, 1U); | 690 XCTAssertEqual(msg1.mapInt32Message.count, 1U); |
693 subMsg = [msg1.mapInt32Message objectForKey:0]; | 691 subMsg = [msg1.mapInt32Message objectForKey:0]; |
694 XCTAssertNotNil(subMsg); | 692 XCTAssertNotNil(subMsg); |
695 XCTAssertEqual(subMsg.repeatedInt32Array.count, 1U); | 693 XCTAssertEqual(subMsg.repeatedInt32Array.count, 1U); |
696 XCTAssertEqual([subMsg.repeatedInt32Array valueAtIndex:0], 101); | 694 XCTAssertEqual([subMsg.repeatedInt32Array valueAtIndex:0], 101); |
697 | 695 |
698 [msg2 release]; | 696 [msg2 release]; |
699 [msg1 release]; | 697 [msg1 release]; |
700 } | 698 } |
701 | 699 |
702 @end | 700 @end |
OLD | NEW |