OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 [message setExtension:[UnittestRoot defaultImportEnumExtension] | 1082 [message setExtension:[UnittestRoot defaultImportEnumExtension] |
1083 value:@(ImportEnum_ImportFoo)]; | 1083 value:@(ImportEnum_ImportFoo)]; |
1084 | 1084 |
1085 [message setExtension:[UnittestRoot defaultStringPieceExtension] | 1085 [message setExtension:[UnittestRoot defaultStringPieceExtension] |
1086 value:@"424"]; | 1086 value:@"424"]; |
1087 [message setExtension:[UnittestRoot defaultCordExtension] value:@"425"]; | 1087 [message setExtension:[UnittestRoot defaultCordExtension] value:@"425"]; |
1088 } | 1088 } |
1089 | 1089 |
1090 - (void)setAllMapFields:(TestMap *)message numEntries:(uint32_t)count { | 1090 - (void)setAllMapFields:(TestMap *)message numEntries:(uint32_t)count { |
1091 for (uint32_t i = 0; i < count; i++) { | 1091 for (uint32_t i = 0; i < count; i++) { |
1092 [message.mapInt32Int32 setInt32:(i + 1) forKey:100 + i * 100]; | 1092 [message.mapInt32Int32 setValue:(i + 1) forKey:100 + i * 100]; |
1093 [message.mapInt64Int64 setInt64:(i + 1) forKey:101 + i * 100]; | 1093 [message.mapInt64Int64 setValue:(i + 1) forKey:101 + i * 100]; |
1094 [message.mapUint32Uint32 setUInt32:(i + 1) forKey:102 + i * 100]; | 1094 [message.mapUint32Uint32 setValue:(i + 1) forKey:102 + i * 100]; |
1095 [message.mapUint64Uint64 setUInt64:(i + 1) forKey:103 + i * 100]; | 1095 [message.mapUint64Uint64 setValue:(i + 1) forKey:103 + i * 100]; |
1096 [message.mapSint32Sint32 setInt32:(i + 1) forKey:104 + i * 100]; | 1096 [message.mapSint32Sint32 setValue:(i + 1) forKey:104 + i * 100]; |
1097 [message.mapSint64Sint64 setInt64:(i + 1) forKey:105 + i * 100]; | 1097 [message.mapSint64Sint64 setValue:(i + 1) forKey:105 + i * 100]; |
1098 [message.mapFixed32Fixed32 setUInt32:(i + 1) forKey:106 + i * 100]; | 1098 [message.mapFixed32Fixed32 setValue:(i + 1) forKey:106 + i * 100]; |
1099 [message.mapFixed64Fixed64 setUInt64:(i + 1) forKey:107 + i * 100]; | 1099 [message.mapFixed64Fixed64 setValue:(i + 1) forKey:107 + i * 100]; |
1100 [message.mapSfixed32Sfixed32 setInt32:(i + 1) forKey:108 + i * 100]; | 1100 [message.mapSfixed32Sfixed32 setValue:(i + 1) forKey:108 + i * 100]; |
1101 [message.mapSfixed64Sfixed64 setInt64:(i + 1) forKey:109 + i * 100]; | 1101 [message.mapSfixed64Sfixed64 setValue:(i + 1) forKey:109 + i * 100]; |
1102 [message.mapInt32Float setFloat:(i + 1) forKey:110 + i * 100]; | 1102 [message.mapInt32Float setValue:(i + 1) forKey:110 + i * 100]; |
1103 [message.mapInt32Double setDouble:(i + 1) forKey:111 + i * 100]; | 1103 [message.mapInt32Double setValue:(i + 1) forKey:111 + i * 100]; |
1104 [message.mapBoolBool setBool:((i % 2) == 1) forKey:((i % 2) == 0)]; | 1104 [message.mapBoolBool setValue:((i % 2) == 1) forKey:((i % 2) == 0)]; |
1105 | 1105 |
1106 NSString *keyStr = [[NSString alloc] initWithFormat:@"%d", 112 + i * 100]; | 1106 NSString *keyStr = [[NSString alloc] initWithFormat:@"%d", 112 + i * 100]; |
1107 NSString *dataStr = [[NSString alloc] initWithFormat:@"%d", i + 1]; | 1107 NSString *dataStr = [[NSString alloc] initWithFormat:@"%d", i + 1]; |
1108 [message.mapStringString setObject:dataStr forKey:keyStr]; | 1108 [message.mapStringString setObject:dataStr forKey:keyStr]; |
1109 [keyStr release]; | 1109 [keyStr release]; |
1110 [dataStr release]; | 1110 [dataStr release]; |
1111 | 1111 |
1112 NSData *data = [[NSData alloc] initWithUint32_gpbtu:i + 1]; | 1112 NSData *data = [[NSData alloc] initWithUint32_gpbtu:i + 1]; |
1113 [message.mapInt32Bytes setObject:data forKey:113 + i * 100]; | 1113 [message.mapInt32Bytes setObject:data forKey:113 + i * 100]; |
1114 [data release]; | 1114 [data release]; |
1115 | 1115 |
1116 [message.mapInt32Enum | 1116 [message.mapInt32Enum |
1117 setEnum:(i % 2) ? MapEnum_MapEnumBar : MapEnum_MapEnumBaz | 1117 setValue:(i % 2) ? MapEnum_MapEnumBar : MapEnum_MapEnumBaz |
1118 forKey:114 + i * 100]; | 1118 forKey:114 + i * 100]; |
1119 | 1119 |
1120 ForeignMessage *subMsg = [[ForeignMessage alloc] init]; | 1120 ForeignMessage *subMsg = [[ForeignMessage alloc] init]; |
1121 subMsg.c = i + 1; | 1121 subMsg.c = i + 1; |
1122 [message.mapInt32ForeignMessage setObject:subMsg forKey:115 + i * 100]; | 1122 [message.mapInt32ForeignMessage setObject:subMsg forKey:115 + i * 100]; |
1123 [subMsg release]; | 1123 [subMsg release]; |
1124 } | 1124 } |
1125 } | 1125 } |
1126 | 1126 |
1127 - (void)setAllTestPackedFields:(TestPackedTypes *)message { | 1127 - (void)setAllTestPackedFields:(TestPackedTypes *)message { |
1128 // Must match -setAllTestUnpackedFields: | 1128 // Must match -setAllTestUnpackedFields: |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2537 XCTAssertEqualObjects([message valueForKey:@"defaultForeignEnum"], | 2537 XCTAssertEqualObjects([message valueForKey:@"defaultForeignEnum"], |
2538 @(ForeignEnum_ForeignBar)); | 2538 @(ForeignEnum_ForeignBar)); |
2539 XCTAssertEqualObjects([message valueForKey:@"defaultImportEnum"], | 2539 XCTAssertEqualObjects([message valueForKey:@"defaultImportEnum"], |
2540 @(ImportEnum_ImportBar)); | 2540 @(ImportEnum_ImportBar)); |
2541 | 2541 |
2542 XCTAssertEqualObjects([message valueForKey:@"defaultStringPiece"], @"abc"); | 2542 XCTAssertEqualObjects([message valueForKey:@"defaultStringPiece"], @"abc"); |
2543 XCTAssertEqualObjects([message valueForKey:@"defaultCord"], @"123"); | 2543 XCTAssertEqualObjects([message valueForKey:@"defaultCord"], @"123"); |
2544 } | 2544 } |
2545 | 2545 |
2546 @end | 2546 @end |
OLD | NEW |