Lines Matching full:descriptor

38 #import "google/protobuf/Descriptor.pbobjc.h"
46 GPBDescriptor *testAllTypesDesc = [TestAllTypes descriptor];
47 GPBDescriptor *nestedMessageDesc = [TestAllTypes_NestedMessage descriptor];
54 GPBDescriptor *testAllTypesDesc = [TestAllTypes descriptor];
56 GPBDescriptor *nestedMessageDesc = [TestAllTypes_NestedMessage descriptor];
60 GPBDescriptor *descDesc = [GPBDescriptorProto descriptor];
62 GPBDescriptor *descExtRngDesc = [GPBDescriptorProto_ExtensionRange descriptor];
66 GPBDescriptor *pointDesc = [Point_Class descriptor];
68 GPBDescriptor *pointRectDesc = [Point_Rect descriptor];
73 GPBDescriptor *descriptor = [TestAllTypes descriptor];
77 [descriptor fieldWithName:@"optionalNestedEnum"];
80 [descriptor fieldWithNumber:21];
90 fieldDescriptorWithName = [descriptor fieldWithName:@"optionalForeignEnum"];
92 fieldDescriptorWithNumber = [descriptor fieldWithNumber:22];
102 fieldDescriptorWithName = [descriptor fieldWithName:@"optionalImportEnum"];
104 fieldDescriptorWithNumber = [descriptor fieldWithNumber:23];
114 fieldDescriptorWithName = [descriptor fieldWithName:@"optionalNestedMessage"];
116 fieldDescriptorWithNumber = [descriptor fieldWithNumber:18];
125 [descriptor fieldWithName:@"optionalForeignMessage"];
127 fieldDescriptorWithNumber = [descriptor fieldWithNumber:19];
135 fieldDescriptorWithName = [descriptor fieldWithName:@"optionalImportMessage"];
137 fieldDescriptorWithNumber = [descriptor fieldWithNumber:20];
145 XCTAssertNil([descriptor fieldWithName:@"NOT THERE"]);
146 XCTAssertNil([descriptor fieldWithNumber:9876543]);
150 GPBEnumDescriptor *descriptor = TestAllTypes_NestedEnum_EnumDescriptor();
152 NSString *enumName = [descriptor enumNameForValue:1];
156 [descriptor getValue:&value forEnumName:@"TestAllTypes_NestedEnum_Foo"]);
158 [descriptor getValue:NULL forEnumName:@"TestAllTypes_NestedEnum_Foo"]);
161 enumName = [descriptor enumNameForValue:2];
164 [descriptor getValue:&value forEnumName:@"TestAllTypes_NestedEnum_Bar"]);
167 enumName = [descriptor enumNameForValue:3];
170 [descriptor getValue:&value forEnumName:@"TestAllTypes_NestedEnum_Baz"]);
174 enumName = [descriptor textFormatNameForValue:1];
176 XCTAssertTrue([descriptor getValue:&value forEnumTextFormatName:@"FOO"]);
178 XCTAssertNil([descriptor textFormatNameForValue:99999]);
181 enumName = [descriptor enumNameForValue:0];
183 XCTAssertFalse([descriptor getValue:&value forEnumName:@"Unknown"]);
184 XCTAssertFalse([descriptor getValue:NULL forEnumName:@"Unknown"]);
185 XCTAssertFalse([descriptor getValue:&value
187 XCTAssertFalse([descriptor getValue:NULL
189 XCTAssertFalse([descriptor getValue:NULL forEnumTextFormatName:@"Unknown"]);
190 XCTAssertFalse([descriptor getValue:&value forEnumTextFormatName:@"Unknown"]);
194 GPBEnumDescriptor *descriptor = TestAllTypes_NestedEnum_EnumDescriptor();
196 XCTAssertEqual(descriptor.enumNameCount, 4U);
197 XCTAssertEqualObjects([descriptor getEnumNameForIndex:0],
199 XCTAssertEqualObjects([descriptor getEnumTextFormatNameForIndex:0], @"FOO");
200 XCTAssertEqualObjects([descriptor getEnumNameForIndex:1],
202 XCTAssertEqualObjects([descriptor getEnumTextFormatNameForIndex:1], @"BAR");
203 XCTAssertEqualObjects([descriptor getEnumNameForIndex:2],
205 XCTAssertEqualObjects([descriptor getEnumTextFormatNameForIndex:2], @"BAZ");
206 XCTAssertEqualObjects([descriptor getEnumNameForIndex:3],
208 XCTAssertEqualObjects([descriptor getEnumTextFormatNameForIndex:3], @"NEG");
212 GPBEnumDescriptor *descriptor = TestEnumWithDupValue_EnumDescriptor();
216 XCTAssertEqual(descriptor.enumNameCount, 5U);
218 enumName = [descriptor getEnumNameForIndex:0];
220 XCTAssertTrue([descriptor getValue:&value forEnumName:enumName]);
222 XCTAssertEqualObjects([descriptor getEnumTextFormatNameForIndex:0], @"FOO1");
224 enumName = [descriptor getEnumNameForIndex:1];
226 XCTAssertTrue([descriptor getValue:&value forEnumName:enumName]);
228 XCTAssertEqualObjects([descriptor getEnumTextFormatNameForIndex:1], @"BAR1");
230 enumName = [descriptor getEnumNameForIndex:2];
232 XCTAssertTrue([descriptor getValue:&value forEnumName:enumName]);
234 XCTAssertEqualObjects([descriptor getEnumTextFormatNameForIndex:2], @"BAZ");
236 enumName = [descriptor getEnumNameForIndex:3];
238 XCTAssertTrue([descriptor getValue:&value forEnumName:enumName]);
240 XCTAssertEqualObjects([descriptor getEnumTextFormatNameForIndex:3], @"FOO2");
242 enumName = [descriptor getEnumNameForIndex:4];
244 XCTAssertTrue([descriptor getValue:&value forEnumName:enumName]);
246 XCTAssertEqualObjects([descriptor getEnumTextFormatNameForIndex:4], @"BAR2");
250 GPBEnumDescriptor *descriptor = TestEnumObjCNameCollision_EnumDescriptor();
254 XCTAssertEqual(descriptor.enumNameCount, 5U);
256 XCTAssertEqualObjects([descriptor getEnumNameForIndex:0], @"TestEnumObjCNameCollision_Foo");
257 textFormatName = [descriptor getEnumTextFormatNameForIndex:0];
259 XCTAssertTrue([descriptor getValue:&value forEnumTextFormatName:textFormatName]);
262 XCTAssertEqualObjects([descriptor getEnumNameForIndex:1], @"TestEnumObjCNameCollision_Foo");
263 textFormatName = [descriptor getEnumTextFormatNameForIndex:1];
265 XCTAssertTrue([descriptor getValue:&value forEnumTextFormatName:textFormatName]);
268 XCTAssertEqualObjects([descriptor getEnumNameForIndex:2], @"TestEnumObjCNameCollision_Bar");
269 textFormatName = [descriptor getEnumTextFormatNameForIndex:2];
271 XCTAssertTrue([descriptor getValue:&value forEnumTextFormatName:textFormatName]);
274 XCTAssertEqualObjects([descriptor getEnumNameForIndex:3], @"TestEnumObjCNameCollision_Mumble");
275 textFormatName = [descriptor getEnumTextFormatNameForIndex:3];
277 XCTAssertTrue([descriptor getValue:&value forEnumTextFormatName:textFormatName]);
280 XCTAssertEqualObjects([descriptor getEnumNameForIndex:4], @"TestEnumObjCNameCollision_Mumble");
281 textFormatName = [descriptor getEnumTextFormatNameForIndex:4];
283 XCTAssertTrue([descriptor getValue:&value forEnumTextFormatName:textFormatName]);
288 GPBDescriptor *descriptor = [TestAllTypes descriptor];
290 [descriptor fieldWithName:@"optionalNestedEnum"];
305 GPBDescriptor *descriptor = [TestOneof2 descriptor];
308 XCTAssertEqual(descriptor.fields.count, 17U);
311 XCTAssertEqual(descriptor.oneofs.count, 2U);
314 [descriptor fieldWithNumber:TestOneof2_FieldNumber_FooString];
317 [descriptor fieldWithNumber:TestOneof2_FieldNumber_BarString];
322 GPBOneofDescriptor *oneofFoo = [descriptor oneofWithName:@"foo"];
331 GPBOneofDescriptor *oneofBar = [descriptor oneofWithName:@"bar"];
342 XCTAssertNil([descriptor oneofWithName:@"mumble"]);
343 XCTAssertNil([descriptor oneofWithName:@"Foo"]);
362 [descriptor fieldWithNumber:TestOneof2_FieldNumber_BazString];
373 GPBExtensionDescriptor *descriptor = [UnittestRoot optionalInt32Extension];
374 XCTAssertNotNil(descriptor);
375 XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
376 XCTAssertFalse(descriptor.isPackable);
377 XCTAssertEqualObjects(descriptor.defaultValue, @0);
378 XCTAssertNil(descriptor.enumDescriptor);
380 descriptor = [UnittestRoot defaultInt32Extension];
381 XCTAssertNotNil(descriptor);
382 XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
383 XCTAssertFalse(descriptor.isPackable);
384 XCTAssertEqualObjects(descriptor.defaultValue, @41);
385 XCTAssertNil(descriptor.enumDescriptor);
389 descriptor = [UnittestRoot optionalNestedEnumExtension];
390 XCTAssertNotNil(descriptor);
391 XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
392 XCTAssertFalse(descriptor.isPackable);
393 XCTAssertEqual(descriptor.defaultValue, @1);
394 XCTAssertEqualObjects(descriptor.enumDescriptor.name, @"TestAllTypes_NestedEnum");
396 descriptor = [UnittestRoot defaultNestedEnumExtension];
397 XCTAssertNotNil(descriptor);
398 XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
399 XCTAssertFalse(descriptor.isPackable);
400 XCTAssertEqual(descriptor.defaultValue, @2);
401 XCTAssertEqualObjects(descriptor.enumDescriptor.name, @"TestAllTypes_NestedEnum");
405 descriptor = [UnittestRoot optionalNestedMessageExtension];
406 XCTAssertNotNil(descriptor);
407 XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
408 XCTAssertFalse(descriptor.isPackable);
409 XCTAssertNil(descriptor.defaultValue);
410 XCTAssertNil(descriptor.enumDescriptor);
414 descriptor = [UnittestRoot repeatedInt32Extension];
415 XCTAssertNotNil(descriptor);
416 XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
417 XCTAssertFalse(descriptor.isPackable);
418 XCTAssertNil(descriptor.defaultValue);
419 XCTAssertNil(descriptor.enumDescriptor);
421 descriptor = [UnittestRoot packedInt32Extension];
422 XCTAssertNotNil(descriptor);
423 XCTAssertEqual(descriptor.containingMessageClass, packedMsgClass); // ptr equality
424 XCTAssertTrue(descriptor.isPackable);
425 XCTAssertNil(descriptor.defaultValue);
426 XCTAssertNil(descriptor.enumDescriptor);
430 descriptor = [UnittestRoot repeatedNestedEnumExtension];
431 XCTAssertNotNil(descriptor);
432 XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
433 XCTAssertFalse(descriptor.isPackable);
434 XCTAssertNil(descriptor.defaultValue);
435 XCTAssertEqualObjects(descriptor.enumDescriptor.name, @"TestAllTypes_NestedEnum");
437 descriptor = [UnittestRoot packedEnumExtension];
438 XCTAssertNotNil(descriptor);
439 XCTAssertEqual(descriptor.containingMessageClass, packedMsgClass); // ptr equality
440 XCTAssertTrue(descriptor.isPackable);
441 XCTAssertNil(descriptor.defaultValue);
442 XCTAssertEqualObjects(descriptor.enumDescriptor.name, @"ForeignEnum");
446 descriptor = [UnittestRoot repeatedNestedMessageExtension];
447 XCTAssertNotNil(descriptor);
448 XCTAssertEqual(descriptor.containingMessageClass, msgClass); // ptr equality
449 XCTAssertFalse(descriptor.isPackable);
450 XCTAssertNil(descriptor.defaultValue);
451 XCTAssertNil(descriptor.enumDescriptor);