Lines Matching full:message
70 - (void)modifyRepeatedExtensions:(TestAllExtensions *)message {
71 [message setExtension:[UnittestRoot repeatedInt32Extension] index:1 value:@501];
72 [message setExtension:[UnittestRoot repeatedInt64Extension] index:1 value:@502];
73 [message setExtension:[UnittestRoot repeatedUint32Extension] index:1 value:@503];
74 [message setExtension:[UnittestRoot repeatedUint64Extension] index:1 value:@504];
75 [message setExtension:[UnittestRoot repeatedSint32Extension] index:1 value:@505];
76 [message setExtension:[UnittestRoot repeatedSint64Extension] index:1 value:@506];
77 [message setExtension:[UnittestRoot repeatedFixed32Extension] index:1 value:@507];
78 [message setExtension:[UnittestRoot repeatedFixed64Extension] index:1 value:@508];
79 [message setExtension:[UnittestRoot repeatedSfixed32Extension] index:1 value:@509];
80 [message setExtension:[UnittestRoot repeatedSfixed64Extension] index:1 value:@510];
81 [message setExtension:[UnittestRoot repeatedFloatExtension] index:1 value:@511.0f];
82 [message setExtension:[UnittestRoot repeatedDoubleExtension] index:1 value:@512.0];
83 [message setExtension:[UnittestRoot repeatedBoolExtension] index:1 value:@YES];
84 [message setExtension:[UnittestRoot repeatedStringExtension] index:1 value:@"515"];
85 [message setExtension:[UnittestRoot repeatedBytesExtension]
89 RepeatedGroup_extension *repeatedGroup = [RepeatedGroup_extension message];
91 [message setExtension:[UnittestRoot repeatedGroupExtension] index:1 value:repeatedGroup];
92 TestAllTypes_NestedMessage *nestedMessage = [TestAllTypes_NestedMessage message];
94 [message setExtension:[UnittestRoot repeatedNestedMessageExtension] index:1 value:nestedMessage];
95 ForeignMessage *foreignMessage = [ForeignMessage message];
97 [message setExtension:[UnittestRoot repeatedForeignMessageExtension]
100 ImportMessage *importMessage = [ImportMessage message];
102 [message setExtension:[UnittestRoot repeatedImportMessageExtension] index:1 value:importMessage];
104 [message setExtension:[UnittestRoot repeatedNestedEnumExtension]
107 [message setExtension:[UnittestRoot repeatedForeignEnumExtension]
110 [message setExtension:[UnittestRoot repeatedImportEnumExtension]
114 [message setExtension:[UnittestRoot repeatedStringPieceExtension] index:1 value:@"524"];
115 [message setExtension:[UnittestRoot repeatedCordExtension] index:1 value:@"525"];
118 - (void)assertAllExtensionsSet:(TestAllExtensions *)message repeatedCount:(uint32_t)count {
119 XCTAssertTrue([message hasExtension:[UnittestRoot optionalInt32Extension]]);
120 XCTAssertTrue([message hasExtension:[UnittestRoot optionalInt64Extension]]);
121 XCTAssertTrue([message hasExtension:[UnittestRoot optionalUint32Extension]]);
122 XCTAssertTrue([message hasExtension:[UnittestRoot optionalUint64Extension]]);
123 XCTAssertTrue([message hasExtension:[UnittestRoot optionalSint32Extension]]);
124 XCTAssertTrue([message hasExtension:[UnittestRoot optionalSint64Extension]]);
125 XCTAssertTrue([message hasExtension:[UnittestRoot optionalFixed32Extension]]);
126 XCTAssertTrue([message hasExtension:[UnittestRoot optionalFixed64Extension]]);
127 XCTAssertTrue([message hasExtension:[UnittestRoot optionalSfixed32Extension]]);
128 XCTAssertTrue([message hasExtension:[UnittestRoot optionalSfixed64Extension]]);
129 XCTAssertTrue([message hasExtension:[UnittestRoot optionalFloatExtension]]);
130 XCTAssertTrue([message hasExtension:[UnittestRoot optionalDoubleExtension]]);
131 XCTAssertTrue([message hasExtension:[UnittestRoot optionalBoolExtension]]);
132 XCTAssertTrue([message hasExtension:[UnittestRoot optionalStringExtension]]);
133 XCTAssertTrue([message hasExtension:[UnittestRoot optionalBytesExtension]]);
135 XCTAssertTrue([message hasExtension:[UnittestRoot optionalGroupExtension]]);
136 XCTAssertTrue([message hasExtension:[UnittestRoot optionalNestedMessageExtension]]);
137 XCTAssertTrue([message hasExtension:[UnittestRoot optionalForeignMessageExtension]]);
138 XCTAssertTrue([message hasExtension:[UnittestRoot optionalImportMessageExtension]]);
140 XCTAssertTrue([[message getExtension:[UnittestRoot optionalGroupExtension]] hasA]);
141 XCTAssertTrue([[message getExtension:[UnittestRoot optionalNestedMessageExtension]] hasBb]);
142 XCTAssertTrue([[message getExtension:[UnittestRoot optionalForeignMessageExtension]] hasC]);
143 XCTAssertTrue([[message getExtension:[UnittestRoot optionalImportMessageExtension]] hasD]);
145 XCTAssertTrue([message hasExtension:[UnittestRoot optionalNestedEnumExtension]]);
146 XCTAssertTrue([message hasExtension:[UnittestRoot optionalForeignEnumExtension]]);
147 XCTAssertTrue([message hasExtension:[UnittestRoot optionalImportEnumExtension]]);
149 XCTAssertTrue([message hasExtension:[UnittestRoot optionalStringPieceExtension]]);
150 XCTAssertTrue([message hasExtension:[UnittestRoot optionalCordExtension]]);
152 XCTAssertTrue([message hasExtension:[UnittestRoot defaultInt32Extension]]);
153 XCTAssertTrue([message hasExtension:[UnittestRoot defaultInt64Extension]]);
154 XCTAssertTrue([message hasExtension:[UnittestRoot defaultUint32Extension]]);
155 XCTAssertTrue([message hasExtension:[UnittestRoot defaultUint64Extension]]);
156 XCTAssertTrue([message hasExtension:[UnittestRoot defaultSint32Extension]]);
157 XCTAssertTrue([message hasExtension:[UnittestRoot defaultSint64Extension]]);
158 XCTAssertTrue([message hasExtension:[UnittestRoot defaultFixed32Extension]]);
159 XCTAssertTrue([message hasExtension:[UnittestRoot defaultFixed64Extension]]);
160 XCTAssertTrue([message hasExtension:[UnittestRoot defaultSfixed32Extension]]);
161 XCTAssertTrue([message hasExtension:[UnittestRoot defaultSfixed64Extension]]);
162 XCTAssertTrue([message hasExtension:[UnittestRoot defaultFloatExtension]]);
163 XCTAssertTrue([message hasExtension:[UnittestRoot defaultDoubleExtension]]);
164 XCTAssertTrue([message hasExtension:[UnittestRoot defaultBoolExtension]]);
165 XCTAssertTrue([message hasExtension:[UnittestRoot defaultStringExtension]]);
166 XCTAssertTrue([message hasExtension:[UnittestRoot defaultBytesExtension]]);
168 XCTAssertTrue([message hasExtension:[UnittestRoot defaultNestedEnumExtension]]);
169 XCTAssertTrue([message hasExtension:[UnittestRoot defaultForeignEnumExtension]]);
170 XCTAssertTrue([message hasExtension:[UnittestRoot defaultImportEnumExtension]]);
172 XCTAssertTrue([message hasExtension:[UnittestRoot defaultStringPieceExtension]]);
173 XCTAssertTrue([message hasExtension:[UnittestRoot defaultCordExtension]]);
175 XCTAssertEqual(101, [[message getExtension:[UnittestRoot optionalInt32Extension]] intValue]);
177 [[message getExtension:[UnittestRoot optionalInt64Extension]] longLongValue]);
179 [[message getExtension:[UnittestRoot optionalUint32Extension]] unsignedIntValue]);
180 XCTAssertEqual(104ULL, [[message getExtension:[UnittestRoot optionalUint64Extension]]
182 XCTAssertEqual(105, [[message getExtension:[UnittestRoot optionalSint32Extension]] intValue]);
184 [[message getExtension:[UnittestRoot optionalSint64Extension]] longLongValue]);
186 [[message getExtension:[UnittestRoot optionalFixed32Extension]] unsignedIntValue]);
187 XCTAssertEqual(108ULL, [[message getExtension:[UnittestRoot optionalFixed64Extension]]
189 XCTAssertEqual(109, [[message getExtension:[UnittestRoot optionalSfixed32Extension]] intValue]);
191 [[message getExtension:[UnittestRoot optionalSfixed64Extension]] longLongValue]);
193 111.0f, [[message getExtension:[UnittestRoot optionalFloatExtension]] floatValue], 0.01);
195 112.0, [[message getExtension:[UnittestRoot optionalDoubleExtension]] doubleValue], 0.01);
196 XCTAssertTrue([[message getExtension:[UnittestRoot optionalBoolExtension]] boolValue]);
197 XCTAssertEqualObjects(@"115", [message getExtension:[UnittestRoot optionalStringExtension]]);
199 [message getExtension:[UnittestRoot optionalBytesExtension]]);
201 XCTAssertEqual(117, [(TestAllTypes_OptionalGroup *)[message
203 XCTAssertEqual(118, [(TestAllTypes_NestedMessage *)[message
205 XCTAssertEqual(119, [[message getExtension:[UnittestRoot optionalForeignMessageExtension]] c]);
206 XCTAssertEqual(120, [[message getExtension:[UnittestRoot optionalImportMessageExtension]] d]);
209 [[message getExtension:[UnittestRoot optionalNestedEnumExtension]] intValue]);
211 [[message getExtension:[UnittestRoot optionalForeignEnumExtension]] intValue]);
213 [[message getExtension:[UnittestRoot optionalImportEnumExtension]] intValue]);
215 XCTAssertEqualObjects(@"124", [message getExtension:[UnittestRoot optionalStringPieceExtension]]);
216 XCTAssertEqualObjects(@"125", [message getExtension:[UnittestRoot optionalCordExtension]]);
220 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedInt32Extension]] count]);
221 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedInt64Extension]] count]);
222 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedUint32Extension]] count]);
223 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedUint64Extension]] count]);
224 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedSint32Extension]] count]);
225 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedSint64Extension]] count]);
226 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedFixed32Extension]] count]);
227 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedFixed64Extension]] count]);
228 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedSfixed32Extension]] count]);
229 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedSfixed64Extension]] count]);
230 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedFloatExtension]] count]);
231 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedDoubleExtension]] count]);
232 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedBoolExtension]] count]);
233 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedStringExtension]] count]);
234 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedBytesExtension]] count]);
236 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedGroupExtension]] count]);
238 [[message getExtension:[UnittestRoot repeatedNestedMessageExtension]] count]);
240 [[message getExtension:[UnittestRoot repeatedForeignMessageExtension]] count]);
242 [[message getExtension:[UnittestRoot repeatedImportMessageExtension]] count]);
243 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedNestedEnumExtension]] count]);
244 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedForeignEnumExtension]] count]);
245 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedImportEnumExtension]] count]);
247 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedStringPieceExtension]] count]);
248 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedCordExtension]] count]);
251 id extension = [message getExtension:[UnittestRoot repeatedInt32Extension]];
253 extension = [message getExtension:[UnittestRoot repeatedInt64Extension]];
255 extension = [message getExtension:[UnittestRoot repeatedUint32Extension]];
257 extension = [message getExtension:[UnittestRoot repeatedUint64Extension]];
259 extension = [message getExtension:[UnittestRoot repeatedSint32Extension]];
261 extension = [message getExtension:[UnittestRoot repeatedSint64Extension]];
263 extension = [message getExtension:[UnittestRoot repeatedFixed32Extension]];
265 extension = [message getExtension:[UnittestRoot repeatedFixed64Extension]];
267 extension = [message getExtension:[UnittestRoot repeatedSfixed32Extension]];
269 extension = [message getExtension:[UnittestRoot repeatedSfixed64Extension]];
271 extension = [message getExtension:[UnittestRoot repeatedFloatExtension]];
273 extension = [message getExtension:[UnittestRoot repeatedDoubleExtension]];
275 extension = [message getExtension:[UnittestRoot repeatedBoolExtension]];
279 extension = [message getExtension:[UnittestRoot repeatedStringExtension]];
284 extension = [message getExtension:[UnittestRoot repeatedBytesExtension]];
288 extension = [message getExtension:[UnittestRoot repeatedGroupExtension]];
290 extension = [message getExtension:[UnittestRoot repeatedNestedMessageExtension]];
292 extension = [message getExtension:[UnittestRoot repeatedForeignMessageExtension]];
294 extension = [message getExtension:[UnittestRoot repeatedImportMessageExtension]];
297 extension = [message getExtension:[UnittestRoot repeatedNestedEnumExtension]];
300 extension = [message getExtension:[UnittestRoot repeatedForeignEnumExtension]];
303 extension = [message getExtension:[UnittestRoot repeatedImportEnumExtension]];
307 extension = [message getExtension:[UnittestRoot repeatedStringPieceExtension]];
312 extension = [message getExtension:[UnittestRoot repeatedCordExtension]];
319 XCTAssertTrue([message hasExtension:[UnittestRoot defaultInt32Extension]]);
320 XCTAssertTrue([message hasExtension:[UnittestRoot defaultInt64Extension]]);
321 XCTAssertTrue([message hasExtension:[UnittestRoot defaultUint32Extension]]);
322 XCTAssertTrue([message hasExtension:[UnittestRoot defaultUint64Extension]]);
323 XCTAssertTrue([message hasExtension:[UnittestRoot defaultSint32Extension]]);
324 XCTAssertTrue([message hasExtension:[UnittestRoot defaultSint64Extension]]);
325 XCTAssertTrue([message hasExtension:[UnittestRoot defaultFixed32Extension]]);
326 XCTAssertTrue([message hasExtension:[UnittestRoot defaultFixed64Extension]]);
327 XCTAssertTrue([message hasExtension:[UnittestRoot defaultSfixed32Extension]]);
328 XCTAssertTrue([message hasExtension:[UnittestRoot defaultSfixed64Extension]]);
329 XCTAssertTrue([message hasExtension:[UnittestRoot defaultFloatExtension]]);
330 XCTAssertTrue([message hasExtension:[UnittestRoot defaultDoubleExtension]]);
331 XCTAssertTrue([message hasExtension:[UnittestRoot defaultBoolExtension]]);
332 XCTAssertTrue([message hasExtension:[UnittestRoot defaultStringExtension]]);
333 XCTAssertTrue([message hasExtension:[UnittestRoot defaultBytesExtension]]);
335 XCTAssertTrue([message hasExtension:[UnittestRoot defaultNestedEnumExtension]]);
336 XCTAssertTrue([message hasExtension:[UnittestRoot defaultForeignEnumExtension]]);
337 XCTAssertTrue([message hasExtension:[UnittestRoot defaultImportEnumExtension]]);
339 XCTAssertTrue([message hasExtension:[UnittestRoot defaultStringPieceExtension]]);
340 XCTAssertTrue([message hasExtension:[UnittestRoot defaultCordExtension]]);
342 XCTAssertEqual(401, [[message getExtension:[UnittestRoot defaultInt32Extension]] intValue]);
344 [[message getExtension:[UnittestRoot defaultInt64Extension]] longLongValue]);
346 [[message getExtension:[UnittestRoot defaultUint32Extension]] unsignedIntValue]);
348 404ULL, [[message getExtension:[UnittestRoot defaultUint64Extension]] unsignedLongLongValue]);
349 XCTAssertEqual(405, [[message getExtension:[UnittestRoot defaultSint32Extension]] intValue]);
351 [[message getExtension:[UnittestRoot defaultSint64Extension]] longLongValue]);
353 [[message getExtension:[UnittestRoot defaultFixed32Extension]] unsignedIntValue]);
354 XCTAssertEqual(408ULL, [[message getExtension:[UnittestRoot defaultFixed64Extension]]
356 XCTAssertEqual(409, [[message getExtension:[UnittestRoot defaultSfixed32Extension]] intValue]);
358 [[message getExtension:[UnittestRoot defaultSfixed64Extension]] longLongValue]);
360 411.0f, [[message getExtension:[UnittestRoot defaultFloatExtension]] floatValue], 0.01);
362 412.0, [[message getExtension:[UnittestRoot defaultDoubleExtension]] doubleValue], 0.01);
363 XCTAssertFalse([[message getExtension:[UnittestRoot defaultBoolExtension]] boolValue]);
364 XCTAssertEqualObjects(@"415", [message getExtension:[UnittestRoot defaultStringExtension]]);
366 [message getExtension:[UnittestRoot defaultBytesExtension]]);
369 [[message getExtension:[UnittestRoot defaultNestedEnumExtension]] intValue]);
371 [[message getExtension:[UnittestRoot defaultForeignEnumExtension]] intValue]);
373 [[message getExtension:[UnittestRoot defaultImportEnumExtension]] intValue]);
375 XCTAssertEqualObjects(@"424", [message getExtension:[UnittestRoot defaultStringPieceExtension]]);
376 XCTAssertEqualObjects(@"425", [message getExtension:[UnittestRoot defaultCordExtension]]);
379 - (void)assertRepeatedExtensionsModified:(TestAllExtensions *)message
384 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedInt32Extension]] count]);
385 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedInt64Extension]] count]);
386 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedUint32Extension]] count]);
387 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedUint64Extension]] count]);
388 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedSint32Extension]] count]);
389 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedSint64Extension]] count]);
390 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedFixed32Extension]] count]);
391 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedFixed64Extension]] count]);
392 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedSfixed32Extension]] count]);
393 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedSfixed64Extension]] count]);
394 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedFloatExtension]] count]);
395 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedDoubleExtension]] count]);
396 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedBoolExtension]] count]);
397 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedStringExtension]] count]);
398 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedBytesExtension]] count]);
400 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedGroupExtension]] count]);
402 [[message getExtension:[UnittestRoot repeatedNestedMessageExtension]] count]);
404 [[message getExtension:[UnittestRoot repeatedForeignMessageExtension]] count]);
406 [[message getExtension:[UnittestRoot repeatedImportMessageExtension]] count]);
407 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedNestedEnumExtension]] count]);
408 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedForeignEnumExtension]] count]);
409 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedImportEnumExtension]] count]);
411 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedStringPieceExtension]] count]);
412 XCTAssertEqual(count, [[message getExtension:[UnittestRoot repeatedCordExtension]] count]);
414 XCTAssertEqual(201, [[message getExtension:[UnittestRoot repeatedInt32Extension]][0] intValue]);
416 [[message getExtension:[UnittestRoot repeatedInt64Extension]][0] longLongValue]);
418 203U, [[message getExtension:[UnittestRoot repeatedUint32Extension]][0] unsignedIntValue]);
419 XCTAssertEqual(204ULL, [[message getExtension:[UnittestRoot repeatedUint64Extension]][0]
421 XCTAssertEqual(205, [[message getExtension:[UnittestRoot repeatedSint32Extension]][0] intValue]);
423 [[message getExtension:[UnittestRoot repeatedSint64Extension]][0] longLongValue]);
425 207U, [[message getExtension:[UnittestRoot repeatedFixed32Extension]][0] unsignedIntValue]);
426 XCTAssertEqual(208ULL, [[message getExtension:[UnittestRoot repeatedFixed64Extension]][0]
429 [[message getExtension:[UnittestRoot repeatedSfixed32Extension]][0] intValue]);
431 210LL, [[message getExtension:[UnittestRoot repeatedSfixed64Extension]][0] longLongValue]);
433 211.0f, [[message getExtension:[UnittestRoot repeatedFloatExtension]][0] floatValue], 0.01);
435 212.0, [[message getExtension:[UnittestRoot repeatedDoubleExtension]][0] doubleValue], 0.01);
436 XCTAssertFalse([[message getExtension:[UnittestRoot repeatedBoolExtension]][0] boolValue]);
437 XCTAssertEqualObjects(@"215", [message getExtension:[UnittestRoot repeatedStringExtension]][0]);
439 [message getExtension:[UnittestRoot repeatedBytesExtension]][0]);
441 XCTAssertEqual(217, [(TestAllTypes_OptionalGroup *)[message
443 XCTAssertEqual(218, [(TestAllTypes_NestedMessage *)[message
445 XCTAssertEqual(219, [[message getExtension:[UnittestRoot repeatedForeignMessageExtension]][0] c]);
446 XCTAssertEqual(220, [[message getExtension:[UnittestRoot repeatedImportMessageExtension]][0] d]);
449 [[message getExtension:[UnittestRoot repeatedNestedEnumExtension]][0] intValue]);
451 [[message getExtension:[UnittestRoot repeatedForeignEnumExtension]][0] intValue]);
453 [[message getExtension:[UnittestRoot repeatedImportEnumExtension]][0] intValue]);
456 [message getExtension:[UnittestRoot repeatedStringPieceExtension]][0]);
457 XCTAssertEqualObjects(@"225", [message getExtension:[UnittestRoot repeatedCordExtension]][0]);
460 XCTAssertEqual(501, [[message getExtension:[UnittestRoot repeatedInt32Extension]][1] intValue]);
462 [[message getExtension:[UnittestRoot repeatedInt64Extension]][1] longLongValue]);
464 503U, [[message getExtension:[UnittestRoot repeatedUint32Extension]][1] unsignedIntValue]);
465 XCTAssertEqual(504ULL, [[message getExtension:[UnittestRoot repeatedUint64Extension]][1]
467 XCTAssertEqual(505, [[message getExtension:[UnittestRoot repeatedSint32Extension]][1] intValue]);
469 [[message getExtension:[UnittestRoot repeatedSint64Extension]][1] longLongValue]);
471 507U, [[message getExtension:[UnittestRoot repeatedFixed32Extension]][1] unsignedIntValue]);
472 XCTAssertEqual(508ULL, [[message getExtension:[UnittestRoot repeatedFixed64Extension]][1]
475 [[message getExtension:[UnittestRoot repeatedSfixed32Extension]][1] intValue]);
477 510LL, [[message getExtension:[UnittestRoot repeatedSfixed64Extension]][1] longLongValue]);
479 511.0f, [[message getExtension:[UnittestRoot repeatedFloatExtension]][1] floatValue], 0.01);
481 512.0, [[message getExtension:[UnittestRoot repeatedDoubleExtension]][1] doubleValue], 0.01);
482 XCTAssertTrue([[message getExtension:[UnittestRoot repeatedBoolExtension]][1] boolValue]);
483 XCTAssertEqualObjects(@"515", [message getExtension:[UnittestRoot repeatedStringExtension]][1]);
485 [message getExtension:[UnittestRoot repeatedBytesExtension]][1]);
487 XCTAssertEqual(517, [(TestAllTypes_OptionalGroup *)[message
489 XCTAssertEqual(518, [(TestAllTypes_NestedMessage *)[message
491 XCTAssertEqual(519, [[message getExtension:[UnittestRoot repeatedForeignMessageExtension]][1] c]);
492 XCTAssertEqual(520, [[message getExtension:[UnittestRoot repeatedImportMessageExtension]][1] d]);
495 [[message getExtension:[UnittestRoot repeatedNestedEnumExtension]][1] intValue]);
497 [[message getExtension:[UnittestRoot repeatedForeignEnumExtension]][1] intValue]);
499 [[message getExtension:[UnittestRoot repeatedImportEnumExtension]][1] intValue]);
502 [message getExtension:[UnittestRoot repeatedStringPieceExtension]][1]);
503 XCTAssertEqualObjects(@"525", [message getExtension:[UnittestRoot repeatedCordExtension]][1]);
508 - (void)assertAllFieldsSet:(TestAllTypes *)message repeatedCount:(uint32_t)count {
509 XCTAssertTrue(message.hasOptionalInt32);
510 XCTAssertTrue(message.hasOptionalInt64);
511 XCTAssertTrue(message.hasOptionalUint32);
512 XCTAssertTrue(message.hasOptionalUint64);
513 XCTAssertTrue(message.hasOptionalSint32);
514 XCTAssertTrue(message.hasOptionalSint64);
515 XCTAssertTrue(message.hasOptionalFixed32);
516 XCTAssertTrue(message.hasOptionalFixed64);
517 XCTAssertTrue(message.hasOptionalSfixed32);
518 XCTAssertTrue(message.hasOptionalSfixed64);
519 XCTAssertTrue(message.hasOptionalFloat);
520 XCTAssertTrue(message.hasOptionalDouble);
521 XCTAssertTrue(message.hasOptionalBool);
522 XCTAssertTrue(message.hasOptionalString);
523 XCTAssertTrue(message.hasOptionalBytes);
525 XCTAssertTrue(message.hasOptionalGroup);
526 XCTAssertTrue(message.hasOptionalNestedMessage);
527 XCTAssertTrue(message.hasOptionalForeignMessage);
528 XCTAssertTrue(message.hasOptionalImportMessage);
530 XCTAssertTrue(message.optionalGroup.hasA);
531 XCTAssertTrue(message.optionalNestedMessage.hasBb);
532 XCTAssertTrue(message.optionalForeignMessage.hasC);
533 XCTAssertTrue(message.optionalImportMessage.hasD);
535 XCTAssertTrue(message.hasOptionalNestedEnum);
536 XCTAssertTrue(message.hasOptionalForeignEnum);
537 XCTAssertTrue(message.hasOptionalImportEnum);
539 XCTAssertTrue(message.hasOptionalStringPiece);
540 XCTAssertTrue(message.hasOptionalCord);
542 XCTAssertEqual(101, message.optionalInt32);
543 XCTAssertEqual(102LL, message.optionalInt64);
544 XCTAssertEqual(103U, message.optionalUint32);
545 XCTAssertEqual(104ULL, message.optionalUint64);
546 XCTAssertEqual(105, message.optionalSint32);
547 XCTAssertEqual(106LL, message.optionalSint64);
548 XCTAssertEqual(107U, message.optionalFixed32);
549 XCTAssertEqual(108ULL, message.optionalFixed64);
550 XCTAssertEqual(109, message.optionalSfixed32);
551 XCTAssertEqual(110LL, message.optionalSfixed64);
552 XCTAssertEqualWithAccuracy(111.0f, message.optionalFloat, 0.1);
553 XCTAssertEqualWithAccuracy(112.0, message.optionalDouble, 0.1);
554 XCTAssertTrue(message.optionalBool);
555 XCTAssertEqualObjects(@"115", message.optionalString);
556 XCTAssertEqualObjects([NSData gpbtu_dataWithEmbeddedNulls], message.optionalBytes);
558 XCTAssertEqual(117, message.optionalGroup.a);
559 XCTAssertEqual(118, message.optionalNestedMessage.bb);
560 XCTAssertEqual(119, message.optionalForeignMessage.c);
561 XCTAssertEqual(120, message.optionalImportMessage.d);
563 XCTAssertEqual(TestAllTypes_NestedEnum_Baz, message.optionalNestedEnum);
564 XCTAssertEqual(ForeignEnum_ForeignBaz, message.optionalForeignEnum);
565 XCTAssertEqual(ImportEnum_ImportBaz, message.optionalImportEnum);
567 XCTAssertEqualObjects(@"124", message.optionalStringPiece);
568 XCTAssertEqualObjects(@"125", message.optionalCord);
572 XCTAssertEqual(count, message.repeatedInt32Array.count);
573 XCTAssertEqual(count, message.repeatedInt64Array.count);
574 XCTAssertEqual(count, message.repeatedUint32Array.count);
575 XCTAssertEqual(count, message.repeatedUint64Array.count);
576 XCTAssertEqual(count, message.repeatedSint32Array.count);
577 XCTAssertEqual(count, message.repeatedSint64Array.count);
578 XCTAssertEqual(count, message.repeatedFixed32Array.count);
579 XCTAssertEqual(count, message.repeatedFixed64Array.count);
580 XCTAssertEqual(count, message.repeatedSfixed32Array.count);
581 XCTAssertEqual(count, message.repeatedSfixed64Array.count);
582 XCTAssertEqual(count, message.repeatedFloatArray.count);
583 XCTAssertEqual(count, message.repeatedDoubleArray.count);
584 XCTAssertEqual(count, message.repeatedBoolArray.count);
585 XCTAssertEqual(count, message.repeatedStringArray.count);
586 XCTAssertEqual(count, message.repeatedBytesArray.count);
588 XCTAssertEqual(count, message.repeatedGroupArray.count);
589 XCTAssertEqual(count, message.repeatedNestedMessageArray.count);
590 XCTAssertEqual(count, message.repeatedForeignMessageArray.count);
591 XCTAssertEqual(count, message.repeatedImportMessageArray.count);
592 XCTAssertEqual(count, message.repeatedNestedEnumArray.count);
593 XCTAssertEqual(count, message.repeatedForeignEnumArray.count);
594 XCTAssertEqual(count, message.repeatedImportEnumArray.count);
596 XCTAssertEqual(count, message.repeatedStringPieceArray.count);
597 XCTAssertEqual(count, message.repeatedCordArray.count);
599 XCTAssertEqual(count, message.repeatedInt32Array_Count);
600 XCTAssertEqual(count, message.repeatedInt64Array_Count);
601 XCTAssertEqual(count, message.repeatedUint32Array_Count);
602 XCTAssertEqual(count, message.repeatedUint64Array_Count);
603 XCTAssertEqual(count, message.repeatedSint32Array_Count);
604 XCTAssertEqual(count, message.repeatedSint64Array_Count);
605 XCTAssertEqual(count, message.repeatedFixed32Array_Count);
606 XCTAssertEqual(count, message.repeatedFixed64Array_Count);
607 XCTAssertEqual(count, message.repeatedSfixed32Array_Count);
608 XCTAssertEqual(count, message.repeatedSfixed64Array_Count);
609 XCTAssertEqual(count, message.repeatedFloatArray_Count);
610 XCTAssertEqual(count, message.repeatedDoubleArray_Count);
611 XCTAssertEqual(count, message.repeatedBoolArray_Count);
612 XCTAssertEqual(count, message.repeatedStringArray_Count);
613 XCTAssertEqual(count, message.repeatedBytesArray_Count);
615 XCTAssertEqual(count, message.repeatedGroupArray_Count);
616 XCTAssertEqual(count, message.repeatedNestedMessageArray_Count);
617 XCTAssertEqual(count, message.repeatedForeignMessageArray_Count);
618 XCTAssertEqual(count, message.repeatedImportMessageArray_Count);
619 XCTAssertEqual(count, message.repeatedNestedEnumArray_Count);
620 XCTAssertEqual(count, message.repeatedForeignEnumArray_Count);
621 XCTAssertEqual(count, message.repeatedImportEnumArray_Count);
623 XCTAssertEqual(count, message.repeatedStringPieceArray_Count);
624 XCTAssertEqual(count, message.repeatedCordArray_Count);
627 XCTAssertEqual((int)(201 + i * 100), [message.repeatedInt32Array valueAtIndex:i]);
628 XCTAssertEqual(202 + i * 100, [message.repeatedInt64Array valueAtIndex:i]);
629 XCTAssertEqual(203 + i * 100, [message.repeatedUint32Array valueAtIndex:i]);
630 XCTAssertEqual(204 + i * 100, [message.repeatedUint64Array valueAtIndex:i]);
631 XCTAssertEqual((int)(205 + i * 100), [message.repeatedSint32Array valueAtIndex:i]);
632 XCTAssertEqual(206 + i * 100, [message.repeatedSint64Array valueAtIndex:i]);
633 XCTAssertEqual(207 + i * 100, [message.repeatedFixed32Array valueAtIndex:i]);
634 XCTAssertEqual(208 + i * 100, [message.repeatedFixed64Array valueAtIndex:i]);
635 XCTAssertEqual((int)(209 + i * 100), [message.repeatedSfixed32Array valueAtIndex:i]);
636 XCTAssertEqual(210 + i * 100, [message.repeatedSfixed64Array valueAtIndex:i]);
637 XCTAssertEqualWithAccuracy(211 + i * 100, [message.repeatedFloatArray valueAtIndex:i], 0.1);
638 XCTAssertEqualWithAccuracy(212 + i * 100, [message.repeatedDoubleArray valueAtIndex:i], 0.1);
639 XCTAssertEqual((i % 2) ? YES : NO, [message.repeatedBoolArray valueAtIndex:i]);
642 XCTAssertEqualObjects(string, message.repeatedStringArray[i]);
646 XCTAssertEqualObjects(data, message.repeatedBytesArray[i]);
650 ((TestAllTypes_RepeatedGroup *)message.repeatedGroupArray[i]).a);
652 ((TestAllTypes_NestedMessage *)message.repeatedNestedMessageArray[i]).bb);
654 ((ForeignMessage *)message.repeatedForeignMessageArray[i]).c);
656 ((ImportMessage *)message.repeatedImportMessageArray[i]).d);
659 [message.repeatedNestedEnumArray valueAtIndex:i]);
661 [message.repeatedForeignEnumArray valueAtIndex:i]);
663 [message.repeatedImportEnumArray valueAtIndex:i]);
666 XCTAssertEqualObjects(string, message.repeatedStringPieceArray[i]);
670 XCTAssertEqualObjects(string, message.repeatedCordArray[i]);
676 XCTAssertTrue(message.hasDefaultInt32);
677 XCTAssertTrue(message.hasDefaultInt64);
678 XCTAssertTrue(message.hasDefaultUint32);
679 XCTAssertTrue(message.hasDefaultUint64);
680 XCTAssertTrue(message.hasDefaultSint32);
681 XCTAssertTrue(message.hasDefaultSint64);
682 XCTAssertTrue(message.hasDefaultFixed32);
683 XCTAssertTrue(message.hasDefaultFixed64);
684 XCTAssertTrue(message.hasDefaultSfixed32);
685 XCTAssertTrue(message.hasDefaultSfixed64);
686 XCTAssertTrue(message.hasDefaultFloat);
687 XCTAssertTrue(message.hasDefaultDouble);
688 XCTAssertTrue(message.hasDefaultBool);
689 XCTAssertTrue(message.hasDefaultString);
690 XCTAssertTrue(message.hasDefaultBytes);
692 XCTAssertTrue(message.hasDefaultNestedEnum);
693 XCTAssertTrue(message.hasDefaultForeignEnum);
694 XCTAssertTrue(message.hasDefaultImportEnum);
696 XCTAssertTrue(message.hasDefaultStringPiece);
697 XCTAssertTrue(message.hasDefaultCord);
699 XCTAssertEqual(401, message.defaultInt32);
700 XCTAssertEqual(402LL, message.defaultInt64);
701 XCTAssertEqual(403U, message.defaultUint32);
702 XCTAssertEqual(404ULL, message.defaultUint64);
703 XCTAssertEqual(405, message.defaultSint32);
704 XCTAssertEqual(406LL, message.defaultSint64);
705 XCTAssertEqual(407U, message.defaultFixed32);
706 XCTAssertEqual(408ULL, message.defaultFixed64);
707 XCTAssertEqual(409, message.defaultSfixed32);
708 XCTAssertEqual(410LL, message.defaultSfixed64);
709 XCTAssertEqualWithAccuracy(411.0f, message.defaultFloat, 0.1);
710 XCTAssertEqualWithAccuracy(412.0, message.defaultDouble, 0.1);
711 XCTAssertFalse(message.defaultBool);
712 XCTAssertEqualObjects(@"415", message.defaultString);
713 XCTAssertEqualObjects([NSData gpbtu_dataWithUint32:416], message.defaultBytes);
715 XCTAssertEqual(TestAllTypes_NestedEnum_Foo, message.defaultNestedEnum);
716 XCTAssertEqual(ForeignEnum_ForeignFoo, message.defaultForeignEnum);
717 XCTAssertEqual(ImportEnum_ImportFoo, message.defaultImportEnum);
719 XCTAssertEqualObjects(@"424", message.defaultStringPiece);
720 XCTAssertEqualObjects(@"425", message.defaultCord);
723 - (void)setAllFields:(TestAllTypes *)message repeatedCount:(uint32_t)count {
724 [message setOptionalInt32:101];
725 [message setOptionalInt64:102];
726 [message setOptionalUint32:103];
727 [message setOptionalUint64:104];
728 [message setOptionalSint32:105];
729 [message setOptionalSint64:106];
730 [message setOptionalFixed32:107];
731 [message setOptionalFixed64:108];
732 [message setOptionalSfixed32:109];
733 [message setOptionalSfixed64:110];
734 [message setOptionalFloat:111];
735 [message setOptionalDouble:112];
736 [message setOptionalBool:YES];
737 [message setOptionalString:@"115"];
738 [message setOptionalBytes:[NSData gpbtu_dataWithEmbeddedNulls]];
740 TestAllTypes_OptionalGroup *allTypes = [TestAllTypes_OptionalGroup message];
742 [message setOptionalGroup:allTypes];
743 TestAllTypes_NestedMessage *nestedMessage = [TestAllTypes_NestedMessage message];
745 [message setOptionalNestedMessage:nestedMessage];
746 ForeignMessage *foreignMessage = [ForeignMessage message];
748 [message setOptionalForeignMessage:foreignMessage];
749 ImportMessage *importMessage = [ImportMessage message];
751 [message setOptionalImportMessage:importMessage];
753 [message setOptionalNestedEnum:TestAllTypes_NestedEnum_Baz];
754 [message setOptionalForeignEnum:ForeignEnum_ForeignBaz];
755 [message setOptionalImportEnum:ImportEnum_ImportBaz];
757 [message setOptionalStringPiece:@"124"];
758 [message setOptionalCord:@"125"];
763 [message.repeatedInt32Array addValue:201 + i * 100];
764 [message.repeatedInt64Array addValue:202 + i * 100];
765 [message.repeatedUint32Array addValue:203 + i * 100];
766 [message.repeatedUint64Array addValue:204 + i * 100];
767 [message.repeatedSint32Array addValue:205 + i * 100];
768 [message.repeatedSint64Array addValue:206 + i * 100];
769 [message.repeatedFixed32Array addValue:207 + i * 100];
770 [message.repeatedFixed64Array addValue:208 + i * 100];
771 [message.repeatedSfixed32Array addValue:209 + i * 100];
772 [message.repeatedSfixed64Array addValue:210 + i * 100];
773 [message.repeatedFloatArray addValue:211 + i * 100];
774 [message.repeatedDoubleArray addValue:212 + i * 100];
775 [message.repeatedBoolArray addValue:(BOOL)(i % 2)];
777 [message.repeatedStringArray addObject:string];
781 [message.repeatedBytesArray addObject:data];
786 [message.repeatedGroupArray addObject:testAll];
791 [message.repeatedNestedMessageArray addObject:nestedMessage];
796 [message.repeatedForeignMessageArray addObject:foreignMessage];
801 [message.repeatedImportMessageArray addObject:importMessage];
804 [message.repeatedNestedEnumArray
807 [message.repeatedForeignEnumArray
809 [message.repeatedImportEnumArray
813 [message.repeatedStringPieceArray addObject:string];
817 [message.repeatedCordArray addObject:string];
822 message.defaultInt32 = 401;
823 message.defaultInt64 = 402;
824 message.defaultUint32 = 403;
825 message.defaultUint64 = 404;
826 message.defaultSint32 = 405;
827 message.defaultSint64 = 406;
828 message.defaultFixed32 = 407;
829 message.defaultFixed64 = 408;
830 message.defaultSfixed32 = 409;
831 message.defaultSfixed64 = 410;
832 message.defaultFloat = 411;
833 message.defaultDouble = 412;
834 message.defaultBool = NO;
835 message.defaultString = @"415";
836 message.defaultBytes = [NSData gpbtu_dataWithUint32:416];
838 message.defaultNestedEnum = TestAllTypes_NestedEnum_Foo;
839 message.defaultForeignEnum = ForeignEnum_ForeignFoo;
840 message.defaultImportEnum = ImportEnum_ImportFoo;
842 message.defaultStringPiece = @"424";
843 message.defaultCord = @"425";
846 - (void)clearAllFields:(TestAllTypes *)message {
847 message.hasOptionalInt32 = NO;
848 message.hasOptionalInt64 = NO;
849 message.hasOptionalUint32 = NO;
850 message.hasOptionalUint64 = NO;
851 message.hasOptionalSint32 = NO;
852 message.hasOptionalSint64 = NO;
853 message.hasOptionalFixed32 = NO;
854 message.hasOptionalFixed64 = NO;
855 message.hasOptionalSfixed32 = NO;
856 message.hasOptionalSfixed64 = NO;
857 message.hasOptionalFloat = NO;
858 message.hasOptionalDouble = NO;
859 message.hasOptionalBool = NO;
860 message.hasOptionalString = NO;
861 message.hasOptionalBytes = NO;
863 message.hasOptionalGroup = NO;
864 message.hasOptionalNestedMessage = NO;
865 message.hasOptionalForeignMessage = NO;
866 message.hasOptionalImportMessage = NO;
868 message.hasOptionalNestedEnum = NO;
869 message.hasOptionalForeignEnum = NO;
870 message.hasOptionalImportEnum = NO;
872 message.hasOptionalStringPiece = NO;
873 message.hasOptionalCord = NO;
877 [message.repeatedInt32Array removeAll];
878 [message.repeatedInt64Array removeAll];
879 [message.repeatedUint32Array removeAll];
880 [message.repeatedUint64Array removeAll];
881 [message.repeatedSint32Array removeAll];
882 [message.repeatedSint64Array removeAll];
883 [message.repeatedFixed32Array removeAll];
884 [message.repeatedFixed64Array removeAll];
885 [message.repeatedSfixed32Array removeAll];
886 [message.repeatedSfixed64Array removeAll];
887 [message.repeatedFloatArray removeAll];
888 [message.repeatedDoubleArray removeAll];
889 [message.repeatedBoolArray removeAll];
890 [message.repeatedStringArray removeAllObjects];
891 [message.repeatedBytesArray removeAllObjects];
893 [message.repeatedGroupArray removeAllObjects];
894 [message.repeatedNestedMessageArray removeAllObjects];
895 [message.repeatedForeignMessageArray removeAllObjects];
896 [message.repeatedImportMessageArray removeAllObjects];
898 [message.repeatedNestedEnumArray removeAll];
899 [message.repeatedForeignEnumArray removeAll];
900 [message.repeatedImportEnumArray removeAll];
902 [message.repeatedStringPieceArray removeAllObjects];
903 [message.repeatedCordArray removeAllObjects];
907 message.hasDefaultInt32 = NO;
908 message.hasDefaultInt64 = NO;
909 message.hasDefaultUint32 = NO;
910 message.hasDefaultUint64 = NO;
911 message.hasDefaultSint32 = NO;
912 message.hasDefaultSint64 = NO;
913 message.hasDefaultFixed32 = NO;
914 message.hasDefaultFixed64 = NO;
915 message.hasDefaultSfixed32 = NO;
916 message.hasDefaultSfixed64 = NO;
917 message.hasDefaultFloat = NO;
918 message.hasDefaultDouble = NO;
919 message.hasDefaultBool = NO;
920 message.hasDefaultString = NO;
921 message.hasDefaultBytes = NO;
923 message.hasDefaultNestedEnum = NO;
924 message.hasDefaultForeignEnum = NO;
925 message.hasDefaultImportEnum = NO;
927 message.hasDefaultStringPiece = NO;
928 message.hasDefaultCord = NO;
931 - (void)setAllExtensions:(TestAllExtensions *)message repeatedCount:(uint32_t)count {
932 [message setExtension:[UnittestRoot optionalInt32Extension] value:@101];
933 [message setExtension:[UnittestRoot optionalInt64Extension] value:@102L];
934 [message setExtension:[UnittestRoot optionalUint32Extension] value:@103];
935 [message setExtension:[UnittestRoot optionalUint64Extension] value:@104L];
936 [message setExtension:[UnittestRoot optionalSint32Extension] value:@105];
937 [message setExtension:[UnittestRoot optionalSint64Extension] value:@106L];
938 [message setExtension:[UnittestRoot optionalFixed32Extension] value:@107];
939 [message setExtension:[UnittestRoot optionalFixed64Extension] value:@108L];
940 [message setExtension:[UnittestRoot optionalSfixed32Extension] value:@109];
941 [message setExtension:[UnittestRoot optionalSfixed64Extension] value:@110L];
942 [message setExtension:[UnittestRoot optionalFloatExtension] value:@111.0f];
943 [message setExtension:[UnittestRoot optionalDoubleExtension] value:@112.0];
944 [message setExtension:[UnittestRoot optionalBoolExtension] value:@YES];
945 [message setExtension:[UnittestRoot optionalStringExtension] value:@"115"];
946 [message setExtension:[UnittestRoot optionalBytesExtension]
949 OptionalGroup_extension *optionalGroup = [OptionalGroup_extension message];
951 [message setExtension:[UnittestRoot optionalGroupExtension] value:optionalGroup];
952 TestAllTypes_NestedMessage *nestedMessage = [TestAllTypes_NestedMessage message];
954 [message setExtension:[UnittestRoot optionalNestedMessageExtension] value:nestedMessage];
955 ForeignMessage *foreignMessage = [ForeignMessage message];
957 [message setExtension:[UnittestRoot optionalForeignMessageExtension] value:foreignMessage];
958 ImportMessage *importMessage = [ImportMessage message];
960 [message setExtension:[UnittestRoot optionalImportMessageExtension] value:importMessage];
962 [message setExtension:[UnittestRoot optionalNestedEnumExtension]
964 [message setExtension:[UnittestRoot optionalForeignEnumExtension]
966 [message setExtension:[UnittestRoot optionalImportEnumExtension] value:@(ImportEnum_ImportBaz)];
968 [message setExtension:[UnittestRoot optionalStringPieceExtension] value:@"124"];
969 [message setExtension:[UnittestRoot optionalCordExtension] value:@"125"];
972 [message addExtension:[UnittestRoot repeatedInt32Extension] value:@(201 + i * 100)];
973 [message addExtension:[UnittestRoot repeatedInt64Extension] value:@(202 + i * 100)];
974 [message addExtension:[UnittestRoot repeatedUint32Extension] value:@(203 + i * 100)];
975 [message addExtension:[UnittestRoot repeatedUint64Extension] value:@(204 + i * 100)];
976 [message addExtension:[UnittestRoot repeatedSint32Extension] value:@(205 + i * 100)];
977 [message addExtension:[UnittestRoot repeatedSint64Extension] value:@(206 + i * 100)];
978 [message addExtension:[UnittestRoot repeatedFixed32Extension] value:@(207 + i * 100)];
979 [message addExtension:[UnittestRoot repeatedFixed64Extension] value:@(208 + i * 100)];
980 [message addExtension:[UnittestRoot repeatedSfixed32Extension] value:@(209 + i * 100)];
981 [message addExtension:[UnittestRoot repeatedSfixed64Extension] value:@(210 + i * 100)];
982 [message addExtension:[UnittestRoot repeatedFloatExtension] value:@(211 + i * 100)];
983 [message addExtension:[UnittestRoot repeatedDoubleExtension] value:@(212 + i * 100)];
984 [message addExtension:[UnittestRoot repeatedBoolExtension] value:@((i % 2) ? YES : NO)];
986 [message addExtension:[UnittestRoot repeatedStringExtension] value:string];
989 [message addExtension:[UnittestRoot repeatedBytesExtension] value:data];
994 [message addExtension:[UnittestRoot repeatedGroupExtension] value:repeatedGroup];
998 [message addExtension:[UnittestRoot repeatedNestedMessageExtension] value:nestedMessage];
1002 [message addExtension:[UnittestRoot repeatedForeignMessageExtension] value:foreignMessage];
1006 [message addExtension:[UnittestRoot repeatedImportMessageExtension] value:importMessage];
1008 [message addExtension:[UnittestRoot repeatedNestedEnumExtension]
1010 [message addExtension:[UnittestRoot repeatedForeignEnumExtension]
1012 [message addExtension:[UnittestRoot repeatedImportEnumExtension]
1016 [message addExtension:[UnittestRoot repeatedStringPieceExtension] value:string];
1020 [message addExtension:[UnittestRoot repeatedCordExtension] value:string];
1026 [message setExtension:[UnittestRoot defaultInt32Extension] value:@401];
1027 [message setExtension:[UnittestRoot defaultInt64Extension] value:@402L];
1028 [message setExtension:[UnittestRoot defaultUint32Extension] value:@403];
1029 [message setExtension:[UnittestRoot defaultUint64Extension] value:@404L];
1030 [message setExtension:[UnittestRoot defaultSint32Extension] value:@405];
1031 [message setExtension:[UnittestRoot defaultSint64Extension] value:@406L];
1032 [message setExtension:[UnittestRoot defaultFixed32Extension] value:@407];
1033 [message setExtension:[UnittestRoot defaultFixed64Extension] value:@408L];
1034 [message setExtension:[UnittestRoot defaultSfixed32Extension] value:@409];
1035 [message setExtension:[UnittestRoot defaultSfixed64Extension] value:@410L];
1036 [message setExtension:[UnittestRoot defaultFloatExtension] value:@411.0f];
1037 [message setExtension:[UnittestRoot defaultDoubleExtension] value:@412.0];
1038 [message setExtension:[UnittestRoot defaultBoolExtension] value:@NO];
1039 [message setExtension:[UnittestRoot defaultStringExtension] value:@"415"];
1040 [message setExtension:[UnittestRoot defaultBytesExtension]
1043 [message setExtension:[UnittestRoot defaultNestedEnumExtension]
1045 [message setExtension:[UnittestRoot defaultForeignEnumExtension] value:@(ForeignEnum_ForeignFoo)];
1046 [message setExtension:[UnittestRoot defaultImportEnumExtension] value:@(ImportEnum_ImportFoo)];
1048 [message setExtension:[UnittestRoot defaultStringPieceExtension] value:@"424"];
1049 [message setExtension:[UnittestRoot defaultCordExtension] value:@"425"];
1052 - (void)setAllMapFields:(TestMap *)message numEntries:(uint32_t)count {
1054 [message.mapInt32Int32 setInt32:(i + 1) forKey:100 + i * 100];
1055 [message.mapInt64Int64 setInt64:(i + 1) forKey:101 + i * 100];
1056 [message.mapUint32Uint32 setUInt32:(i + 1) forKey:102 + i * 100];
1057 [message.mapUint64Uint64 setUInt64:(i + 1) forKey:103 + i * 100];
1058 [message.mapSint32Sint32 setInt32:(i + 1) forKey:104 + i * 100];
1059 [message.mapSint64Sint64 setInt64:(i + 1) forKey:105 + i * 100];
1060 [message.mapFixed32Fixed32 setUInt32:(i + 1) forKey:106 + i * 100];
1061 [message.mapFixed64Fixed64 setUInt64:(i + 1) forKey:107 + i * 100];
1062 [message.mapSfixed32Sfixed32 setInt32:(i + 1) forKey:108 + i * 100];
1063 [message.mapSfixed64Sfixed64 setInt64:(i + 1) forKey:109 + i * 100];
1064 [message.mapInt32Float setFloat:(i + 1) forKey:110 + i * 100];
1065 [message.mapInt32Double setDouble:(i + 1) forKey:111 + i * 100];
1066 [message.mapBoolBool setBool:((i % 2) == 1) forKey:((i % 2) == 0)];
1070 [message.mapStringString setObject:dataStr forKey:keyStr];
1075 [message.mapInt32Bytes setObject:data forKey:113 + i * 100];
1078 [message.mapInt32Enum setEnum:(i % 2) ? MapEnum_MapEnumBar : MapEnum_MapEnumBaz
1083 [message.mapInt32ForeignMessage setObject:subMsg forKey:115 + i * 100];
1088 - (void)setAllTestPackedFields:(TestPackedTypes *)message {
1090 [message.packedInt32Array addValue:101];
1091 [message.packedInt64Array addValue:102];
1092 [message.packedUint32Array addValue:103];
1093 [message.packedUint64Array addValue:104];
1094 [message.packedSint32Array addValue:105];
1095 [message.packedSint64Array addValue:106];
1096 [message.packedFixed32Array addValue:107];
1097 [message.packedFixed64Array addValue:108];
1098 [message.packedSfixed32Array addValue:109];
1099 [message.packedSfixed64Array addValue:110];
1100 [message.packedFloatArray addValue:111.f];
1101 [message.packedDoubleArray addValue:112.];
1102 [message.packedBoolArray addValue:YES];
1103 [message.packedEnumArray addValue:ForeignEnum_ForeignBar];
1105 [message.packedInt32Array addValue:201];
1106 [message.packedInt64Array addValue:302];
1107 [message.packedUint32Array addValue:203];
1108 [message.packedUint64Array addValue:204];
1109 [message.packedSint32Array addValue:205];
1110 [message.packedSint64Array addValue:206];
1111 [message.packedFixed32Array addValue:207];
1112 [message.packedFixed64Array addValue:208];
1113 [message.packedSfixed32Array addValue:209];
1114 [message.packedSfixed64Array addValue:210];
1115 [message.packedFloatArray addValue:211.f];
1116 [message.packedDoubleArray addValue:212.];
1117 [message.packedBoolArray addValue:NO];
1118 [message.packedEnumArray addValue:ForeignEnum_ForeignBaz];
1121 - (void)setAllTestUnpackedFields:(TestUnpackedTypes *)message {
1123 [message.unpackedInt32Array addValue:101];
1124 [message.unpackedInt64Array addValue:102];
1125 [message.unpackedUint32Array addValue:103];
1126 [message.unpackedUint64Array addValue:104];
1127 [message.unpackedSint32Array addValue:105];
1128 [message.unpackedSint64Array addValue:106];
1129 [message.unpackedFixed32Array addValue:107];
1130 [message.unpackedFixed64Array addValue:108];
1131 [message.unpackedSfixed32Array addValue:109];
1132 [message.unpackedSfixed64Array addValue:110];
1133 [message.unpackedFloatArray addValue:111.f];
1134 [message.unpackedDoubleArray addValue:112.];
1135 [message.unpackedBoolArray addValue:YES];
1136 [message.unpackedEnumArray addValue:ForeignEnum_ForeignBar];
1138 [message.unpackedInt32Array addValue:201];
1139 [message.unpackedInt64Array addValue:302];
1140 [message.unpackedUint32Array addValue:203];
1141 [message.unpackedUint64Array addValue:204];
1142 [message.unpackedSint32Array addValue:205];
1143 [message.unpackedSint64Array addValue:206];
1144 [message.unpackedFixed32Array addValue:207];
1145 [message.unpackedFixed64Array addValue:208];
1146 [message.unpackedSfixed32Array addValue:209];
1147 [message.unpackedSfixed64Array addValue:210];
1148 [message.unpackedFloatArray addValue:211.f];
1149 [message.unpackedDoubleArray addValue:212.];
1150 [message.unpackedBoolArray addValue:NO];
1151 [message.unpackedEnumArray addValue:ForeignEnum_ForeignBaz];
1159 TestAllTypes *message = [TestAllTypes message];
1160 [self setAllFields:message repeatedCount:count];
1161 return message;
1165 TestAllExtensions *message = [TestAllExtensions message];
1166 [self setAllExtensions:message repeatedCount:count];
1167 return message;
1171 TestPackedTypes *message = [TestPackedTypes message];
1172 [self setPackedFields:message repeatedCount:count];
1173 return message;
1177 TestPackedExtensions *message = [TestPackedExtensions message];
1178 [self setPackedExtensions:message repeatedCount:count];
1179 return message;
1184 - (void)assertClear:(TestAllTypes *)message {
1186 XCTAssertFalse(message.hasOptionalInt32);
1187 XCTAssertFalse(message.hasOptionalInt64);
1188 XCTAssertFalse(message.hasOptionalUint32);
1189 XCTAssertFalse(message.hasOptionalUint64);
1190 XCTAssertFalse(message.hasOptionalSint32);
1191 XCTAssertFalse(message.hasOptionalSint64);
1192 XCTAssertFalse(message.hasOptionalFixed32);
1193 XCTAssertFalse(message.hasOptionalFixed64);
1194 XCTAssertFalse(message.hasOptionalSfixed32);
1195 XCTAssertFalse(message.hasOptionalSfixed64);
1196 XCTAssertFalse(message.hasOptionalFloat);
1197 XCTAssertFalse(message.hasOptionalDouble);
1198 XCTAssertFalse(message.hasOptionalBool);
1199 XCTAssertFalse(message.hasOptionalString);
1200 XCTAssertFalse(message.hasOptionalBytes);
1202 XCTAssertFalse(message.hasOptionalGroup);
1203 XCTAssertFalse(message.hasOptionalNestedMessage);
1204 XCTAssertFalse(message.hasOptionalForeignMessage);
1205 XCTAssertFalse(message.hasOptionalImportMessage);
1207 XCTAssertFalse(message.hasOptionalNestedEnum);
1208 XCTAssertFalse(message.hasOptionalForeignEnum);
1209 XCTAssertFalse(message.hasOptionalImportEnum);
1211 XCTAssertFalse(message.hasOptionalStringPiece);
1212 XCTAssertFalse(message.hasOptionalCord);
1215 XCTAssertEqual(0, message.optionalInt32);
1216 XCTAssertEqual(0LL, message.optionalInt64);
1217 XCTAssertEqual(0U, message.optionalUint32);
1218 XCTAssertEqual(0ULL, message.optionalUint64);
1219 XCTAssertEqual(0, message.optionalSint32);
1220 XCTAssertEqual(0LL, message.optionalSint64);
1221 XCTAssertEqual(0U, message.optionalFixed32);
1222 XCTAssertEqual(0ULL, message.optionalFixed64);
1223 XCTAssertEqual(0, message.optionalSfixed32);
1224 XCTAssertEqual(0LL, message.optionalSfixed64);
1225 XCTAssertEqual(0.0f, message.optionalFloat);
1226 XCTAssertEqual(0.0, message.optionalDouble);
1227 XCTAssertFalse(message.optionalBool);
1228 XCTAssertEqualObjects(message.optionalString, @"");
1229 XCTAssertEqualObjects(message.optionalBytes, GPBEmptyNSData());
1232 XCTAssertFalse(message.hasOptionalGroup);
1233 XCTAssertFalse(message.hasOptionalNestedMessage);
1234 XCTAssertFalse(message.hasOptionalForeignMessage);
1235 XCTAssertFalse(message.hasOptionalImportMessage);
1238 XCTAssertEqual(TestAllTypes_NestedEnum_Foo, message.optionalNestedEnum);
1239 XCTAssertEqual(ForeignEnum_ForeignFoo, message.optionalForeignEnum);
1240 XCTAssertEqual(ImportEnum_ImportFoo, message.optionalImportEnum);
1242 XCTAssertEqualObjects(message.optionalStringPiece, @"");
1243 XCTAssertEqualObjects(message.optionalCord, @"");
1247 XCTAssertEqual(0U, message.repeatedInt32Array.count);
1248 XCTAssertEqual(0U, message.repeatedInt64Array.count);
1249 XCTAssertEqual(0U, message.repeatedUint32Array.count);
1250 XCTAssertEqual(0U, message.repeatedUint64Array.count);
1251 XCTAssertEqual(0U, message.repeatedSint32Array.count);
1252 XCTAssertEqual(0U, message.repeatedSint64Array.count);
1253 XCTAssertEqual(0U, message.repeatedFixed32Array.count);
1254 XCTAssertEqual(0U, message.repeatedFixed64Array.count);
1255 XCTAssertEqual(0U, message.repeatedSfixed32Array.count);
1256 XCTAssertEqual(0U, message.repeatedSfixed64Array.count);
1257 XCTAssertEqual(0U, message.repeatedFloatArray.count);
1258 XCTAssertEqual(0U, message.repeatedDoubleArray.count);
1259 XCTAssertEqual(0U, message.repeatedBoolArray.count);
1260 XCTAssertEqual(0U, message.repeatedStringArray.count);
1261 XCTAssertEqual(0U, message.repeatedBytesArray.count);
1263 XCTAssertEqual(0U, message.repeatedGroupArray.count);
1264 XCTAssertEqual(0U, message.repeatedNestedMessageArray.count);
1265 XCTAssertEqual(0U, message.repeatedForeignMessageArray.count);
1266 XCTAssertEqual(0U, message.repeatedImportMessageArray.count);
1267 XCTAssertEqual(0U, message.repeatedNestedEnumArray.count);
1268 XCTAssertEqual(0U, message.repeatedForeignEnumArray.count);
1269 XCTAssertEqual(0U, message.repeatedImportEnumArray.count);
1271 XCTAssertEqual(0U, message.repeatedStringPieceArray.count);
1272 XCTAssertEqual(0U, message.repeatedCordArray.count);
1274 XCTAssertEqual(0U, message.repeatedInt32Array_Count);
1275 XCTAssertEqual(0U, message.repeatedInt64Array_Count);
1276 XCTAssertEqual(0U, message.repeatedUint32Array_Count);
1277 XCTAssertEqual(0U, message.repeatedUint64Array_Count);
1278 XCTAssertEqual(0U, message.repeatedSint32Array_Count);
1279 XCTAssertEqual(0U, message.repeatedSint64Array_Count);
1280 XCTAssertEqual(0U, message.repeatedFixed32Array_Count);
1281 XCTAssertEqual(0U, message.repeatedFixed64Array_Count);
1282 XCTAssertEqual(0U, message.repeatedSfixed32Array_Count);
1283 XCTAssertEqual(0U, message.repeatedSfixed64Array_Count);
1284 XCTAssertEqual(0U, message.repeatedFloatArray_Count);
1285 XCTAssertEqual(0U, message.repeatedDoubleArray_Count);
1286 XCTAssertEqual(0U, message.repeatedBoolArray_Count);
1287 XCTAssertEqual(0U, message.repeatedStringArray_Count);
1288 XCTAssertEqual(0U, message.repeatedBytesArray_Count);
1290 XCTAssertEqual(0U, message.repeatedGroupArray_Count);
1291 XCTAssertEqual(0U, message.repeatedNestedMessageArray_Count);
1292 XCTAssertEqual(0U, message.repeatedForeignMessageArray_Count);
1293 XCTAssertEqual(0U, message.repeatedImportMessageArray_Count);
1294 XCTAssertEqual(0U, message.repeatedNestedEnumArray_Count);
1295 XCTAssertEqual(0U, message.repeatedForeignEnumArray_Count);
1296 XCTAssertEqual(0U, message.repeatedImportEnumArray_Count);
1298 XCTAssertEqual(0U, message.repeatedStringPieceArray_Count);
1299 XCTAssertEqual(0U, message.repeatedCordArray_Count);
1302 XCTAssertFalse(message.hasDefaultInt32);
1303 XCTAssertFalse(message.hasDefaultInt64);
1304 XCTAssertFalse(message.hasDefaultUint32);
1305 XCTAssertFalse(message.hasDefaultUint64);
1306 XCTAssertFalse(message.hasDefaultSint32);
1307 XCTAssertFalse(message.hasDefaultSint64);
1308 XCTAssertFalse(message.hasDefaultFixed32);
1309 XCTAssertFalse(message.hasDefaultFixed64);
1310 XCTAssertFalse(message.hasDefaultSfixed32);
1311 XCTAssertFalse(message.hasDefaultSfixed64);
1312 XCTAssertFalse(message.hasDefaultFloat);
1313 XCTAssertFalse(message.hasDefaultDouble);
1314 XCTAssertFalse(message.hasDefaultBool);
1315 XCTAssertFalse(message.hasDefaultString);
1316 XCTAssertFalse(message.hasDefaultBytes);
1318 XCTAssertFalse(message.hasDefaultNestedEnum);
1319 XCTAssertFalse(message.hasDefaultForeignEnum);
1320 XCTAssertFalse(message.hasDefaultImportEnum);
1322 XCTAssertFalse(message.hasDefaultStringPiece);
1323 XCTAssertFalse(message.hasDefaultCord);
1326 XCTAssertEqual(41, message.defaultInt32);
1327 XCTAssertEqual(42LL, message.defaultInt64);
1328 XCTAssertEqual(43U, message.defaultUint32);
1329 XCTAssertEqual(44ULL, message.defaultUint64);
1330 XCTAssertEqual(-45, message.defaultSint32);
1331 XCTAssertEqual(46LL, message.defaultSint64);
1332 XCTAssertEqual(47U, message.defaultFixed32);
1333 XCTAssertEqual(48ULL, message.defaultFixed64);
1334 XCTAssertEqual(49, message.defaultSfixed32);
1335 XCTAssertEqual(-50LL, message.defaultSfixed64);
1336 XCTAssertEqualWithAccuracy(51.5f, message.defaultFloat, 0.1);
1337 XCTAssertEqualWithAccuracy(52e3, message.defaultDouble, 0.1);
1338 XCTAssertTrue(message.defaultBool);
1339 XCTAssertEqualObjects(@"hello", message.defaultString);
1340 XCTAssertEqualObjects([NSData gpbtu_dataWithCString:"world"], message.defaultBytes);
1342 XCTAssertEqual(TestAllTypes_NestedEnum_Bar, message.defaultNestedEnum);
1343 XCTAssertEqual(ForeignEnum_ForeignBar, message.defaultForeignEnum);
1344 XCTAssertEqual(ImportEnum_ImportBar, message.defaultImportEnum);
1346 XCTAssertEqualObjects(@"abc", message.defaultStringPiece);
1347 XCTAssertEqualObjects(@"123", message.defaultCord);
1350 - (void)assertExtensionsClear:(TestAllExtensions *)message {
1352 XCTAssertFalse([message hasExtension:[UnittestRoot optionalInt32Extension]]);
1353 XCTAssertFalse([message hasExtension:[UnittestRoot optionalInt64Extension]]);
1354 XCTAssertFalse([message hasExtension:[UnittestRoot optionalUint32Extension]]);
1355 XCTAssertFalse([message hasExtension:[UnittestRoot optionalUint64Extension]]);
1356 XCTAssertFalse([message hasExtension:[UnittestRoot optionalSint32Extension]]);
1357 XCTAssertFalse([message hasExtension:[UnittestRoot optionalSint64Extension]]);
1358 XCTAssertFalse([message hasExtension:[UnittestRoot optionalFixed32Extension]]);
1359 XCTAssertFalse([message hasExtension:[UnittestRoot optionalFixed64Extension]]);
1360 XCTAssertFalse([message hasExtension:[UnittestRoot optionalSfixed32Extension]]);
1361 XCTAssertFalse([message hasExtension:[UnittestRoot optionalSfixed64Extension]]);
1362 XCTAssertFalse([message hasExtension:[UnittestRoot optionalFloatExtension]]);
1363 XCTAssertFalse([message hasExtension:[UnittestRoot optionalDoubleExtension]]);
1364 XCTAssertFalse([message hasExtension:[UnittestRoot optionalBoolExtension]]);
1365 XCTAssertFalse([message hasExtension:[UnittestRoot optionalStringExtension]]);
1366 XCTAssertFalse([message hasExtension:[UnittestRoot optionalBytesExtension]]);
1368 XCTAssertFalse([message hasExtension:[UnittestRoot optionalGroupExtension]]);
1369 XCTAssertFalse([message hasExtension:[UnittestRoot optionalNestedMessageExtension]]);
1370 XCTAssertFalse([message hasExtension:[UnittestRoot optionalForeignMessageExtension]]);
1371 XCTAssertFalse([message hasExtension:[UnittestRoot optionalImportMessageExtension]]);
1373 XCTAssertFalse([message hasExtension:[UnittestRoot optionalNestedEnumExtension]]);
1374 XCTAssertFalse([message hasExtension:[UnittestRoot optionalForeignEnumExtension]]);
1375 XCTAssertFalse([message hasExtension:[UnittestRoot optionalImportEnumExtension]]);
1377 XCTAssertFalse([message hasExtension:[UnittestRoot optionalStringPieceExtension]]);
1378 XCTAssertFalse([message hasExtension:[UnittestRoot optionalCordExtension]]);
1381 XCTAssertEqual(0, [[message getExtension:[UnittestRoot optionalInt32Extension]] intValue]);
1382 XCTAssertEqual(0LL, [[message getExtension:[UnittestRoot optionalInt64Extension]] longLongValue]);
1384 [[message getExtension:[UnittestRoot optionalUint32Extension]] unsignedIntValue]);
1386 0ULL, [[message getExtension:[UnittestRoot optionalUint64Extension]] unsignedLongLongValue]);
1387 XCTAssertEqual(0, [[message getExtension:[UnittestRoot optionalSint32Extension]] intValue]);
1389 [[message getExtension:[UnittestRoot optionalSint64Extension]] longLongValue]);
1391 [[message getExtension:[UnittestRoot optionalFixed32Extension]] unsignedIntValue]);
1393 0ULL, [[message getExtension:[UnittestRoot optionalFixed64Extension]] unsignedLongLongValue]);
1394 XCTAssertEqual(0, [[message getExtension:[UnittestRoot optionalSfixed32Extension]] intValue]);
1396 [[message getExtension:[UnittestRoot optionalSfixed64Extension]] longLongValue]);
1398 0.0f, [[message getExtension:[UnittestRoot optionalFloatExtension]] floatValue], 0.01);
1400 0.0, [[message getExtension:[UnittestRoot optionalDoubleExtension]] doubleValue], 0.01);
1401 XCTAssertFalse([[message getExtension:[UnittestRoot optionalBoolExtension]] boolValue]);
1402 XCTAssertEqualObjects(@"", [message getExtension:[UnittestRoot optionalStringExtension]]);
1404 [message getExtension:[UnittestRoot optionalBytesExtension]]);
1408 XCTAssertFalse([[message getExtension:[UnittestRoot optionalGroupExtension]] hasA]);
1409 XCTAssertFalse([[message getExtension:[UnittestRoot optionalNestedMessageExtension]] hasBb]);
1410 XCTAssertFalse([[message getExtension:[UnittestRoot optionalForeignMessageExtension]] hasC]);
1411 XCTAssertFalse([[message getExtension:[UnittestRoot optionalImportMessageExtension]] hasD]);
1413 XCTAssertEqual(0, [(TestAllTypes_OptionalGroup *)[message
1415 XCTAssertEqual(0, [(TestAllTypes_NestedMessage *)[message
1417 XCTAssertEqual(0, [[message getExtension:[UnittestRoot optionalForeignMessageExtension]] c]);
1418 XCTAssertEqual(0, [[message getExtension:[UnittestRoot optionalImportMessageExtension]] d]);
1422 [[message getExtension:[UnittestRoot optionalNestedEnumExtension]] intValue]);
1424 [[message getExtension:[UnittestRoot optionalForeignEnumExtension]] intValue]);
1426 [[message getExtension:[UnittestRoot optionalImportEnumExtension]] intValue]);
1428 XCTAssertEqualObjects(@"", [message getExtension:[UnittestRoot optionalStringPieceExtension]]);
1429 XCTAssertEqualObjects(@"", [message getExtension:[UnittestRoot optionalCordExtension]]);
1432 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedInt32Extension]] count]);
1433 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedInt64Extension]] count]);
1434 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedUint32Extension]] count]);
1435 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedUint64Extension]] count]);
1436 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedSint32Extension]] count]);
1437 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedSint64Extension]] count]);
1438 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedFixed32Extension]] count]);
1439 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedFixed64Extension]] count]);
1440 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedSfixed32Extension]] count]);
1441 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedSfixed64Extension]] count]);
1442 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedFloatExtension]] count]);
1443 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedDoubleExtension]] count]);
1444 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedBoolExtension]] count]);
1445 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedStringExtension]] count]);
1446 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedBytesExtension]] count]);
1448 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedGroupExtension]] count]);
1449 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedNestedMessageExtension]] count]);
1450 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedForeignMessageExtension]] count]);
1451 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedImportMessageExtension]] count]);
1452 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedNestedEnumExtension]] count]);
1453 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedForeignEnumExtension]] count]);
1454 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedImportEnumExtension]] count]);
1456 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedStringPieceExtension]] count]);
1457 XCTAssertEqual(0U, [[message getExtension:[UnittestRoot repeatedCordExtension]] count]);
1460 XCTAssertFalse([message hasExtension:[UnittestRoot defaultInt32Extension]]);
1461 XCTAssertFalse([message hasExtension:[UnittestRoot defaultInt64Extension]]);
1462 XCTAssertFalse([message hasExtension:[UnittestRoot defaultUint32Extension]]);
1463 XCTAssertFalse([message hasExtension:[UnittestRoot defaultUint64Extension]]);
1464 XCTAssertFalse([message hasExtension:[UnittestRoot defaultSint32Extension]]);
1465 XCTAssertFalse([message hasExtension:[UnittestRoot defaultSint64Extension]]);
1466 XCTAssertFalse([message hasExtension:[UnittestRoot defaultFixed32Extension]]);
1467 XCTAssertFalse([message hasExtension:[UnittestRoot defaultFixed64Extension]]);
1468 XCTAssertFalse([message hasExtension:[UnittestRoot defaultSfixed32Extension]]);
1469 XCTAssertFalse([message hasExtension:[UnittestRoot defaultSfixed64Extension]]);
1470 XCTAssertFalse([message hasExtension:[UnittestRoot defaultFloatExtension]]);
1471 XCTAssertFalse([message hasExtension:[UnittestRoot defaultDoubleExtension]]);
1472 XCTAssertFalse([message hasExtension:[UnittestRoot defaultBoolExtension]]);
1473 XCTAssertFalse([message hasExtension:[UnittestRoot defaultStringExtension]]);
1474 XCTAssertFalse([message hasExtension:[UnittestRoot defaultBytesExtension]]);
1476 XCTAssertFalse([message hasExtension:[UnittestRoot defaultNestedEnumExtension]]);
1477 XCTAssertFalse([message hasExtension:[UnittestRoot defaultForeignEnumExtension]]);
1478 XCTAssertFalse([message hasExtension:[UnittestRoot defaultImportEnumExtension]]);
1480 XCTAssertFalse([message hasExtension:[UnittestRoot defaultStringPieceExtension]]);
1481 XCTAssertFalse([message hasExtension:[UnittestRoot defaultCordExtension]]);
1484 XCTAssertEqual(41, [[message getExtension:[UnittestRoot defaultInt32Extension]] intValue]);
1485 XCTAssertEqual(42LL, [[message getExtension:[UnittestRoot defaultInt64Extension]] longLongValue]);
1487 [[message getExtension:[UnittestRoot defaultUint32Extension]] unsignedIntValue]);
1489 44ULL, [[message getExtension:[UnittestRoot defaultUint64Extension]] unsignedLongLongValue]);
1490 XCTAssertEqual(-45, [[message getExtension:[UnittestRoot defaultSint32Extension]] intValue]);
1492 [[message getExtension:[UnittestRoot defaultSint64Extension]] longLongValue]);
1493 XCTAssertEqual(47, [[message getExtension:[UnittestRoot defaultFixed32Extension]] intValue]);
1495 48ULL, [[message getExtension:[UnittestRoot defaultFixed64Extension]] unsignedLongLongValue]);
1496 XCTAssertEqual(49, [[message getExtension:[UnittestRoot defaultSfixed32Extension]] intValue]);
1498 [[message getExtension:[UnittestRoot defaultSfixed64Extension]] longLongValue]);
1500 51.5f, [[message getExtension:[UnittestRoot defaultFloatExtension]] floatValue], 0.01);
1502 52e3, [[message getExtension:[UnittestRoot defaultDoubleExtension]] doubleValue], 0.01);
1503 XCTAssertTrue([[message getExtension:[UnittestRoot defaultBoolExtension]] boolValue]);
1504 XCTAssertEqualObjects(@"hello", [message getExtension:[UnittestRoot defaultStringExtension]]);
1506 [message getExtension:[UnittestRoot defaultBytesExtension]]);
1509 [[message getExtension:[UnittestRoot defaultNestedEnumExtension]] intValue]);
1511 [[message getExtension:[UnittestRoot defaultForeignEnumExtension]] intValue]);
1513 [[message getExtension:[UnittestRoot defaultImportEnumExtension]] intValue]);
1515 XCTAssertEqualObjects(@"abc", [message getExtension:[UnittestRoot defaultStringPieceExtension]]);
1516 XCTAssertEqualObjects(@"123", [message getExtension:[UnittestRoot defaultCordExtension]]);
1519 - (void)modifyRepeatedFields:(TestAllTypes *)message {
1520 [message.repeatedInt32Array replaceValueAtIndex:1 withValue:501];
1521 [message.repeatedInt64Array replaceValueAtIndex:1 withValue:502];
1522 [message.repeatedUint32Array replaceValueAtIndex:1 withValue:503];
1523 [message.repeatedUint64Array replaceValueAtIndex:1 withValue:504];
1524 [message.repeatedSint32Array replaceValueAtIndex:1 withValue:505];
1525 [message.repeatedSint64Array replaceValueAtIndex:1 withValue:506];
1526 [message.repeatedFixed32Array replaceValueAtIndex:1 withValue:507];
1527 [message.repeatedFixed64Array replaceValueAtIndex:1 withValue:508];
1528 [message.repeatedSfixed32Array replaceValueAtIndex:1 withValue:509];
1529 [message.repeatedSfixed64Array replaceValueAtIndex:1 withValue:510];
1530 [message.repeatedFloatArray replaceValueAtIndex:1 withValue:511];
1531 [message.repeatedDoubleArray replaceValueAtIndex:1 withValue:512];
1532 [message.repeatedBoolArray replaceValueAtIndex:1 withValue:YES];
1533 [message.repeatedStringArray replaceObjectAtIndex:1 withObject:@"515"];
1536 [message.repeatedBytesArray replaceObjectAtIndex:1 withObject:data];
1541 [message.repeatedGroupArray replaceObjectAtIndex:1 withObject:testAll];
1546 [message.repeatedNestedMessageArray replaceObjectAtIndex:1 withObject:nestedMessage];
1551 [message.repeatedForeignMessageArray replaceObjectAtIndex:1 withObject:foreignMessage];
1556 [message.repeatedImportMessageArray replaceObjectAtIndex:1 withObject:importMessage];
1559 [message.repeatedNestedEnumArray replaceValueAtIndex:1 withValue:TestAllTypes_NestedEnum_Foo];
1560 [message.repeatedForeignEnumArray replaceValueAtIndex:1 withValue:ForeignEnum_ForeignFoo];
1561 [message.repeatedImportEnumArray replaceValueAtIndex:1 withValue:ImportEnum_ImportFoo];
1563 [message.repeatedStringPieceArray replaceObjectAtIndex:1 withObject:@"524"];
1564 [message.repeatedCordArray replaceObjectAtIndex:1 withObject:@"525"];
1567 - (void)assertRepeatedFieldsModified:(TestAllTypes *)message repeatedCount:(uint32_t)count {
1572 XCTAssertEqual(count, message.repeatedInt32Array.count);
1573 XCTAssertEqual(count, message.repeatedInt64Array.count);
1574 XCTAssertEqual(count, message.repeatedUint32Array.count);
1575 XCTAssertEqual(count, message.repeatedUint64Array.count);
1576 XCTAssertEqual(count, message.repeatedSint32Array.count);
1577 XCTAssertEqual(count, message.repeatedSint64Array.count);
1578 XCTAssertEqual(count, message.repeatedFixed32Array.count);
1579 XCTAssertEqual(count, message.repeatedFixed64Array.count);
1580 XCTAssertEqual(count, message.repeatedSfixed32Array.count);
1581 XCTAssertEqual(count, message.repeatedSfixed64Array.count);
1582 XCTAssertEqual(count, message.repeatedFloatArray.count);
1583 XCTAssertEqual(count, message.repeatedDoubleArray.count);
1584 XCTAssertEqual(count, message.repeatedBoolArray.count);
1585 XCTAssertEqual(count, message.repeatedStringArray.count);
1586 XCTAssertEqual(count, message.repeatedBytesArray.count);
1588 XCTAssertEqual(count, message.repeatedGroupArray.count);
1589 XCTAssertEqual(count, message.repeatedNestedMessageArray.count);
1590 XCTAssertEqual(count, message.repeatedForeignMessageArray.count);
1591 XCTAssertEqual(count, message.repeatedImportMessageArray.count);
1592 XCTAssertEqual(count, message.repeatedNestedEnumArray.count);
1593 XCTAssertEqual(count, message.repeatedForeignEnumArray.count);
1594 XCTAssertEqual(count, message.repeatedImportEnumArray.count);
1596 XCTAssertEqual(count, message.repeatedStringPieceArray.count);
1597 XCTAssertEqual(count, message.repeatedCordArray.count);
1599 XCTAssertEqual(count, message.repeatedInt32Array_Count);
1600 XCTAssertEqual(count, message.repeatedInt64Array_Count);
1601 XCTAssertEqual(count, message.repeatedUint32Array_Count);
1602 XCTAssertEqual(count, message.repeatedUint64Array_Count);
1603 XCTAssertEqual(count, message.repeatedSint32Array_Count);
1604 XCTAssertEqual(count, message.repeatedSint64Array_Count);
1605 XCTAssertEqual(count, message.repeatedFixed32Array_Count);
1606 XCTAssertEqual(count, message.repeatedFixed64Array_Count);
1607 XCTAssertEqual(count, message.repeatedSfixed32Array_Count);
1608 XCTAssertEqual(count, message.repeatedSfixed64Array_Count);
1609 XCTAssertEqual(count, message.repeatedFloatArray_Count);
1610 XCTAssertEqual(count, message.repeatedDoubleArray_Count);
1611 XCTAssertEqual(count, message.repeatedBoolArray_Count);
1612 XCTAssertEqual(count, message.repeatedStringArray_Count);
1613 XCTAssertEqual(count, message.repeatedBytesArray_Count);
1615 XCTAssertEqual(count, message.repeatedGroupArray_Count);
1616 XCTAssertEqual(count, message.repeatedNestedMessageArray_Count);
1617 XCTAssertEqual(count, message.repeatedForeignMessageArray_Count);
1618 XCTAssertEqual(count, message.repeatedImportMessageArray_Count);
1619 XCTAssertEqual(count, message.repeatedNestedEnumArray_Count);
1620 XCTAssertEqual(count, message.repeatedForeignEnumArray_Count);
1621 XCTAssertEqual(count, message.repeatedImportEnumArray_Count);
1623 XCTAssertEqual(count, message.repeatedStringPieceArray_Count);
1624 XCTAssertEqual(count, message.repeatedCordArray_Count);
1626 XCTAssertEqual(201, [message.repeatedInt32Array valueAtIndex:0]);
1627 XCTAssertEqual(202LL, [message.repeatedInt64Array valueAtIndex:0]);
1628 XCTAssertEqual(203U, [message.repeatedUint32Array valueAtIndex:0]);
1629 XCTAssertEqual(204ULL, [message.repeatedUint64Array valueAtIndex:0]);
1630 XCTAssertEqual(205, [message.repeatedSint32Array valueAtIndex:0]);
1631 XCTAssertEqual(206LL, [message.repeatedSint64Array valueAtIndex:0]);
1632 XCTAssertEqual(207U, [message.repeatedFixed32Array valueAtIndex:0]);
1633 XCTAssertEqual(208ULL, [message.repeatedFixed64Array valueAtIndex:0]);
1634 XCTAssertEqual(209, [message.repeatedSfixed32Array valueAtIndex:0]);
1635 XCTAssertEqual(210LL, [message.repeatedSfixed64Array valueAtIndex:0]);
1636 XCTAssertEqualWithAccuracy(211.0f, [message.repeatedFloatArray valueAtIndex:0], 0.01);
1637 XCTAssertEqualWithAccuracy(212.0, [message.repeatedDoubleArray valueAtIndex:0], 0.01);
1638 XCTAssertFalse([message.repeatedBoolArray valueAtIndex:0]);
1639 XCTAssertEqualObjects(@"215", message.repeatedStringArray[0]);
1640 XCTAssertEqualObjects([NSData gpbtu_dataWithUint32:216], message.repeatedBytesArray[0]);
1642 XCTAssertEqual(217, ((TestAllTypes_RepeatedGroup *)message.repeatedGroupArray[0]).a);
1643 XCTAssertEqual(218, ((TestAllTypes_NestedMessage *)message.repeatedNestedMessageArray[0]).bb);
1644 XCTAssertEqual(219, ((ForeignMessage *)message.repeatedForeignMessageArray[0]).c);
1645 XCTAssertEqual(220, ((ImportMessage *)message.repeatedImportMessageArray[0]).d);
1647 XCTAssertEqual(TestAllTypes_NestedEnum_Baz, [message.repeatedNestedEnumArray valueAtIndex:0]);
1648 XCTAssertEqual(ForeignEnum_ForeignBaz, [message.repeatedForeignEnumArray valueAtIndex:0]);
1649 XCTAssertEqual(ImportEnum_ImportBaz, [message.repeatedImportEnumArray valueAtIndex:0]);
1651 XCTAssertEqualObjects(@"224", message.repeatedStringPieceArray[0]);
1652 XCTAssertEqualObjects(@"225", message.repeatedCordArray[0]);
1655 XCTAssertEqual(501, [message.repeatedInt32Array valueAtIndex:1]);
1656 XCTAssertEqual(502LL, [message.repeatedInt64Array valueAtIndex:1]);
1657 XCTAssertEqual(503U, [message.repeatedUint32Array valueAtIndex:1]);
1658 XCTAssertEqual(504ULL, [message.repeatedUint64Array valueAtIndex:1]);
1659 XCTAssertEqual(505, [message.repeatedSint32Array valueAtIndex:1]);
1660 XCTAssertEqual(506LL, [message.repeatedSint64Array valueAtIndex:1]);
1661 XCTAssertEqual(507U, [message.repeatedFixed32Array valueAtIndex:1]);
1662 XCTAssertEqual(508ULL, [message.repeatedFixed64Array valueAtIndex:1]);
1663 XCTAssertEqual(509, [message.repeatedSfixed32Array valueAtIndex:1]);
1664 XCTAssertEqual(510LL, [message.repeatedSfixed64Array valueAtIndex:1]);
1665 XCTAssertEqualWithAccuracy(511.0f, [message.repeatedFloatArray valueAtIndex:1], 0.01);
1666 XCTAssertEqualWithAccuracy(512.0, [message.repeatedDoubleArray valueAtIndex:1], 0.01);
1667 XCTAssertTrue([message.repeatedBoolArray valueAtIndex:1]);
1668 XCTAssertEqualObjects(@"515", message.repeatedStringArray[1]);
1669 XCTAssertEqualObjects([NSData gpbtu_dataWithUint32:516], message.repeatedBytesArray[1]);
1671 XCTAssertEqual(517, ((TestAllTypes_RepeatedGroup *)message.repeatedGroupArray[1]).a);
1672 XCTAssertEqual(518, ((TestAllTypes_NestedMessage *)message.repeatedNestedMessageArray[1]).bb);
1673 XCTAssertEqual(519, ((ForeignMessage *)message.repeatedForeignMessageArray[1]).c);
1674 XCTAssertEqual(520, ((ImportMessage *)message.repeatedImportMessageArray[1]).d);
1676 XCTAssertEqual(TestAllTypes_NestedEnum_Foo, [message.repeatedNestedEnumArray valueAtIndex:1]);
1677 XCTAssertEqual(ForeignEnum_ForeignFoo, [message.repeatedForeignEnumArray valueAtIndex:1]);
1678 XCTAssertEqual(ImportEnum_ImportFoo, [message.repeatedImportEnumArray valueAtIndex:1]);
1680 XCTAssertEqualObjects(@"524", message.repeatedStringPieceArray[1]);
1681 XCTAssertEqualObjects(@"525", message.repeatedCordArray[1]);
1684 - (void)setPackedFields:(TestPackedTypes *)message repeatedCount:(uint32_t)count {
1689 [message.packedInt32Array addValue:601 + i * 100];
1692 [message.packedInt64Array addValue:602 + i * 100];
1695 [message.packedUint32Array addValue:603 + i * 100];
1698 [message.packedUint64Array addValue:604 + i * 100];
1701 [message.packedSint32Array addValue:605 + i * 100];
1704 [message.packedSint64Array addValue:606 + i * 100];
1707 [message.packedFixed32Array addValue:607 + i * 100];
1710 [message.packedFixed64Array addValue:608 + i * 100];
1713 [message.packedSfixed32Array addValue:609 + i * 100];
1716 [message.packedSfixed64Array addValue:610 + i * 100];
1719 [message.packedFloatArray addValue:611 + i * 100];
1722 [message.packedDoubleArray addValue:612 + i * 100];
1725 [message.packedBoolArray addValue:(i % 2) ? YES : NO];
1728 [message.packedEnumArray addValue:(i % 2) ? ForeignEnum_ForeignBar : ForeignEnum_ForeignBaz];
1732 - (void)setUnpackedFields:(TestUnpackedTypes *)message repeatedCount:(uint32_t)count {
1737 [message.unpackedInt32Array addValue:601 + i * 100];
1740 [message.unpackedInt64Array addValue:602 + i * 100];
1743 [message.unpackedUint32Array addValue:603 + i * 100];
1746 [message.unpackedUint64Array addValue:604 + i * 100];
1749 [message.unpackedSint32Array addValue:605 + i * 100];
1752 [message.unpackedSint64Array addValue:606 + i * 100];
1755 [message.unpackedFixed32Array addValue:607 + i * 100];
1758 [message.unpackedFixed64Array addValue:608 + i * 100];
1761 [message.unpackedSfixed32Array addValue:609 + i * 100];
1764 [message.unpackedSfixed64Array addValue:610 + i * 100];
1767 [message.unpackedFloatArray addValue:611 + i * 100];
1770 [message.unpackedDoubleArray addValue:612 + i * 100];
1773 [message.unpackedBoolArray addValue:(i % 2) ? YES : NO];
1776 [message.unpackedEnumArray addValue:(i % 2) ? ForeignEnum_ForeignBar : ForeignEnum_ForeignBaz];
1780 - (void)assertPackedFieldsSet:(TestPackedTypes *)message repeatedCount:(uint32_t)count {
1781 XCTAssertEqual(count, message.packedInt32Array.count);
1782 XCTAssertEqual(count, message.packedInt64Array.count);
1783 XCTAssertEqual(count, message.packedUint32Array.count);
1784 XCTAssertEqual(count, message.packedUint64Array.count);
1785 XCTAssertEqual(count, message.packedSint32Array.count);
1786 XCTAssertEqual(count, message.packedSint64Array.count);
1787 XCTAssertEqual(count, message.packedFixed32Array.count);
1788 XCTAssertEqual(count, message.packedFixed64Array.count);
1789 XCTAssertEqual(count, message.packedSfixed32Array.count);
1790 XCTAssertEqual(count, message.packedSfixed64Array.count);
1791 XCTAssertEqual(count, message.packedFloatArray.count);
1792 XCTAssertEqual(count, message.packedDoubleArray.count);
1793 XCTAssertEqual(count, message.packedBoolArray.count);
1794 XCTAssertEqual(count, message.packedEnumArray.count);
1796 XCTAssertEqual((int)(601 + i * 100), [message.packedInt32Array valueAtIndex:i]);
1797 XCTAssertEqual(602 + i * 100, [message.packedInt64Array valueAtIndex:i]);
1798 XCTAssertEqual(603 + i * 100, [message.packedUint32Array valueAtIndex:i]);
1799 XCTAssertEqual(604 + i * 100, [message.packedUint64Array valueAtIndex:i]);
1800 XCTAssertEqual((int)(605 + i * 100), [message.packedSint32Array valueAtIndex:i]);
1801 XCTAssertEqual(606 + i * 100, [message.packedSint64Array valueAtIndex:i]);
1802 XCTAssertEqual(607 + i * 100, [message.packedFixed32Array valueAtIndex:i]);
1803 XCTAssertEqual(608 + i * 100, [message.packedFixed64Array valueAtIndex:i]);
1804 XCTAssertEqual((int)(609 + i * 100), [message.packedSfixed32Array valueAtIndex:i]);
1805 XCTAssertEqual(610 + i * 100, [message.packedSfixed64Array valueAtIndex:i]);
1806 XCTAssertEqualWithAccuracy(611 + i * 100, [message.packedFloatArray valueAtIndex:i], 0.01);
1807 XCTAssertEqualWithAccuracy(612 + i * 100, [message.packedDoubleArray valueAtIndex:i], 0.01);
1808 XCTAssertEqual((i % 2) ? YES : NO, [message.packedBoolArray valueAtIndex:i]);
1810 [message.packedEnumArray valueAtIndex:i]);
1814 - (void)setPackedExtensions:(TestPackedExtensions *)message repeatedCount:(uint32_t)count {
1819 [message addExtension:[UnittestRoot packedInt32Extension] value:@(601 + i * 100)];
1820 [message addExtension:[UnittestRoot packedInt64Extension] value:@(602 + i * 100)];
1821 [message addExtension:[UnittestRoot packedUint32Extension] value:@(603 + i * 100)];
1822 [message addExtension:[UnittestRoot packedUint64Extension] value:@(604 + i * 100)];
1823 [message addExtension:[UnittestRoot packedSint32Extension] value:@(605 + i * 100)];
1824 [message addExtension:[UnittestRoot packedSint64Extension] value:@(606 + i * 100)];
1825 [message addExtension:[UnittestRoot packedFixed32Extension] value:@(607 + i * 100)];
1826 [message addExtension:[UnittestRoot packedFixed64Extension] value:@(608 + i * 100)];
1827 [message addExtension:[UnittestRoot packedSfixed32Extension] value:@(609 + i * 100)];
1828 [message addExtension:[UnittestRoot packedSfixed64Extension] value:@(610 + i * 100)];
1829 [message addExtension:[UnittestRoot packedFloatExtension] value:@(611 + i * 100)];
1830 [message addExtension:[UnittestRoot packedDoubleExtension] value:@(612 + i * 100)];
1831 [message addExtension:[UnittestRoot packedBoolExtension] value:@((i % 2) ? YES : NO)];
1832 [message addExtension:[UnittestRoot packedEnumExtension]
1837 - (void)setUnpackedExtensions:(TestUnpackedExtensions *)message repeatedCount:(uint32_t)count {
1842 [message addExtension:[UnittestRoot unpackedInt32Extension] value:@(601 + i * 100)];
1843 [message addExtension:[UnittestRoot unpackedInt64Extension] value:@(602 + i * 100)];
1844 [message addExtension:[UnittestRoot unpackedUint32Extension] value:@(603 + i * 100)];
1845 [message addExtension:[UnittestRoot unpackedUint64Extension] value:@(604 + i * 100)];
1846 [message addExtension:[UnittestRoot unpackedSint32Extension] value:@(605 + i * 100)];
1847 [message addExtension:[UnittestRoot unpackedSint64Extension] value:@(606 + i * 100)];
1848 [message addExtension:[UnittestRoot unpackedFixed32Extension] value:@(607 + i * 100)];
1849 [message addExtension:[UnittestRoot unpackedFixed64Extension] value:@(608 + i * 100)];
1850 [message addExtension:[UnittestRoot unpackedSfixed32Extension] value:@(609 + i * 100)];
1851 [message addExtension:[UnittestRoot unpackedSfixed64Extension] value:@(610 + i * 100)];
1852 [message addExtension:[UnittestRoot unpackedFloatExtension] value:@(611 + i * 100)];
1853 [message addExtension:[UnittestRoot unpackedDoubleExtension] value:@(612 + i * 100)];
1854 [message addExtension:[UnittestRoot unpackedBoolExtension] value:@((i % 2) ? YES : NO)];
1855 [message addExtension:[UnittestRoot unpackedEnumExtension]
1860 - (void)assertPackedExtensionsSet:(TestPackedExtensions *)message repeatedCount:(uint32_t)count {
1861 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedInt32Extension]] count]);
1862 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedInt64Extension]] count]);
1863 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedUint32Extension]] count]);
1864 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedUint64Extension]] count]);
1865 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedSint32Extension]] count]);
1866 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedSint64Extension]] count]);
1867 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedFixed32Extension]] count]);
1868 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedFixed64Extension]] count]);
1869 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedSfixed32Extension]] count]);
1870 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedSfixed64Extension]] count]);
1871 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedFloatExtension]] count]);
1872 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedDoubleExtension]] count]);
1873 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedBoolExtension]] count]);
1874 XCTAssertEqual(count, [[message getExtension:[UnittestRoot packedEnumExtension]] count]);
1877 id extension = [message getExtension:[UnittestRoot packedInt32Extension]];
1879 extension = [message getExtension:[UnittestRoot packedInt64Extension]];
1881 extension = [message getExtension:[UnittestRoot packedUint32Extension]];
1883 extension = [message getExtension:[UnittestRoot packedUint64Extension]];
1885 extension = [message getExtension:[UnittestRoot packedSint32Extension]];
1887 extension = [message getExtension:[UnittestRoot packedSint64Extension]];
1889 extension = [message getExtension:[UnittestRoot packedFixed32Extension]];
1891 extension = [message getExtension:[UnittestRoot packedFixed64Extension]];
1893 extension = [message getExtension:[UnittestRoot packedSfixed32Extension]];
1895 extension = [message getExtension:[UnittestRoot packedSfixed64Extension]];
1897 extension = [message getExtension:[UnittestRoot packedFloatExtension]];
1899 extension = [message getExtension:[UnittestRoot packedDoubleExtension]];
1901 extension = [message getExtension:[UnittestRoot packedBoolExtension]];
1903 extension = [message getExtension:[UnittestRoot packedEnumExtension]];
1909 - (void)assertAllFieldsKVCMatch:(TestAllTypes *)message {
1910 XCTAssertEqualObjects([message valueForKey:@"hasOptionalInt32"], @YES);
1911 XCTAssertEqualObjects(@(message.optionalInt32), [message valueForKey:@"optionalInt32"]);
1912 XCTAssertEqualObjects([message valueForKey:@"hasOptionalInt64"], @YES);
1913 XCTAssertEqualObjects(@(message.optionalInt64), [message valueForKey:@"optionalInt64"]);
1914 XCTAssertEqualObjects([message valueForKey:@"hasOptionalUint32"], @YES);
1915 XCTAssertEqualObjects(@(message.optionalUint32), [message valueForKey:@"optionalUint32"]);
1916 XCTAssertEqualObjects([message valueForKey:@"hasOptionalUint64"], @YES);
1917 XCTAssertEqualObjects(@(message.optionalUint64), [message valueForKey:@"optionalUint64"]);
1918 XCTAssertEqualObjects([message valueForKey:@"hasOptionalSint32"], @YES);
1919 XCTAssertEqualObjects(@(message.optionalSint32), [message valueForKey:@"optionalSint32"]);
1920 XCTAssertEqualObjects([message valueForKey:@"hasOptionalSint64"], @YES);
1921 XCTAssertEqualObjects(@(message.optionalSint64), [message valueForKey:@"optionalSint64"]);
1922 XCTAssertEqualObjects([message valueForKey:@"hasOptionalFixed32"], @YES);
1923 XCTAssertEqualObjects(@(message.optionalFixed32), [message valueForKey:@"optionalFixed32"]);
1924 XCTAssertEqualObjects([message valueForKey:@"hasOptionalFixed64"], @YES);
1925 XCTAssertEqualObjects(@(message.optionalFixed64), [message valueForKey:@"optionalFixed64"]);
1926 XCTAssertEqualObjects([message valueForKey:@"hasOptionalSfixed32"], @YES);
1927 XCTAssertEqualObjects(@(message.optionalSfixed32), [message valueForKey:@"optionalSfixed32"]);
1928 XCTAssertEqualObjects([message valueForKey:@"hasOptionalSfixed64"], @YES);
1929 XCTAssertEqualObjects(@(message.optionalSfixed64), [message valueForKey:@"optionalSfixed64"]);
1930 XCTAssertEqualObjects([message valueForKey:@"hasOptionalFloat"], @YES);
1931 XCTAssertEqualObjects(@(message.optionalFloat), [message valueForKey:@"optionalFloat"]);
1932 XCTAssertEqualObjects([message valueForKey:@"hasOptionalDouble"], @YES);
1933 XCTAssertEqualObjects(@(message.optionalDouble), [message valueForKey:@"optionalDouble"]);
1934 XCTAssertEqualObjects([message valueForKey:@"hasOptionalBool"], @YES);
1935 XCTAssertEqualObjects(@(message.optionalBool), [message valueForKey:@"optionalBool"]);
1936 XCTAssertEqualObjects([message valueForKey:@"hasOptionalString"], @YES);
1937 XCTAssertEqualObjects(message.optionalString, [message valueForKey:@"optionalString"]);
1938 XCTAssertEqualObjects([message valueForKey:@"hasOptionalBytes"], @YES);
1939 XCTAssertEqualObjects(message.optionalBytes, [message valueForKey:@"optionalBytes"]);
1941 XCTAssertEqualObjects([message valueForKey:@"hasOptionalGroup"], @YES);
1942 XCTAssertNotNil(message.optionalGroup);
1943 XCTAssertEqualObjects([message valueForKeyPath:@"optionalGroup.hasA"], @YES);
1944 XCTAssertEqualObjects(@(message.optionalGroup.a), [message valueForKeyPath:@"optionalGroup.a"]);
1945 XCTAssertEqualObjects([message valueForKey:@"hasOptionalNestedMessage"], @YES);
1946 XCTAssertNotNil(message.optionalNestedMessage);
1947 XCTAssertEqualObjects([message valueForKeyPath:@"optionalNestedMessage.hasBb"], @YES);
1948 XCTAssertEqualObjects(@(message.optionalNestedMessage.bb),
1949 [message valueForKeyPath:@"optionalNestedMessage.bb"]);
1950 XCTAssertEqualObjects([message valueForKey:@"hasOptionalForeignMessage"], @YES);
1951 XCTAssertNotNil(message.optionalForeignMessage);
1952 XCTAssertEqualObjects([message valueForKeyPath:@"optionalForeignMessage.hasC"], @YES);
1953 XCTAssertEqualObjects(@(message.optionalForeignMessage.c),
1954 [message valueForKeyPath:@"optionalForeignMessage.c"]);
1955 XCTAssertEqualObjects([message valueForKey:@"hasOptionalImportMessage"], @YES);
1956 XCTAssertNotNil(message.optionalForeignMessage);
1957 XCTAssertEqualObjects([message valueForKeyPath:@"optionalImportMessage.hasD"], @YES);
1958 XCTAssertEqualObjects(@(message.optionalImportMessage.d),
1959 [message valueForKeyPath:@"optionalImportMessage.d"]);
1961 XCTAssertEqualObjects([message valueForKey:@"hasOptionalNestedEnum"], @YES);
1962 XCTAssertEqualObjects(@(message.optionalNestedEnum), [message valueForKey:@"optionalNestedEnum"]);
1963 XCTAssertEqualObjects([message valueForKey:@"hasOptionalForeignEnum"], @YES);
1964 XCTAssertEqualObjects(@(message.optionalForeignEnum),
1965 [message valueForKey:@"optionalForeignEnum"]);
1966 XCTAssertEqualObjects([message valueForKey:@"hasOptionalImportEnum"], @YES);
1967 XCTAssertEqualObjects(@(message.optionalImportEnum), [message valueForKey:@"optionalImportEnum"]);
1969 XCTAssertEqualObjects([message valueForKey:@"hasOptionalStringPiece"], @YES);
1970 XCTAssertEqualObjects(message.optionalStringPiece, [message valueForKey:@"optionalStringPiece"]);
1971 XCTAssertEqualObjects([message valueForKey:@"hasOptionalCord"], @YES);
1972 XCTAssertEqualObjects(message.optionalCord, [message valueForKey:@"optionalCord"]);
1978 XCTAssertEqualObjects(message.repeatedInt32Array, [message valueForKey:@"repeatedInt32Array"]);
1979 XCTAssertEqualObjects(message.repeatedInt64Array, [message valueForKey:@"repeatedInt64Array"]);
1980 XCTAssertEqualObjects(message.repeatedUint32Array, [message valueForKey:@"repeatedUint32Array"]);
1981 XCTAssertEqualObjects(message.repeatedUint64Array, [message valueForKey:@"repeatedUint64Array"]);
1982 XCTAssertEqualObjects(message.repeatedSint32Array, [message valueForKey:@"repeatedSint32Array"]);
1983 XCTAssertEqualObjects(message.repeatedSint64Array, [message valueForKey:@"repeatedSint64Array"]);
1984 XCTAssertEqualObjects(message.repeatedFixed32Array,
1985 [message valueForKey:@"repeatedFixed32Array"]);
1986 XCTAssertEqualObjects(message.repeatedFixed64Array,
1987 [message valueForKey:@"repeatedFixed64Array"]);
1988 XCTAssertEqualObjects(message.repeatedSfixed32Array,
1989 [message valueForKey:@"repeatedSfixed32Array"]);
1990 XCTAssertEqualObjects(message.repeatedSfixed64Array,
1991 [message valueForKey:@"repeatedSfixed64Array"]);
1992 XCTAssertEqualObjects(message.repeatedFloatArray, [message valueForKey:@"repeatedFloatArray"]);
1993 XCTAssertEqualObjects(message.repeatedDoubleArray, [message valueForKey:@"repeatedDoubleArray"]);
1994 XCTAssertEqualObjects(message.repeatedBoolArray, [message valueForKey:@"repeatedBoolArray"]);
1995 XCTAssertEqualObjects(message.repeatedStringArray, [message valueForKey:@"repeatedStringArray"]);
1996 XCTAssertEqualObjects(message.repeatedBytesArray, [message valueForKey:@"repeatedBytesArray"]);
1998 XCTAssertEqualObjects(message.repeatedGroupArray, [message valueForKey:@"repeatedGroupArray"]);
1999 XCTAssertEqualObjects(message.repeatedNestedMessageArray,
2000 [message valueForKey:@"repeatedNestedMessageArray"]);
2001 XCTAssertEqualObjects(message.repeatedForeignMessageArray,
2002 [message valueForKey:@"repeatedForeignMessageArray"]);
2003 XCTAssertEqualObjects(message.repeatedImportMessageArray,
2004 [message valueForKey:@"repeatedImportMessageArray"]);
2006 XCTAssertEqualObjects(message.repeatedNestedEnumArray,
2007 [message valueForKey:@"repeatedNestedEnumArray"]);
2008 XCTAssertEqualObjects(message.repeatedForeignEnumArray,
2009 [message valueForKey:@"repeatedForeignEnumArray"]);
2010 XCTAssertEqualObjects(message.repeatedImportEnumArray,
2011 [message valueForKey:@"repeatedImportEnumArray"]);
2013 XCTAssertEqualObjects(message.repeatedStringPieceArray,
2014 [message valueForKey:@"repeatedStringPieceArray"]);
2015 XCTAssertEqualObjects(message.repeatedCordArray, [message valueForKey:@"repeatedCordArray"]);
2017 XCTAssertEqualObjects(@(message.repeatedInt32Array_Count),
2018 [message valueForKey:@"repeatedInt32Array_Count"]);
2019 XCTAssertEqualObjects(@(message.repeatedInt64Array_Count),
2020 [message valueForKey:@"repeatedInt64Array_Count"]);
2021 XCTAssertEqualObjects(@(message.repeatedUint32Array_Count),
2022 [message valueForKey:@"repeatedUint32Array_Count"]);
2023 XCTAssertEqualObjects(@(message.repeatedUint64Array_Count),
2024 [message valueForKey:@"repeatedUint64Array_Count"]);
2025 XCTAssertEqualObjects(@(message.repeatedSint32Array_Count),
2026 [message valueForKey:@"repeatedSint32Array_Count"]);
2027 XCTAssertEqualObjects(@(message.repeatedSint64Array_Count),
2028 [message valueForKey:@"repeatedSint64Array_Count"]);
2029 XCTAssertEqualObjects(@(message.repeatedFixed32Array_Count),
2030 [message valueForKey:@"repeatedFixed32Array_Count"]);
2031 XCTAssertEqualObjects(@(message.repeatedFixed64Array_Count),
2032 [message valueForKey:@"repeatedFixed64Array_Count"]);
2033 XCTAssertEqualObjects(@(message.repeatedSfixed32Array_Count),
2034 [message valueForKey:@"repeatedSfixed32Array_Count"]);
2035 XCTAssertEqualObjects(@(message.repeatedSfixed64Array_Count),
2036 [message valueForKey:@"repeatedSfixed64Array_Count"]);
2037 XCTAssertEqualObjects(@(message.repeatedFloatArray_Count),
2038 [message valueForKey:@"repeatedFloatArray_Count"]);
2039 XCTAssertEqualObjects(@(message.repeatedDoubleArray_Count),
2040 [message valueForKey:@"repeatedDoubleArray_Count"]);
2041 XCTAssertEqualObjects(@(message.repeatedBoolArray_Count),
2042 [message valueForKey:@"repeatedBoolArray_Count"]);
2043 XCTAssertEqualObjects(@(message.repeatedStringArray_Count),
2044 [message valueForKey:@"repeatedStringArray_Count"]);
2045 XCTAssertEqualObjects(@(message.repeatedBytesArray_Count),
2046 [message valueForKey:@"repeatedBytesArray_Count"]);
2048 XCTAssertEqualObjects(@(message.repeatedGroupArray_Count),
2049 [message valueForKey:@"repeatedGroupArray_Count"]);
2050 XCTAssertEqualObjects(@(message.repeatedNestedMessageArray_Count),
2051 [message valueForKey:@"repeatedNestedMessageArray_Count"]);
2052 XCTAssertEqualObjects(@(message.repeatedForeignMessageArray_Count),
2053 [message valueForKey:@"repeatedForeignMessageArray_Count"]);
2054 XCTAssertEqualObjects(@(message.repeatedImportMessageArray_Count),
2055 [message valueForKey:@"repeatedImportMessageArray_Count"]);
2057 XCTAssertEqualObjects(@(message.repeatedNestedEnumArray_Count),
2058 [message valueForKey:@"repeatedNestedEnumArray_Count"]);
2059 XCTAssertEqualObjects(@(message.repeatedForeignEnumArray_Count),
2060 [message valueForKey:@"repeatedForeignEnumArray_Count"]);
2061 XCTAssertEqualObjects(@(message.repeatedImportEnumArray_Count),
2062 [message valueForKey:@"repeatedImportEnumArray_Count"]);
2064 XCTAssertEqualObjects(@(message.repeatedStringPieceArray_Count),
2065 [message valueForKey:@"repeatedStringPieceArray_Count"]);
2066 XCTAssertEqualObjects(@(message.repeatedCordArray_Count),
2067 [message valueForKey:@"repeatedCordArray_Count"]);
2071 XCTAssertEqualObjects([message valueForKey:@"hasDefaultInt32"], @YES);
2072 XCTAssertEqualObjects(@(message.defaultInt32), [message valueForKey:@"defaultInt32"]);
2073 XCTAssertEqualObjects([message valueForKey:@"hasDefaultInt64"], @YES);
2074 XCTAssertEqualObjects(@(message.defaultInt64), [message valueForKey:@"defaultInt64"]);
2075 XCTAssertEqualObjects([message valueForKey:@"hasDefaultUint32"], @YES);
2076 XCTAssertEqualObjects(@(message.defaultUint32), [message valueForKey:@"defaultUint32"]);
2077 XCTAssertEqualObjects([message valueForKey:@"hasDefaultUint64"], @YES);
2078 XCTAssertEqualObjects(@(message.defaultUint64), [message valueForKey:@"defaultUint64"]);
2079 XCTAssertEqualObjects([message valueForKey:@"hasDefaultSint32"], @YES);
2080 XCTAssertEqualObjects(@(message.defaultSint32), [message valueForKey:@"defaultSint32"]);
2081 XCTAssertEqualObjects([message valueForKey:@"hasDefaultSint64"], @YES);
2082 XCTAssertEqualObjects(@(message.defaultSint64), [message valueForKey:@"defaultSint64"]);
2083 XCTAssertEqualObjects([message valueForKey:@"hasDefaultFixed32"], @YES);
2084 XCTAssertEqualObjects(@(message.defaultFixed32), [message valueForKey:@"defaultFixed32"]);
2085 XCTAssertEqualObjects([message valueForKey:@"hasDefaultFixed64"], @YES);
2086 XCTAssertEqualObjects(@(message.defaultFixed64), [message valueForKey:@"defaultFixed64"]);
2087 XCTAssertEqualObjects([message valueForKey:@"hasDefaultSfixed32"], @YES);
2088 XCTAssertEqualObjects(@(message.defaultSfixed32), [message valueForKey:@"defaultSfixed32"]);
2089 XCTAssertEqualObjects([message valueForKey:@"hasDefaultSfixed64"], @YES);
2090 XCTAssertEqualObjects(@(message.defaultSfixed64), [message valueForKey:@"defaultSfixed64"]);
2091 XCTAssertEqualObjects([message valueForKey:@"hasDefaultFloat"], @YES);
2092 XCTAssertEqualObjects(@(message.defaultFloat), [message valueForKey:@"defaultFloat"]);
2093 XCTAssertEqualObjects([message valueForKey:@"hasDefaultDouble"], @YES);
2094 XCTAssertEqualObjects(@(message.defaultDouble), [message valueForKey:@"defaultDouble"]);
2095 XCTAssertEqualObjects([message valueForKey:@"hasDefaultBool"], @YES);
2096 XCTAssertEqualObjects(@(message.defaultBool), [message valueForKey:@"defaultBool"]);
2097 XCTAssertEqualObjects([message valueForKey:@"hasDefaultString"], @YES);
2098 XCTAssertEqualObjects(message.defaultString, [message valueForKey:@"defaultString"]);
2099 XCTAssertEqualObjects([message valueForKey:@"hasDefaultBytes"], @YES);
2100 XCTAssertEqualObjects(message.defaultBytes, [message valueForKey:@"defaultBytes"]);
2102 XCTAssertEqualObjects([message valueForKey:@"hasDefaultNestedEnum"], @YES);
2103 XCTAssertEqualObjects(@(message.defaultNestedEnum), [message valueForKey:@"defaultNestedEnum"]);
2104 XCTAssertEqualObjects([message valueForKey:@"hasDefaultForeignEnum"], @YES);
2105 XCTAssertEqualObjects(@(message.defaultForeignEnum), [message valueForKey:@"defaultForeignEnum"]);
2106 XCTAssertEqualObjects([message valueForKey:@"hasDefaultImportEnum"], @YES);
2107 XCTAssertEqualObjects(@(message.defaultImportEnum), [message valueForKey:@"defaultImportEnum"]);
2109 XCTAssertEqualObjects([message valueForKey:@"hasDefaultStringPiece"], @YES);
2110 XCTAssertEqualObjects(message.defaultStringPiece, [message valueForKey:@"defaultStringPiece"]);
2111 XCTAssertEqualObjects([message valueForKey:@"hasDefaultCord"], @YES);
2112 XCTAssertEqualObjects(message.defaultCord, [message valueForKey:@"defaultCord"]);
2115 - (void)setAllFieldsViaKVC:(TestAllTypes *)message repeatedCount:(uint32_t)count {
2116 [message setValue:@101 forKey:@"optionalInt32"];
2117 [message setValue:@102 forKey:@"optionalInt64"];
2118 [message setValue:@103 forKey:@"optionalUint32"];
2119 [message setValue:@104 forKey:@"optionalUint64"];
2120 [message setValue:@105 forKey:@"optionalSint32"];
2121 [message setValue:@106 forKey:@"optionalSint64"];
2122 [message setValue:@107 forKey:@"optionalFixed32"];
2123 [message setValue:@108 forKey:@"optionalFixed64"];
2124 [message setValue:@109 forKey:@"optionalSfixed32"];
2125 [message setValue:@110 forKey:@"optionalSfixed64"];
2126 [message setValue:@111 forKey:@"optionalFloat"];
2127 [message setValue:@112 forKey:@"optionalDouble"];
2128 [message setValue:@YES forKey:@"optionalBool"];
2129 [message setValue:@"115" forKey:@"optionalString"];
2130 [message setValue:[NSData gpbtu_dataWithEmbeddedNulls] forKey:@"optionalBytes"];
2132 TestAllTypes_OptionalGroup *allTypes = [TestAllTypes_OptionalGroup message];
2134 [message setValue:allTypes forKey:@"optionalGroup"];
2135 TestAllTypes_NestedMessage *nestedMessage = [TestAllTypes_NestedMessage message];
2137 [message setValue:nestedMessage forKey:@"optionalNestedMessage"];
2138 ForeignMessage *foreignMessage = [ForeignMessage message];
2140 [message setValue:foreignMessage forKey:@"optionalForeignMessage"];
2141 ImportMessage *importMessage = [ImportMessage message];
2143 [message setValue:importMessage forKey:@"optionalImportMessage"];
2145 [message setValue:@(TestAllTypes_NestedEnum_Baz) forKey:@"optionalNestedEnum"];
2146 [message setValue:@(ForeignEnum_ForeignBaz) forKey:@"optionalForeignEnum"];
2147 [message setValue:@(ImportEnum_ImportBaz) forKey:@"optionalImportEnum"];
2149 [message setValue:@"124" forKey:@"optionalStringPiece"];
2150 [message setValue:@"125" forKey:@"optionalCord"];
2159 [message setValue:scratch forKey:@"repeatedInt32Array"];
2166 [message setValue:scratch forKey:@"repeatedInt64Array"];
2173 [message setValue:scratch forKey:@"repeatedUint32Array"];
2180 [message setValue:scratch forKey:@"repeatedUint64Array"];
2187 [message setValue:scratch forKey:@"repeatedSint32Array"];
2194 [message setValue:scratch forKey:@"repeatedSint64Array"];
2201 [message setValue:scratch forKey:@"repeatedFixed32Array"];
2208 [message setValue:scratch forKey:@"repeatedFixed64Array"];
2215 [message setValue:scratch forKey:@"repeatedSfixed32Array"];
2222 [message setValue:scratch forKey:@"repeatedSfixed64Array"];
2229 [message setValue:scratch forKey:@"repeatedFloatArray"];
2236 [message setValue:scratch forKey:@"repeatedDoubleArray"];
2243 [message setValue:scratch forKey:@"repeatedBoolArray"];
2252 [message setValue:array forKey:@"repeatedStringArray"];
2261 [message setValue:array forKey:@"repeatedBytesArray"];
2271 [message setValue:array forKey:@"repeatedGroupArray"];
2281 [message setValue:array forKey:@"repeatedNestedMessageArray"];
2291 [message setValue:array forKey:@"repeatedForeignMessageArray"];
2301 [message setValue:array forKey:@"repeatedImportMessageArray"];
2310 [message setValue:scratch forKey:@"repeatedNestedEnumArray"];
2317 [message setValue:scratch forKey:@"repeatedForeignEnumArray"];
2324 [message setValue:scratch forKey:@"repeatedImportEnumArray"];
2333 [message setValue:array forKey:@"repeatedStringPieceArray"];
2342 [message setValue:array forKey:@"repeatedCordArray"];
2347 [message setValue:@401 forKey:@"defaultInt32"];
2348 [message setValue:@402 forKey:@"defaultInt64"];
2349 [message setValue:@403 forKey:@"defaultUint32"];
2350 [message setValue:@404 forKey:@"defaultUint64"];
2351 [message setValue:@405 forKey:@"defaultSint32"];
2352 [message setValue:@406 forKey:@"defaultSint64"];
2353 [message setValue:@407 forKey:@"defaultFixed32"];
2354 [message setValue:@408 forKey:@"defaultFixed64"];
2355 [message setValue:@409 forKey:@"defaultSfixed32"];
2356 [message setValue:@410 forKey:@"defaultSfixed64"];
2357 [message setValue:@411 forKey:@"defaultFloat"];
2358 [message setValue:@412 forKey:@"defaultDouble"];
2359 [message setValue:@NO forKey:@"defaultBool"];
2360 [message setValue:@"415" forKey:@"defaultString"];
2361 [message setValue:[NSData gpbtu_dataWithUint32:416] forKey:@"defaultBytes"];
2363 [message setValue:@(TestAllTypes_NestedEnum_Foo) forKey:@"defaultNestedEnum"];
2364 [message setValue:@(ForeignEnum_ForeignFoo) forKey:@"defaultForeignEnum"];
2365 [message setValue:@(ImportEnum_ImportFoo) forKey:@"defaultImportEnum"];
2367 [message setValue:@"424" forKey:@"defaultStringPiece"];
2368 [message setValue:@"425" forKey:@"defaultCord"];
2371 - (void)assertClearKVC:(TestAllTypes *)message {
2372 XCTAssertEqualObjects([message valueForKey:@"hasOptionalInt32"], @NO);
2373 XCTAssertEqualObjects([message valueForKey:@"hasOptionalInt64"], @NO);
2374 XCTAssertEqualObjects([message valueForKey:@"hasOptionalUint32"], @NO);
2375 XCTAssertEqualObjects([message valueForKey:@"hasOptionalUint64"], @NO);
2376 XCTAssertEqualObjects([message valueForKey:@"hasOptionalSint32"], @NO);
2377 XCTAssertEqualObjects([message valueForKey:@"hasOptionalSint64"], @NO);
2378 XCTAssertEqualObjects([message valueForKey:@"hasOptionalFixed32"], @NO);
2379 XCTAssertEqualObjects([message valueForKey:@"hasOptionalFixed64"], @NO);
2380 XCTAssertEqualObjects([message valueForKey:@"hasOptionalSfixed32"], @NO);
2381 XCTAssertEqualObjects([message valueForKey:@"hasOptionalSfixed64"], @NO);
2382 XCTAssertEqualObjects([message valueForKey:@"hasOptionalFloat"], @NO);
2383 XCTAssertEqualObjects([message valueForKey:@"hasOptionalDouble"], @NO);
2384 XCTAssertEqualObjects([message valueForKey:@"hasOptionalBool"], @NO);
2385 XCTAssertEqualObjects([message valueForKey:@"hasOptionalString"], @NO);
2386 XCTAssertEqualObjects([message valueForKey:@"hasOptionalBytes"], @NO);
2388 XCTAssertEqualObjects([message valueForKey:@"hasOptionalGroup"], @NO);
2389 XCTAssertEqualObjects([message valueForKey:@"hasOptionalNestedMessage"], @NO);
2390 XCTAssertEqualObjects([message valueForKey:@"hasOptionalForeignMessage"], @NO);
2391 XCTAssertEqualObjects([message valueForKey:@"hasOptionalImportMessage"], @NO);
2393 XCTAssertEqualObjects([message valueForKey:@"hasOptionalNestedEnum"], @NO);
2394 XCTAssertEqualObjects([message valueForKey:@"hasOptionalForeignEnum"], @NO);
2395 XCTAssertEqualObjects([message valueForKey:@"hasOptionalImportEnum"], @NO);
2397 XCTAssertEqualObjects([message valueForKey:@"hasOptionalStringPiece"], @NO);
2398 XCTAssertEqualObjects([message valueForKey:@"hasOptionalCord"], @NO);
2401 XCTAssertEqualObjects([message valueForKey:@"optionalInt32"], @0);
2402 XCTAssertEqualObjects([message valueForKey:@"optionalInt64"], @0);
2403 XCTAssertEqualObjects([message valueForKey:@"optionalUint32"], @0);
2404 XCTAssertEqualObjects([message valueForKey:@"optionalUint64"], @0);
2405 XCTAssertEqualObjects([message valueForKey:@"optionalSint32"], @0);
2406 XCTAssertEqualObjects([message valueForKey:@"optionalSint64"], @0);
2407 XCTAssertEqualObjects([message valueForKey:@"optionalFixed32"], @0);
2408 XCTAssertEqualObjects([message valueForKey:@"optionalFixed64"], @0);
2409 XCTAssertEqualObjects([message valueForKey:@"optionalSfixed32"], @0);
2410 XCTAssertEqualObjects([message valueForKey:@"optionalSfixed64"], @0);
2411 XCTAssertEqualObjects([message valueForKey:@"optionalFloat"], @0);
2412 XCTAssertEqualObjects([message valueForKey:@"optionalDouble"], @0);
2413 XCTAssertEqualObjects([message valueForKey:@"optionalBool"], @NO);
2414 XCTAssertEqualObjects([message valueForKey:@"optionalString"], @"");
2415 XCTAssertEqualObjects([message valueForKey:@"optionalBytes"], GPBEmptyNSData());
2418 XCTAssertNotNil([message valueForKeyPath:@"optionalGroup"]);
2419 XCTAssertNotNil([message valueForKeyPath:@"optionalNestedMessage"]);
2420 XCTAssertNotNil([message valueForKeyPath:@"optionalForeignMessage"]);
2421 XCTAssertNotNil([message valueForKeyPath:@"optionalImportMessage"]);
2422 XCTAssertEqualObjects([message valueForKeyPath:@"optionalGroup.hasA"], @NO);
2423 XCTAssertEqualObjects([message valueForKeyPath:@"optionalNestedMessage.hasBb"], @NO);
2424 XCTAssertEqualObjects([message valueForKeyPath:@"optionalForeignMessage.hasC"], @NO);
2425 XCTAssertEqualObjects([message valueForKeyPath:@"optionalImportMessage.hasD"], @NO);
2427 XCTAssertEqualObjects([message valueForKeyPath:@"optionalGroup.a"], @0);
2428 XCTAssertEqualObjects([message valueForKeyPath:@"optionalNestedMessage.bb"], @0);
2429 XCTAssertEqualObjects([message valueForKeyPath:@"optionalForeignMessage.c"], @0);
2430 XCTAssertEqualObjects([message valueForKeyPath:@"optionalImportMessage.d"], @0);
2433 XCTAssertEqualObjects([message valueForKey:@"optionalNestedEnum"],
2435 XCTAssertEqualObjects([message valueForKey:@"optionalForeignEnum"], @(ForeignEnum_ForeignFoo));
2436 XCTAssertEqualObjects([message valueForKey:@"optionalImportEnum"], @(ImportEnum_ImportFoo));
2438 XCTAssertEqualObjects([message valueForKey:@"optionalStringPiece"], @"");
2439 XCTAssertEqualObjects([message valueForKey:@"optionalCord"], @"");
2443 XCTAssertEqualObjects([message valueForKey:@"hasDefaultInt32"], @NO);
2444 XCTAssertEqualObjects([message valueForKey:@"hasDefaultInt64"], @NO);
2445 XCTAssertEqualObjects([message valueForKey:@"hasDefaultUint32"], @NO);
2446 XCTAssertEqualObjects([message valueForKey:@"hasDefaultUint64"], @NO);
2447 XCTAssertEqualObjects([message valueForKey:@"hasDefaultSint32"], @NO);
2448 XCTAssertEqualObjects([message valueForKey:@"hasDefaultSint64"], @NO);
2449 XCTAssertEqualObjects([message valueForKey:@"hasDefaultFixed32"], @NO);
2450 XCTAssertEqualObjects([message valueForKey:@"hasDefaultFixed64"], @NO);
2451 XCTAssertEqualObjects([message valueForKey:@"hasDefaultSfixed32"], @NO);
2452 XCTAssertEqualObjects([message valueForKey:@"hasDefaultSfixed64"], @NO);
2453 XCTAssertEqualObjects([message valueForKey:@"hasDefaultFloat"], @NO);
2454 XCTAssertEqualObjects([message valueForKey:@"hasDefaultDouble"], @NO);
2455 XCTAssertEqualObjects([message valueForKey:@"hasDefaultBool"], @NO);
2456 XCTAssertEqualObjects([message valueForKey:@"hasDefaultString"], @NO);
2457 XCTAssertEqualObjects([message valueForKey:@"hasDefaultBytes"], @NO);
2459 XCTAssertEqualObjects([message valueForKey:@"hasDefaultNestedEnum"], @NO);
2460 XCTAssertEqualObjects([message valueForKey:@"hasDefaultForeignEnum"], @NO);
2461 XCTAssertEqualObjects([message valueForKey:@"hasDefaultImportEnum"], @NO);
2463 XCTAssertEqualObjects([message valueForKey:@"hasDefaultStringPiece"], @NO);
2464 XCTAssertEqualObjects([message valueForKey:@"hasDefaultCord"], @NO);
2467 XCTAssertEqualObjects([message valueForKey:@"defaultInt32"], @41);
2468 XCTAssertEqualObjects([message valueForKey:@"defaultInt64"], @42);
2469 XCTAssertEqualObjects([message valueForKey:@"defaultUint32"], @43);
2470 XCTAssertEqualObjects([message valueForKey:@"defaultUint64"], @44);
2471 XCTAssertEqualObjects([message valueForKey:@"defaultSint32"], @-45);
2472 XCTAssertEqualObjects([message valueForKey:@"defaultSint64"], @46);
2473 XCTAssertEqualObjects([message valueForKey:@"defaultFixed32"], @47);
2474 XCTAssertEqualObjects([message valueForKey:@"defaultFixed64"], @48);
2475 XCTAssertEqualObjects([message valueForKey:@"defaultSfixed32"], @49);
2476 XCTAssertEqualObjects([message valueForKey:@"defaultSfixed64"], @-50);
2477 XCTAssertEqualObjects([message valueForKey:@"defaultFloat"], @51.5);
2478 XCTAssertEqualObjects([message valueForKey:@"defaultDouble"], @52e3);
2479 XCTAssertEqualObjects([message valueForKey:@"defaultBool"], @YES);
2480 XCTAssertEqualObjects([message valueForKey:@"defaultString"], @"hello");
2481 XCTAssertEqualObjects([message valueForKey:@"defaultBytes"],
2484 XCTAssertEqualObjects([message valueForKey:@"defaultNestedEnum"], @(TestAllTypes_NestedEnum_Bar));
2485 XCTAssertEqualObjects([message valueForKey:@"defaultForeignEnum"], @(ForeignEnum_ForeignBar));
2486 XCTAssertEqualObjects([message valueForKey:@"defaultImportEnum"], @(ImportEnum_ImportBar));
2488 XCTAssertEqualObjects([message valueForKey:@"defaultStringPiece"], @"abc");
2489 XCTAssertEqualObjects([message valueForKey:@"defaultCord"], @"123");