• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Protocol Buffers - Google's data interchange format
2// Copyright 2008 Google Inc.  All rights reserved.
3//
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file or at
6// https://developers.google.com/open-source/licenses/bsd
7
8// Author: kenton@google.com (Kenton Varda)
9//  Based on original Protocol Buffers design by
10//  Sanjay Ghemawat, Jeff Dean, and others.
11//
12// A proto file we will use for unit testing. See comments in
13// edition_message_unittest.cc before adding new features.
14//
15// LINT: ALLOW_GROUPS, LEGACY_NAMES
16
17edition = "2023";
18
19import "google/protobuf/cpp_features.proto";
20
21option features.field_presence = EXPLICIT;
22option features.enum_type = CLOSED;
23option features.(pb.cpp).string_type = VIEW;
24
25// Some generic_services option(s) added automatically.
26// See:  http://go/proto2-generic-services-default
27option cc_generic_services = true;     // auto-added
28option java_generic_services = true;   // auto-added
29option py_generic_services = true;     // auto-added
30option cc_enable_arenas = true;
31
32import "google/protobuf/unittest_import.proto";
33
34// We don't put this in a package within proto2 because we need to make sure
35// that the generated code doesn't depend on being in the proto2 namespace.
36// In test_util.h we do "using namespace unittest = edition_unittest".
37package edition_unittest;
38
39// Protos optimized for SPEED use a strict superset of the generated code
40// of equivalent ones optimized for CODE_SIZE, so we should optimize all our
41// tests for speed unless explicitly testing code size optimization.
42option optimize_for = SPEED;
43
44// This proto includes every type of field in both singular and repeated
45// forms.
46message TestAllTypes {
47  message NestedMessage {
48    // The field name "b" fails to compile in proto1 because it conflicts with
49    // a local variable named "b" in one of the generated methods.  Doh.
50    // This file needs to compile in proto1 to test backwards-compatibility.
51    int32 bb = 1;
52  }
53
54  enum NestedEnum {
55    FOO = 1;
56    BAR = 2;
57    BAZ = 3;
58    NEG = -1;  // Intentionally negative.
59  }
60
61  // Singular
62  int32 optional_int32       =  1;
63  int64 optional_int64       =  2;
64  uint32 optional_uint32     =  3;
65  uint64 optional_uint64     =  4;
66  sint32 optional_sint32     =  5;
67  sint64 optional_sint64     =  6;
68  fixed32 optional_fixed32   =  7;
69  fixed64 optional_fixed64   =  8;
70  sfixed32 optional_sfixed32 =  9;
71  sfixed64 optional_sfixed64 = 10;
72  float optional_float       = 11;
73  double optional_double     = 12;
74  bool optional_bool         = 13;
75  string optional_string     = 14;
76  bytes optional_bytes       = 15;
77
78  message OptionalGroup {
79    int32 a = 17;
80  }
81  OptionalGroup optionalgroup = 16
82      [features.message_encoding = DELIMITED];
83
84  NestedMessage                        optional_nested_message  = 18;
85  ForeignMessage                       optional_foreign_message = 19;
86  protobuf_unittest_import.ImportMessage optional_import_message  = 20;
87
88  NestedEnum                           optional_nested_enum     = 21;
89  ForeignEnum                          optional_foreign_enum    = 22;
90  protobuf_unittest_import.ImportEnum    optional_import_enum     = 23;
91
92  string optional_string_piece = 24 [ctype=STRING_PIECE];
93  string optional_cord = 25 [ctype=CORD];
94  bytes optional_bytes_cord = 86 [ctype=CORD];
95
96  // Defined in unittest_import_public.proto
97  protobuf_unittest_import.PublicImportMessage
98      optional_public_import_message = 26;
99
100  NestedMessage optional_lazy_message = 27 [lazy=true];
101  NestedMessage optional_unverified_lazy_message = 28 [unverified_lazy=true];
102
103  // Repeated
104  repeated    int32 repeated_int32    = 31;
105  repeated    int64 repeated_int64    = 32;
106  repeated   uint32 repeated_uint32   = 33;
107  repeated   uint64 repeated_uint64   = 34;
108  repeated   sint32 repeated_sint32   = 35;
109  repeated   sint64 repeated_sint64   = 36;
110  repeated  fixed32 repeated_fixed32  = 37;
111  repeated  fixed64 repeated_fixed64  = 38;
112  repeated sfixed32 repeated_sfixed32 = 39;
113  repeated sfixed64 repeated_sfixed64 = 40;
114  repeated    float repeated_float    = 41;
115  repeated   double repeated_double   = 42;
116  repeated     bool repeated_bool     = 43;
117  repeated   string repeated_string   = 44;
118  repeated    bytes repeated_bytes    = 45;
119
120  message RepeatedGroup {
121    int32 a = 47;
122  }
123  repeated RepeatedGroup repeatedgroup = 46
124      [features.message_encoding = DELIMITED];
125
126  repeated NestedMessage                        repeated_nested_message  = 48;
127  repeated ForeignMessage                       repeated_foreign_message = 49;
128  repeated protobuf_unittest_import.ImportMessage repeated_import_message  = 50;
129
130  repeated NestedEnum                           repeated_nested_enum     = 51;
131  repeated ForeignEnum                          repeated_foreign_enum    = 52;
132  repeated protobuf_unittest_import.ImportEnum    repeated_import_enum     = 53;
133
134  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
135  repeated string repeated_cord = 55 [ctype=CORD];
136
137  repeated NestedMessage repeated_lazy_message = 57 ;
138
139  // Singular with defaults
140  int32 default_int32       = 61 [default =  41    ];
141  int64 default_int64       = 62 [default =  42    ];
142  uint32 default_uint32     = 63 [default =  43    ];
143  uint64 default_uint64     = 64 [default =  44    ];
144  sint32 default_sint32     = 65 [default = -45    ];
145  sint64 default_sint64     = 66 [default =  46    ];
146  fixed32 default_fixed32   = 67 [default =  47    ];
147  fixed64 default_fixed64   = 68 [default =  48    ];
148  sfixed32 default_sfixed32 = 69 [default =  49    ];
149  sfixed64 default_sfixed64 = 70 [default = -50    ];
150  float default_float       = 71 [default =  51.5  ];
151  double default_double     = 72 [default =  52e3  ];
152  bool default_bool         = 73 [default = true   ];
153  string default_string     = 74 [default = "hello"];
154  bytes default_bytes       = 75 [default = "world"];
155
156  NestedEnum  default_nested_enum  = 81 [default = BAR        ];
157  ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR];
158  protobuf_unittest_import.ImportEnum
159      default_import_enum = 83 [default = IMPORT_BAR];
160
161  string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
162  string default_cord = 85 [ctype=CORD,default="123"];
163
164  // For oneof test
165  oneof oneof_field {
166    uint32 oneof_uint32 = 111;
167    NestedMessage oneof_nested_message = 112;
168    string oneof_string = 113;
169    bytes oneof_bytes = 114;
170    string oneof_cord = 115 [ctype=CORD];
171    string oneof_string_piece = 116 [ctype=STRING_PIECE];
172    NestedMessage oneof_lazy_nested_message = 117 [lazy=true];
173  }
174}
175
176// This proto includes a recursively nested message.
177message NestedTestAllTypes {
178  NestedTestAllTypes child = 1;
179  TestAllTypes payload = 2;
180  repeated NestedTestAllTypes repeated_child = 3;
181  NestedTestAllTypes lazy_child = 4 [lazy=true];
182  TestAllTypes eager_child = 5 [lazy=false];
183}
184
185message TestDeprecatedFields {
186  int32 deprecated_int32 = 1 [deprecated=true];
187  repeated string deprecated_repeated_string = 4 [deprecated=true];
188  TestAllTypes.NestedMessage deprecated_message = 3 [deprecated=true];
189  oneof oneof_fields {
190    int32 deprecated_int32_in_oneof = 2 [deprecated=true];
191  }
192  TestDeprecatedFields nested = 5;
193}
194
195message TestDeprecatedMessage {
196  option deprecated = true;
197}
198
199// Define these after TestAllTypes to make sure the compiler can handle that.
200message ForeignMessage {
201  int32 c = 1;
202  int32 d = 2;
203}
204
205enum ForeignEnum {
206  FOREIGN_FOO = 4;
207  FOREIGN_BAR = 5;
208  FOREIGN_BAZ = 6;
209  FOREIGN_BAX = 32;  // (1 << 32) to generate a 64b bitmask would be incorrect.
210}
211
212message TestReservedFields {
213  reserved 2, 15, 9 to 11;
214  reserved bar, baz;
215}
216
217enum TestReservedEnumFields {
218  UNKNOWN = 0;
219  reserved 2, 15, 9 to 11;
220  reserved bar, baz;
221}
222
223message TestAllExtensions {
224  extensions 1 to max;
225}
226
227  message OptionalGroup_extension {
228    int32 a = 17;
229  }
230
231  message RepeatedGroup_extension {
232    int32 a = 47;
233  }
234
235extend TestAllExtensions {
236  // Singular
237  int32 optional_int32_extension       =  1;
238  int64 optional_int64_extension       =  2;
239  uint32 optional_uint32_extension     =  3;
240  uint64 optional_uint64_extension     =  4;
241  sint32 optional_sint32_extension     =  5;
242  sint64 optional_sint64_extension     =  6;
243  fixed32 optional_fixed32_extension   =  7;
244  fixed64 optional_fixed64_extension   =  8;
245  sfixed32 optional_sfixed32_extension =  9;
246  sfixed64 optional_sfixed64_extension = 10;
247  float optional_float_extension       = 11;
248  double optional_double_extension     = 12;
249  bool optional_bool_extension         = 13;
250  string optional_string_extension     = 14;
251  bytes optional_bytes_extension       = 15;
252
253  OptionalGroup_extension optionalgroup_extension = 16
254      [features.message_encoding = DELIMITED];
255
256  TestAllTypes.NestedMessage optional_nested_message_extension = 18;
257  ForeignMessage optional_foreign_message_extension = 19;
258  protobuf_unittest_import.ImportMessage
259    optional_import_message_extension = 20;
260
261  TestAllTypes.NestedEnum optional_nested_enum_extension = 21;
262  ForeignEnum optional_foreign_enum_extension = 22;
263  protobuf_unittest_import.ImportEnum
264    optional_import_enum_extension = 23;
265
266  string optional_string_piece_extension = 24 [ctype=STRING_PIECE];
267  // TODO: ctype=CORD is not supported for extension. Add
268  // ctype=CORD option back after it is supported.
269  string optional_cord_extension = 25;
270  bytes optional_bytes_cord_extension = 86;
271
272  protobuf_unittest_import.PublicImportMessage
273    optional_public_import_message_extension = 26;
274
275  TestAllTypes.NestedMessage
276    optional_lazy_message_extension = 27 [lazy=true];
277  TestAllTypes.NestedMessage
278    optional_unverified_lazy_message_extension = 28 [unverified_lazy=true];
279
280  // Repeated
281  repeated    int32 repeated_int32_extension    = 31;
282  repeated    int64 repeated_int64_extension    = 32;
283  repeated   uint32 repeated_uint32_extension   = 33;
284  repeated   uint64 repeated_uint64_extension   = 34;
285  repeated   sint32 repeated_sint32_extension   = 35;
286  repeated   sint64 repeated_sint64_extension   = 36;
287  repeated  fixed32 repeated_fixed32_extension  = 37;
288  repeated  fixed64 repeated_fixed64_extension  = 38;
289  repeated sfixed32 repeated_sfixed32_extension = 39;
290  repeated sfixed64 repeated_sfixed64_extension = 40;
291  repeated    float repeated_float_extension    = 41;
292  repeated   double repeated_double_extension   = 42;
293  repeated     bool repeated_bool_extension     = 43;
294  repeated   string repeated_string_extension   = 44;
295  repeated    bytes repeated_bytes_extension    = 45;
296
297  repeated RepeatedGroup_extension repeatedgroup_extension = 46
298      [features.message_encoding = DELIMITED];
299
300  repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48;
301  repeated ForeignMessage repeated_foreign_message_extension = 49;
302  repeated protobuf_unittest_import.ImportMessage
303    repeated_import_message_extension = 50;
304
305  repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51;
306  repeated ForeignEnum repeated_foreign_enum_extension = 52;
307  repeated protobuf_unittest_import.ImportEnum
308    repeated_import_enum_extension = 53;
309
310  repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE];
311  // TODO: ctype=CORD is not supported for extension. Add
312  // ctype=CORD option back after it is supported.
313  repeated string repeated_cord_extension = 55;
314
315  repeated TestAllTypes.NestedMessage
316    repeated_lazy_message_extension = 57 [lazy=true];
317
318  // Singular with defaults
319  int32 default_int32_extension       = 61 [default =  41    ];
320  int64 default_int64_extension       = 62 [default =  42    ];
321  uint32 default_uint32_extension     = 63 [default =  43    ];
322  uint64 default_uint64_extension     = 64 [default =  44    ];
323  sint32 default_sint32_extension     = 65 [default = -45    ];
324  sint64 default_sint64_extension     = 66 [default =  46    ];
325  fixed32 default_fixed32_extension   = 67 [default =  47    ];
326  fixed64 default_fixed64_extension   = 68 [default =  48    ];
327  sfixed32 default_sfixed32_extension = 69 [default =  49    ];
328  sfixed64 default_sfixed64_extension = 70 [default = -50    ];
329  float default_float_extension       = 71 [default =  51.5  ];
330  double default_double_extension     = 72 [default =  52e3  ];
331  bool default_bool_extension         = 73 [default = true   ];
332  string default_string_extension     = 74 [default = "hello"];
333  bytes default_bytes_extension       = 75 [default = "world"];
334
335  TestAllTypes.NestedEnum
336    default_nested_enum_extension = 81 [default = BAR];
337  ForeignEnum
338    default_foreign_enum_extension = 82 [default = FOREIGN_BAR];
339  protobuf_unittest_import.ImportEnum
340    default_import_enum_extension = 83 [default = IMPORT_BAR];
341
342  string default_string_piece_extension = 84
343      [ctype=STRING_PIECE, default="abc"];
344  // TODO: ctype=CORD is not supported for extension. Add
345  // ctype=CORD option back after it is supported.
346  string default_cord_extension = 85 [default="123"];
347
348  // For oneof test
349  uint32 oneof_uint32_extension = 111;
350  TestAllTypes.NestedMessage oneof_nested_message_extension = 112;
351  string oneof_string_extension = 113;
352  bytes oneof_bytes_extension = 114;
353}
354
355message TestMixedFieldsAndExtensions {
356  int32 a = 1;
357  repeated fixed32 b = 3;
358  extensions 2, 4;
359  extend TestMixedFieldsAndExtensions {
360    int32 c = 2;
361    repeated fixed32 d = 4;
362  }
363}
364
365message TestGroup {
366  message OptionalGroup {
367    int32 a = 17;
368    int32 zz = 89;  // fast table size must be at least 16, for this
369                    // field to be parsed by the fast parser, since
370                    // 89 - 17 = 72 is a multiple of 8.
371  }
372  OptionalGroup optionalgroup = 16 [features.message_encoding = DELIMITED];
373  ForeignEnum optional_foreign_enum = 22;
374}
375
376message TestGroupExtension {
377  extensions 1 to max;
378}
379
380message TestNestedExtension {
381  extend TestAllExtensions {
382    // Check for bug where string extensions declared in tested scope did not
383    // compile.
384    string test = 1002 [default="test"];
385    // Used to test if generated extension name is correct when there are
386    // underscores.
387    string nested_string_extension = 1003;
388  }
389
390    message OptionalGroup_extension {
391      int32 a = 17;
392    }
393  extend TestGroupExtension {
394    OptionalGroup_extension optionalgroup_extension = 16
395        [features.message_encoding = DELIMITED];
396    ForeignEnum optional_foreign_enum_extension = 22;
397  }
398}
399
400message TestChildExtension {
401  string a = 1;
402  string b = 2;
403  TestAllExtensions optional_extension = 3;
404}
405
406// Emulates wireformat data of TestChildExtension with dynamic extension
407// (DynamicExtension).
408message TestChildExtensionData {
409  message NestedTestAllExtensionsData {
410    message NestedDynamicExtensions {
411      int32 a = 1;
412      int32 b = 2;
413    }
414    NestedDynamicExtensions dynamic = 409707008;
415  }
416  string a = 1;
417  string b = 2;
418  NestedTestAllExtensionsData optional_extension = 3;
419}
420
421message TestNestedChildExtension {
422  int32 a = 1;
423  TestChildExtension child = 2;
424}
425
426// Emulates wireformat data of TestNestedChildExtension with dynamic extension
427// (DynamicExtension).
428message TestNestedChildExtensionData {
429  int32 a = 1;
430  TestChildExtensionData child = 2;
431}
432
433// Required and closed enum fields are considered unknown fields if the value is
434// not valid. We need to make sure it functions as expected.
435message TestRequiredEnum {
436  ForeignEnum required_enum = 1 [features.field_presence = LEGACY_REQUIRED];
437
438  // A dummy optional field.
439  int32 a = 2;
440}
441
442// TestRequiredEnum + using enum values that won't fit to 64 bitmask.
443message TestRequiredEnumNoMask {
444  enum NestedEnum {
445    UNSPECIFIED = 0;
446    FOO = 2;
447    BAR = 100;
448    BAZ = -1;  // Intentionally negative.
449  }
450
451  NestedEnum required_enum = 1 [features.field_presence = LEGACY_REQUIRED];
452
453  // A dummy optional field.
454  int32 a = 2;
455}
456
457message TestRequiredEnumMulti {
458  enum NestedEnum {
459    UNSPECIFIED = 0;
460    FOO = 1;
461    BAR = 2;
462    BAZ = 100;
463  }
464
465  // Intentionally placed in descending field number to force sorting in closed
466  // enum verification.
467  NestedEnum required_enum_4 = 4 [features.field_presence = LEGACY_REQUIRED];
468  int32 a_3 = 3;
469  NestedEnum required_enum_2 = 2 [features.field_presence = LEGACY_REQUIRED];
470  ForeignEnum required_enum_1 = 1 [features.field_presence = LEGACY_REQUIRED];
471}
472
473message TestRequiredNoMaskMulti {
474  enum NestedEnum {
475    UNSPECIFIED = 0;
476    FOO = 1;
477    BAR = 2;
478    BAZ = 100;
479  }
480
481  // Intentionally placed in descending field number to force sorting in closed
482  // enum verification. Also, using large field numbers to use tag only
483  // matching for fields.
484  fixed32 required_fixed32_80 = 80 [features.field_presence = LEGACY_REQUIRED];
485  fixed32 required_fixed32_70 = 70 [features.field_presence = LEGACY_REQUIRED];
486
487  NestedEnum required_enum_64 = 64 [features.field_presence = LEGACY_REQUIRED];
488  NestedEnum required_enum_4 = 4 [features.field_presence = LEGACY_REQUIRED];
489  int32 a_3 = 3;
490  NestedEnum required_enum_2 = 2 [features.field_presence = LEGACY_REQUIRED];
491  ForeignEnum required_enum_1 = 1 [features.field_presence = LEGACY_REQUIRED];
492}
493
494// We have separate messages for testing fields because it's
495// annoying to have to fill in fields in TestProto in order to
496// do anything with it.  Note that we don't need to test every type of
497// filed because the code output is basically identical to
498// optional fields for all types.
499message TestRequired {
500  int32 a = 1 [features.field_presence = LEGACY_REQUIRED];
501  int32 dummy2 = 2;
502  int32 b = 3 [features.field_presence = LEGACY_REQUIRED];
503
504  extend TestAllExtensions {
505    TestRequired single = 1000;
506    repeated TestRequired multi  = 1001;
507  }
508
509  // Pad the field count to 32 so that we can test that IsInitialized()
510  // properly checks multiple elements of has_bits_.
511  int32 dummy4  =  4;
512  int32 dummy5  =  5;
513  int32 dummy6  =  6;
514  int32 dummy7  =  7;
515  int32 dummy8  =  8;
516  int32 dummy9  =  9;
517  int32 dummy10 = 10;
518  int32 dummy11 = 11;
519  int32 dummy12 = 12;
520  int32 dummy13 = 13;
521  int32 dummy14 = 14;
522  int32 dummy15 = 15;
523  int32 dummy16 = 16;
524  int32 dummy17 = 17;
525  int32 dummy18 = 18;
526  int32 dummy19 = 19;
527  int32 dummy20 = 20;
528  int32 dummy21 = 21;
529  int32 dummy22 = 22;
530  int32 dummy23 = 23;
531  int32 dummy24 = 24;
532  int32 dummy25 = 25;
533  int32 dummy26 = 26;
534  int32 dummy27 = 27;
535  int32 dummy28 = 28;
536  int32 dummy29 = 29;
537  int32 dummy30 = 30;
538  int32 dummy31 = 31;
539  int32 dummy32 = 32;
540
541  int32 c = 33 [features.field_presence = LEGACY_REQUIRED];
542
543  // Add an optional child message to make this non-trivial for go/pdlazy.
544  ForeignMessage optional_foreign = 34;
545}
546
547message TestRequiredForeign {
548  TestRequired optional_message = 1;
549  repeated TestRequired repeated_message = 2;
550  int32 dummy = 3;
551
552  // Missing fields must not affect verification of child messages.
553  NestedTestAllTypes optional_lazy_message = 4 [lazy = true];
554}
555
556message TestRequiredMessage {
557  TestRequired optional_message = 1;
558  repeated TestRequired repeated_message = 2;
559  TestRequired required_message = 3 [features.field_presence = LEGACY_REQUIRED];
560}
561
562message TestNestedRequiredForeign {
563  TestNestedRequiredForeign child = 1;
564  TestRequiredForeign payload = 2;
565  int32 dummy = 3;
566  // optional message to test closed enum.
567  TestRequiredEnum required_enum = 5;
568  TestRequiredEnumNoMask required_enum_no_mask = 6;
569  TestRequiredEnumMulti required_enum_multi = 7;
570  TestRequiredNoMaskMulti required_no_mask = 9;
571}
572
573// Test that we can use NestedMessage from outside TestAllTypes.
574message TestForeignNested {
575  TestAllTypes.NestedMessage foreign_nested = 1;
576}
577
578// TestEmptyMessage is used to test unknown field support.
579message TestEmptyMessage {
580}
581
582// Like above, but declare all field numbers as potential extensions.  No
583// actual extensions should ever be defined for this type.
584message TestEmptyMessageWithExtensions {
585  extensions 1 to max;
586}
587
588// Needed for a Python test.
589message TestPickleNestedMessage {
590  message NestedMessage {
591    int32 bb = 1;
592    message NestedNestedMessage {
593      int32 cc = 1;
594    }
595  }
596}
597
598message TestMultipleExtensionRanges {
599  extensions 42;
600  extensions 4143 to 4243;
601  extensions 65536 to max;
602}
603
604// Test that really large tag numbers don't break anything.
605message TestReallyLargeTagNumber {
606  // The largest possible tag number is 2^28 - 1, since the wire format uses
607  // three bits to communicate wire type.
608  int32 a = 1;
609  int32 bb = 268435455;
610}
611
612message TestRecursiveMessage {
613  TestRecursiveMessage a = 1;
614  int32 i = 2;
615}
616
617// Test that mutual recursion works.
618message TestMutualRecursionA {
619  message SubMessage {
620    TestMutualRecursionB b = 1;
621  }
622  TestMutualRecursionB bb = 1;
623  message SubGroup {
624    SubMessage sub_message = 3;  // Needed because of bug in javatest
625    TestAllTypes not_in_this_scc = 4;
626  }
627  SubGroup subgroup = 2 [features.message_encoding = DELIMITED];
628  message SubGroupR {
629    TestAllTypes payload = 6;
630  }
631  repeated SubGroupR subgroupr = 5 [features.message_encoding = DELIMITED];
632}
633
634message TestMutualRecursionB {
635  TestMutualRecursionA a = 1;
636  int32 optional_int32 = 2;
637}
638
639message TestIsInitialized {
640  message SubMessage {
641    message SubGroup {
642      int32 i = 2 [features.field_presence = LEGACY_REQUIRED];
643    }
644    SubGroup subgroup = 1 [features.message_encoding = DELIMITED];
645  }
646  SubMessage sub_message = 1;
647}
648
649// Test that groups have disjoint field numbers from their siblings and
650// parents.  This is NOT possible in proto1; only google.protobuf.  When attempting
651// to compile with proto1, this will emit an error; so we only include it
652// in protobuf_unittest_proto.
653message TestDupFieldNumber {                        // NO_PROTO1
654  int32 a = 1;                             // NO_PROTO1
655  message Foo { int32 a = 1; }  // NO_PROTO1
656  message Bar { int32 a = 1; }  // NO_PROTO1
657  Foo foo = 2 [features.message_encoding = DELIMITED];
658  Bar bar = 3 [features.message_encoding = DELIMITED];
659}                                                   // NO_PROTO1
660
661// Additional messages for testing lazy fields.
662message TestEagerMessage {
663  TestAllTypes sub_message = 1 [lazy=false];
664}
665message TestLazyMessage {
666  TestAllTypes sub_message = 1 [lazy=true];
667}
668message TestLazyMessageRepeated {
669  repeated TestLazyMessage repeated_message = 1;
670}
671message TestEagerMaybeLazy {
672  message NestedMessage {
673    TestPackedTypes packed = 1;
674  }
675  TestAllTypes message_foo = 1;
676  TestAllTypes message_bar = 2;
677  NestedMessage message_baz = 3;
678}
679// Needed for a Python test.
680message TestNestedMessageHasBits {
681  message NestedMessage {
682    repeated int32 nestedmessage_repeated_int32 = 1;
683    repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2;
684  }
685  NestedMessage optional_nested_message = 1;
686}
687
688
689// Test an enum that has multiple values with the same number.
690enum TestEnumWithDupValue {
691  option allow_alias = true;
692
693  DUP_UNKNOWN1 = 0;
694  DUP_FOO1 = 1;
695  DUP_BAR1 = 2;
696  DUP_BAZ = 3;
697  DUP_UNKNOWN2 = 0;
698  DUP_FOO2 = 1;
699  DUP_BAR2 = 2;
700}
701
702// Test an enum with large, unordered values.
703enum TestSparseEnum {
704  SPARSE_A = 123;
705  SPARSE_B = 62374;
706  SPARSE_C = 12589234;
707  SPARSE_D = -15;
708  SPARSE_E = -53452;
709  SPARSE_F = 0;
710  SPARSE_G = 2;
711}
712
713// Test message with CamelCase field names.  This violates Protocol Buffer
714// standard style.
715message TestCamelCaseFieldNames {
716  int32 PrimitiveField = 1;
717  string StringField = 2;
718  ForeignEnum EnumField = 3;
719  ForeignMessage MessageField = 4;
720  string StringPieceField = 5 [ctype=STRING_PIECE];
721  string CordField = 6 [ctype=CORD];
722
723  repeated int32 RepeatedPrimitiveField = 7;
724  repeated string RepeatedStringField = 8;
725  repeated ForeignEnum RepeatedEnumField = 9;
726  repeated ForeignMessage RepeatedMessageField = 10;
727  repeated string RepeatedStringPieceField = 11 [ctype=STRING_PIECE];
728  repeated string RepeatedCordField = 12 [ctype=CORD];
729}
730
731
732// We list fields out of order, to ensure that we're using field number and not
733// field index to determine serialization order.
734message TestFieldOrderings {
735  string my_string = 11;
736  extensions 2 to 10;
737  int64 my_int = 1;
738  extensions 12 to 100;
739  float my_float = 101;
740  message NestedMessage {
741    int64 oo = 2;
742    // The field name "b" fails to compile in proto1 because it conflicts with
743    // a local variable named "b" in one of the generated methods.  Doh.
744    // This file needs to compile in proto1 to test backwards-compatibility.
745    int32 bb = 1;
746  }
747
748  NestedMessage optional_nested_message  = 200;
749}
750
751extend TestFieldOrderings {
752  string my_extension_string = 50;
753  int32 my_extension_int = 5;
754}
755
756message TestExtensionOrderings1 {
757  extend TestFieldOrderings {
758    TestExtensionOrderings1 test_ext_orderings1 = 13;
759  }
760  string my_string = 1;
761}
762
763message TestExtensionOrderings2 {
764  extend TestFieldOrderings {
765    TestExtensionOrderings2 test_ext_orderings2 = 12;
766  }
767  message TestExtensionOrderings3 {
768    extend TestFieldOrderings {
769      TestExtensionOrderings3 test_ext_orderings3 = 14;
770    }
771    string my_string = 1;
772  }
773  string my_string = 1;
774}
775
776message TestExtremeDefaultValues {
777  bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
778  uint32 large_uint32 = 2 [default = 0xFFFFFFFF];
779  uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF];
780   int32 small_int32  = 4 [default = -0x7FFFFFFF];
781   int64 small_int64  = 5 [default = -0x7FFFFFFFFFFFFFFF];
782   int32 really_small_int32 = 21 [default = -0x80000000];
783   int64 really_small_int64 = 22 [default = -0x8000000000000000];
784
785  // The default value here is UTF-8 for "\u1234".  (We could also just type
786  // the UTF-8 text directly into this text file rather than escape it, but
787  // lots of people use editors that would be confused by this.)
788  string utf8_string = 6 [default = "\341\210\264"];
789
790  // Tests for single-precision floating-point values.
791  float zero_float = 7 [default = 0];
792  float one_float = 8 [default = 1];
793  float small_float = 9 [default = 1.5];
794  float negative_one_float = 10 [default = -1];
795  float negative_float = 11 [default = -1.5];
796  // Using exponents
797  float large_float = 12 [default = 2E8];
798  float small_negative_float = 13 [default = -8e-28];
799
800  // Text for nonfinite floating-point values.
801  double inf_double = 14 [default = inf];
802  double neg_inf_double = 15 [default = -inf];
803  double nan_double = 16 [default = nan];
804  float inf_float = 17 [default = inf];
805  float neg_inf_float = 18 [default = -inf];
806  float nan_float = 19 [default = nan];
807
808  // Tests for C++ trigraphs.
809  // Trigraphs should be escaped in C++ generated files, but they should not be
810  // escaped for other languages.
811  // Note that in .proto file, "\?" is a valid way to escape ? in string
812  // literals.
813  string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"];
814
815  // String defaults containing the character '\000'
816  string string_with_zero       = 23 [default = "hel\000lo"];
817   bytes bytes_with_zero        = 24 [default = "wor\000ld"];
818  string string_piece_with_zero = 25 [ctype=STRING_PIECE,
819                                               default="ab\000c"];
820  string cord_with_zero         = 26 [ctype=CORD,
821                                               default="12\0003"];
822  string replacement_string     = 27 [default="${unknown}"];
823}
824
825message SparseEnumMessage {
826  TestSparseEnum sparse_enum = 1;
827}
828
829// Test String and Bytes: string is for valid UTF-8 strings
830message OneString {
831  string data = 1;
832}
833
834message MoreString {
835  repeated string data = 1;
836}
837
838message OneBytes {
839  bytes data = 1;
840}
841
842message MoreBytes {
843  repeated bytes data = 1;
844}
845
846message ManyOptionalString {
847  string str1 = 1;
848  string str2 = 2;
849  string str3 = 3;
850  string str4 = 4;
851  string str5 = 5;
852  string str6 = 6;
853  string str7 = 7;
854  string str8 = 8;
855  string str9 = 9;
856  string str10 = 10;
857  string str11 = 11;
858  string str12 = 12;
859  string str13 = 13;
860  string str14 = 14;
861  string str15 = 15;
862  string str16 = 16;
863  string str17 = 17;
864  string str18 = 18;
865  string str19 = 19;
866  string str20 = 20;
867  string str21 = 21;
868  string str22 = 22;
869  string str23 = 23;
870  string str24 = 24;
871  string str25 = 25;
872  string str26 = 26;
873  string str27 = 27;
874  string str28 = 28;
875  string str29 = 29;
876  string str30 = 30;
877  string str31 = 31;
878  string str32 = 32;
879}
880
881// Test int32, uint32, int64, uint64, and bool are all compatible
882message Int32Message {
883  int32 data = 1;
884}
885
886message Uint32Message {
887  uint32 data = 1;
888}
889
890message Int64Message {
891  int64 data = 1;
892}
893
894message Uint64Message {
895  uint64 data = 1;
896}
897
898message BoolMessage {
899  bool data = 1;
900}
901
902// Test oneofs.
903message TestOneof {
904    message FooGroup {
905      int32 a = 5;
906      string b = 6;
907    }
908  oneof foo {
909    int32 foo_int = 1;
910    string foo_string = 2;
911    TestAllTypes foo_message = 3;
912    FooGroup foogroup= 4 [features.message_encoding = DELIMITED];
913  }
914}
915
916message TestOneofBackwardsCompatible {
917  int32 foo_int = 1;
918  string foo_string = 2;
919  TestAllTypes foo_message = 3;
920  message FooGroup {
921    int32 a = 5;
922    string b = 6;
923  }
924    FooGroup foogroup= 4 [features.message_encoding = DELIMITED];
925}
926
927message TestOneof2 {
928    message FooGroup {
929      int32 a = 9;
930      string b = 10;
931    }
932  oneof foo {
933    int32 foo_int = 1;
934    string foo_string = 2;
935    string foo_cord = 3 [ctype=CORD];
936    string foo_string_piece = 4 [ctype=STRING_PIECE];
937    bytes foo_bytes = 5;
938    NestedEnum foo_enum = 6;
939    NestedMessage foo_message = 7;
940    FooGroup foogroup = 8 [features.message_encoding = DELIMITED];
941    NestedMessage foo_lazy_message = 11 [lazy=true];
942    bytes foo_bytes_cord = 30 [ctype=CORD];
943  }
944
945  oneof bar {
946    int32 bar_int = 12 [default = 5];
947    string bar_string = 13 [default = "STRING"];
948    string bar_cord = 14 [ctype=CORD, default = "CORD"];
949    string bar_string_piece = 15 [ctype=STRING_PIECE, default = "SPIECE"];
950    bytes bar_bytes = 16 [default = "BYTES"];
951    NestedEnum bar_enum = 17 [default = BAR];
952    string bar_string_with_empty_default = 20 [default = ""];
953    string bar_cord_with_empty_default = 21 [ctype=CORD, default = ""];
954    string bar_string_piece_with_empty_default = 22
955        [ctype=STRING_PIECE, default = ""];
956    bytes bar_bytes_with_empty_default = 23 [default = ""];
957  }
958
959  int32 baz_int = 18;
960  string baz_string = 19 [default = "BAZ"];
961
962  message NestedMessage {
963    int64 moo_int = 1;
964    repeated int32 corge_int = 2;
965  }
966
967  enum NestedEnum {
968    UNKNOWN = 0;
969    FOO = 1;
970    BAR = 2;
971    BAZ = 3;
972  }
973}
974
975message TestRequiredOneof {
976  oneof foo {
977    int32 foo_int = 1;
978    string foo_string = 2;
979    NestedMessage foo_message = 3;
980    NestedMessage foo_lazy_message = 4 [lazy = true];
981  }
982  message NestedMessage {
983    double required_double = 1 [features.field_presence = LEGACY_REQUIRED];
984  }
985}
986
987// Test messages for packed fields
988
989message TestPackedTypes {
990  repeated    int32 packed_int32    =  90 [features.repeated_field_encoding = PACKED];
991  repeated    int64 packed_int64    =  91 [features.repeated_field_encoding = PACKED];
992  repeated   uint32 packed_uint32   =  92 [features.repeated_field_encoding = PACKED];
993  repeated   uint64 packed_uint64   =  93 [features.repeated_field_encoding = PACKED];
994  repeated   sint32 packed_sint32   =  94 [features.repeated_field_encoding = PACKED];
995  repeated   sint64 packed_sint64   =  95 [features.repeated_field_encoding = PACKED];
996  repeated  fixed32 packed_fixed32  =  96 [features.repeated_field_encoding = PACKED];
997  repeated  fixed64 packed_fixed64  =  97 [features.repeated_field_encoding = PACKED];
998  repeated sfixed32 packed_sfixed32 =  98 [features.repeated_field_encoding = PACKED];
999  repeated sfixed64 packed_sfixed64 =  99 [features.repeated_field_encoding = PACKED];
1000  repeated    float packed_float    = 100 [features.repeated_field_encoding = PACKED];
1001  repeated   double packed_double   = 101 [features.repeated_field_encoding = PACKED];
1002  repeated     bool packed_bool     = 102 [features.repeated_field_encoding = PACKED];
1003  repeated ForeignEnum packed_enum  = 103 [features.repeated_field_encoding = PACKED];
1004}
1005
1006// A message with the same fields as TestPackedTypes, but without packing. Used
1007// to test packed <-> unpacked wire compatibility.
1008message TestUnpackedTypes {
1009  repeated    int32 unpacked_int32    =  90 [features.repeated_field_encoding = EXPANDED];
1010  repeated    int64 unpacked_int64    =  91 [features.repeated_field_encoding = EXPANDED];
1011  repeated   uint32 unpacked_uint32   =  92 [features.repeated_field_encoding = EXPANDED];
1012  repeated   uint64 unpacked_uint64   =  93 [features.repeated_field_encoding = EXPANDED];
1013  repeated   sint32 unpacked_sint32   =  94 [features.repeated_field_encoding = EXPANDED];
1014  repeated   sint64 unpacked_sint64   =  95 [features.repeated_field_encoding = EXPANDED];
1015  repeated  fixed32 unpacked_fixed32  =  96 [features.repeated_field_encoding = EXPANDED];
1016  repeated  fixed64 unpacked_fixed64  =  97 [features.repeated_field_encoding = EXPANDED];
1017  repeated sfixed32 unpacked_sfixed32 =  98 [features.repeated_field_encoding = EXPANDED];
1018  repeated sfixed64 unpacked_sfixed64 =  99 [features.repeated_field_encoding = EXPANDED];
1019  repeated    float unpacked_float    = 100 [features.repeated_field_encoding = EXPANDED];
1020  repeated   double unpacked_double   = 101 [features.repeated_field_encoding = EXPANDED];
1021  repeated     bool unpacked_bool     = 102 [features.repeated_field_encoding = EXPANDED];
1022  repeated ForeignEnum unpacked_enum  = 103 [features.repeated_field_encoding = EXPANDED];
1023}
1024
1025message TestPackedExtensions {
1026  extensions 1 to max;
1027}
1028
1029extend TestPackedExtensions {
1030  repeated    int32 packed_int32_extension    =  90 [features.repeated_field_encoding = PACKED];
1031  repeated    int64 packed_int64_extension    =  91 [features.repeated_field_encoding = PACKED];
1032  repeated   uint32 packed_uint32_extension   =  92 [features.repeated_field_encoding = PACKED];
1033  repeated   uint64 packed_uint64_extension   =  93 [features.repeated_field_encoding = PACKED];
1034  repeated   sint32 packed_sint32_extension   =  94 [features.repeated_field_encoding = PACKED];
1035  repeated   sint64 packed_sint64_extension   =  95 [features.repeated_field_encoding = PACKED];
1036  repeated  fixed32 packed_fixed32_extension  =  96 [features.repeated_field_encoding = PACKED];
1037  repeated  fixed64 packed_fixed64_extension  =  97 [features.repeated_field_encoding = PACKED];
1038  repeated sfixed32 packed_sfixed32_extension =  98 [features.repeated_field_encoding = PACKED];
1039  repeated sfixed64 packed_sfixed64_extension =  99 [features.repeated_field_encoding = PACKED];
1040  repeated    float packed_float_extension    = 100 [features.repeated_field_encoding = PACKED];
1041  repeated   double packed_double_extension   = 101 [features.repeated_field_encoding = PACKED];
1042  repeated     bool packed_bool_extension     = 102 [features.repeated_field_encoding = PACKED];
1043  repeated ForeignEnum packed_enum_extension  = 103 [features.repeated_field_encoding = PACKED];
1044}
1045
1046message TestUnpackedExtensions {
1047  extensions 1 to max;
1048}
1049
1050extend TestUnpackedExtensions {
1051  repeated    int32 unpacked_int32_extension    =  90 [features.repeated_field_encoding = EXPANDED];
1052  repeated    int64 unpacked_int64_extension    =  91 [features.repeated_field_encoding = EXPANDED];
1053  repeated   uint32 unpacked_uint32_extension   =  92 [features.repeated_field_encoding = EXPANDED];
1054  repeated   uint64 unpacked_uint64_extension   =  93 [features.repeated_field_encoding = EXPANDED];
1055  repeated   sint32 unpacked_sint32_extension   =  94 [features.repeated_field_encoding = EXPANDED];
1056  repeated   sint64 unpacked_sint64_extension   =  95 [features.repeated_field_encoding = EXPANDED];
1057  repeated  fixed32 unpacked_fixed32_extension  =  96 [features.repeated_field_encoding = EXPANDED];
1058  repeated  fixed64 unpacked_fixed64_extension  =  97 [features.repeated_field_encoding = EXPANDED];
1059  repeated sfixed32 unpacked_sfixed32_extension =  98 [features.repeated_field_encoding = EXPANDED];
1060  repeated sfixed64 unpacked_sfixed64_extension =  99 [features.repeated_field_encoding = EXPANDED];
1061  repeated    float unpacked_float_extension    = 100 [features.repeated_field_encoding = EXPANDED];
1062  repeated   double unpacked_double_extension   = 101 [features.repeated_field_encoding = EXPANDED];
1063  repeated     bool unpacked_bool_extension     = 102 [features.repeated_field_encoding = EXPANDED];
1064  repeated ForeignEnum unpacked_enum_extension  = 103 [features.repeated_field_encoding = EXPANDED];
1065}
1066
1067// Used by ExtensionSetTest/DynamicExtensions.  The test actually builds
1068// a set of extensions to TestAllExtensions dynamically, based on the fields
1069// of this message type.
1070message TestDynamicExtensions {
1071  enum DynamicEnumType {
1072    DYNAMIC_UNKNOWN = 0;
1073    DYNAMIC_FOO = 2200;
1074    DYNAMIC_BAR = 2201;
1075    DYNAMIC_BAZ = 2202;
1076  }
1077  message DynamicMessageType {
1078    int32 dynamic_field = 2100;
1079  }
1080
1081  fixed32 scalar_extension = 2000;
1082  ForeignEnum enum_extension = 2001;
1083  DynamicEnumType dynamic_enum_extension = 2002;
1084
1085  ForeignMessage message_extension = 2003;
1086  DynamicMessageType dynamic_message_extension = 2004;
1087
1088  repeated string repeated_extension = 2005;
1089  repeated sint32 packed_extension = 2006 [features.repeated_field_encoding = PACKED];
1090}
1091
1092message TestRepeatedString {
1093  repeated string repeated_string1 = 1;
1094  repeated string repeated_string2 = 2;
1095
1096  repeated bytes repeated_bytes11 = 11;
1097  repeated bytes repeated_bytes12 = 12;
1098}
1099
1100message TestRepeatedScalarDifferentTagSizes {
1101  // Parsing repeated fixed size values used to fail. This message needs to be
1102  // used in order to get a tag of the right size; all of the repeated fields
1103  // in TestAllTypes didn't trigger the check.
1104  repeated fixed32 repeated_fixed32 = 12;
1105  // Check for a varint type, just for good measure.
1106  repeated int32   repeated_int32   = 13;
1107
1108  // These have two-byte tags.
1109  repeated fixed64 repeated_fixed64 = 2046;
1110  repeated int64   repeated_int64   = 2047;
1111
1112  // Three byte tags.
1113  repeated float   repeated_float   = 262142;
1114  repeated uint64  repeated_uint64  = 262143;
1115}
1116
1117// Test that if an optional or message/group field appears multiple
1118// times in the input, they need to be merged.
1119message TestParsingMerge {
1120  // RepeatedFieldsGenerator defines matching field types as TestParsingMerge,
1121  // except that all fields are repeated. In the tests, we will serialize the
1122  // RepeatedFieldsGenerator to bytes, and parse the bytes to TestParsingMerge.
1123  // Repeated fields in RepeatedFieldsGenerator are expected to be merged into
1124  // the corresponding required/optional fields in TestParsingMerge.
1125  message RepeatedFieldsGenerator {
1126    repeated TestAllTypes field1 = 1;
1127    repeated TestAllTypes field2 = 2;
1128    repeated TestAllTypes field3 = 3;
1129    message Group1 {
1130      TestAllTypes field1 = 11;
1131    }
1132    repeated Group1 group1= 10 [features.message_encoding = DELIMITED];
1133    message Group2 {
1134      TestAllTypes field1 = 21;
1135    }
1136    repeated Group2 group2= 20 [features.message_encoding = DELIMITED];
1137    repeated TestAllTypes ext1 = 1000;
1138    repeated TestAllTypes ext2 = 1001;
1139  }
1140  TestAllTypes required_all_types = 1 [features.field_presence = LEGACY_REQUIRED];
1141  TestAllTypes optional_all_types = 2;
1142  repeated TestAllTypes repeated_all_types = 3;
1143  message OptionalGroup {
1144    TestAllTypes optional_group_all_types = 11;
1145  }
1146  OptionalGroup optionalgroup= 10 [features.message_encoding = DELIMITED];
1147  message RepeatedGroup {
1148    TestAllTypes repeated_group_all_types = 21;
1149  }
1150  repeated RepeatedGroup repeatedgroup= 20 [features.message_encoding = DELIMITED];
1151  extensions 1000 to max;
1152  extend TestParsingMerge {
1153    TestAllTypes optional_ext = 1000;
1154    repeated TestAllTypes repeated_ext = 1001;
1155  }
1156}
1157
1158// Test that the correct exception is thrown by parseFrom in a corner case
1159// involving merging, extensions, and fields.
1160message TestMergeException {
1161  TestAllExtensions all_extensions = 1;
1162}
1163
1164message TestCommentInjectionMessage {
1165  // */ <- This should not close the generated doc comment
1166  string a = 1 [default="*/ <- Neither should this."];
1167}
1168
1169// Used to check that the c++ code generator re-orders messages to reduce
1170// padding.
1171message TestMessageSize {
1172  bool m1 = 1;
1173  int64 m2 = 2;
1174  bool m3 = 3;
1175  string m4 = 4;
1176  int32 m5 = 5;
1177  int64 m6 = 6;
1178}
1179
1180// Test that RPC services work.
1181message FooRequest  {}
1182message FooResponse {}
1183
1184message FooClientMessage {}
1185message FooServerMessage{}
1186
1187message BarRequest  {}
1188message BarResponse {}
1189
1190message TestJsonName {
1191  int32 field_name1 = 1;
1192  int32 fieldName2 = 2;
1193  int32 FieldName3 = 3;
1194  int32 _field_name4 = 4;
1195  int32 FIELD_NAME5 = 5;
1196  int32 field_name6 = 6 [json_name = "@type"];
1197  int32 fieldname7 = 7;
1198}
1199
1200message TestHugeFieldNumbers {
1201  int32 optional_int32 = 536870000;
1202  int32 fixed_32 = 536870001;
1203  repeated int32 repeated_int32 = 536870002 [features.repeated_field_encoding = EXPANDED];
1204  repeated int32 packed_int32 = 536870003 [features.repeated_field_encoding = PACKED];
1205
1206  ForeignEnum optional_enum = 536870004;
1207  string optional_string = 536870005;
1208  bytes optional_bytes = 536870006;
1209  ForeignMessage optional_message = 536870007;
1210
1211  message OptionalGroup {
1212    int32 group_a = 536870009;
1213  }
1214  OptionalGroup optionalgroup = 536870008 [features.message_encoding = DELIMITED];
1215
1216  map<string, string> string_string_map = 536870010;
1217
1218  oneof oneof_field {
1219    uint32 oneof_uint32 = 536870011;
1220    TestAllTypes oneof_test_all_types = 536870012;
1221    string oneof_string = 536870013;
1222    bytes oneof_bytes = 536870014;
1223  }
1224
1225  extensions 536860000 to 536869999 [declaration = {
1226    number: 536860000
1227    full_name: ".edition_unittest.test_all_types"
1228    type: ".edition_unittest.TestAllTypes"
1229  }];
1230}
1231
1232extend TestHugeFieldNumbers {
1233  TestAllTypes test_all_types = 536860000;
1234}
1235
1236message TestExtensionInsideTable {
1237  int32 field1 = 1;
1238  int32 field2 = 2;
1239  int32 field3 = 3;
1240  int32 field4 = 4;
1241  extensions 5 to 5;
1242  int32 field6 = 6;
1243  int32 field7 = 7;
1244  int32 field8 = 8;
1245  int32 field9 = 9;
1246  int32 field10 = 10;
1247}
1248
1249extend TestExtensionInsideTable {
1250  int32 test_extension_inside_table_extension = 5;
1251}
1252
1253// NOTE: Intentionally nested to mirror go/glep.
1254message TestNestedGroupExtensionOuter {
1255  message Layer1OptionalGroup {
1256    message Layer2RepeatedGroup {
1257      extensions 3
1258        // NOTE: extension metadata is not supported due to targets such as
1259        // `//google/protobuf_legacy_opensource/src:shell_scripts_test`,
1260        // eee https://screenshot.googleplex.com/Axz2QD8nxjdpyFF
1261        //[metadata = {
1262        // NOTE: can't write type there due to some clever build gen code at
1263        // http://google3/google/protobuf/BUILD;l=1247;rcl=411090862
1264        // type: "edition_unittest.TestNestedGroupExtensionInnerExtension",
1265        // name: "inner",
1266        // }]
1267        ;
1268      string another_field = 6;
1269    }
1270    message Layer2AnotherOptionalRepeatedGroup {
1271      string but_why_tho = 5;
1272    }
1273    repeated Layer2RepeatedGroup layer2repeatedgroup = 2 [features.message_encoding = DELIMITED];
1274    repeated Layer2AnotherOptionalRepeatedGroup layer2anotheroptionalrepeatedgroup = 4 [features.message_encoding = DELIMITED];
1275  }
1276  Layer1OptionalGroup lay1optionalgroup = 1 [features.message_encoding = DELIMITED];
1277}
1278
1279message TestNestedGroupExtensionInnerExtension {
1280  string inner_name= 1;
1281}
1282
1283extend TestNestedGroupExtensionOuter.Layer1OptionalGroup.Layer2RepeatedGroup {
1284  TestNestedGroupExtensionInnerExtension inner = 3;
1285}
1286
1287enum VeryLargeEnum {
1288  ENUM_LABEL_DEFAULT = 0;
1289  ENUM_LABEL_1 = 1;
1290  ENUM_LABEL_2 = 2;
1291  ENUM_LABEL_3 = 3;
1292  ENUM_LABEL_4 = 4;
1293  ENUM_LABEL_5 = 5;
1294  ENUM_LABEL_6 = 6;
1295  ENUM_LABEL_7 = 7;
1296  ENUM_LABEL_8 = 8;
1297  ENUM_LABEL_9 = 9;
1298  ENUM_LABEL_10 = 10;
1299  ENUM_LABEL_11 = 11;
1300  ENUM_LABEL_12 = 12;
1301  ENUM_LABEL_13 = 13;
1302  ENUM_LABEL_14 = 14;
1303  ENUM_LABEL_15 = 15;
1304  ENUM_LABEL_16 = 16;
1305  ENUM_LABEL_17 = 17;
1306  ENUM_LABEL_18 = 18;
1307  ENUM_LABEL_19 = 19;
1308  ENUM_LABEL_20 = 20;
1309  ENUM_LABEL_21 = 21;
1310  ENUM_LABEL_22 = 22;
1311  ENUM_LABEL_23 = 23;
1312  ENUM_LABEL_24 = 24;
1313  ENUM_LABEL_25 = 25;
1314  ENUM_LABEL_26 = 26;
1315  ENUM_LABEL_27 = 27;
1316  ENUM_LABEL_28 = 28;
1317  ENUM_LABEL_29 = 29;
1318  ENUM_LABEL_30 = 30;
1319  ENUM_LABEL_31 = 31;
1320  ENUM_LABEL_32 = 32;
1321  ENUM_LABEL_33 = 33;
1322  ENUM_LABEL_34 = 34;
1323  ENUM_LABEL_35 = 35;
1324  ENUM_LABEL_36 = 36;
1325  ENUM_LABEL_37 = 37;
1326  ENUM_LABEL_38 = 38;
1327  ENUM_LABEL_39 = 39;
1328  ENUM_LABEL_40 = 40;
1329  ENUM_LABEL_41 = 41;
1330  ENUM_LABEL_42 = 42;
1331  ENUM_LABEL_43 = 43;
1332  ENUM_LABEL_44 = 44;
1333  ENUM_LABEL_45 = 45;
1334  ENUM_LABEL_46 = 46;
1335  ENUM_LABEL_47 = 47;
1336  ENUM_LABEL_48 = 48;
1337  ENUM_LABEL_49 = 49;
1338  ENUM_LABEL_50 = 50;
1339  ENUM_LABEL_51 = 51;
1340  ENUM_LABEL_52 = 52;
1341  ENUM_LABEL_53 = 53;
1342  ENUM_LABEL_54 = 54;
1343  ENUM_LABEL_55 = 55;
1344  ENUM_LABEL_56 = 56;
1345  ENUM_LABEL_57 = 57;
1346  ENUM_LABEL_58 = 58;
1347  ENUM_LABEL_59 = 59;
1348  ENUM_LABEL_60 = 60;
1349  ENUM_LABEL_61 = 61;
1350  ENUM_LABEL_62 = 62;
1351  ENUM_LABEL_63 = 63;
1352  ENUM_LABEL_64 = 64;
1353  ENUM_LABEL_65 = 65;
1354  ENUM_LABEL_66 = 66;
1355  ENUM_LABEL_67 = 67;
1356  ENUM_LABEL_68 = 68;
1357  ENUM_LABEL_69 = 69;
1358  ENUM_LABEL_70 = 70;
1359  ENUM_LABEL_71 = 71;
1360  ENUM_LABEL_72 = 72;
1361  ENUM_LABEL_73 = 73;
1362  ENUM_LABEL_74 = 74;
1363  ENUM_LABEL_75 = 75;
1364  ENUM_LABEL_76 = 76;
1365  ENUM_LABEL_77 = 77;
1366  ENUM_LABEL_78 = 78;
1367  ENUM_LABEL_79 = 79;
1368  ENUM_LABEL_80 = 80;
1369  ENUM_LABEL_81 = 81;
1370  ENUM_LABEL_82 = 82;
1371  ENUM_LABEL_83 = 83;
1372  ENUM_LABEL_84 = 84;
1373  ENUM_LABEL_85 = 85;
1374  ENUM_LABEL_86 = 86;
1375  ENUM_LABEL_87 = 87;
1376  ENUM_LABEL_88 = 88;
1377  ENUM_LABEL_89 = 89;
1378  ENUM_LABEL_90 = 90;
1379  ENUM_LABEL_91 = 91;
1380  ENUM_LABEL_92 = 92;
1381  ENUM_LABEL_93 = 93;
1382  ENUM_LABEL_94 = 94;
1383  ENUM_LABEL_95 = 95;
1384  ENUM_LABEL_96 = 96;
1385  ENUM_LABEL_97 = 97;
1386  ENUM_LABEL_98 = 98;
1387  ENUM_LABEL_99 = 99;
1388  ENUM_LABEL_100 = 100;
1389};
1390
1391message TestExtensionRangeSerialize {
1392  int32 foo_one = 1;
1393
1394  extensions 2 to 2;
1395  extensions 3 to 4;
1396
1397  int32 foo_two = 6;
1398  int32 foo_three = 7;
1399
1400  extensions 9 to 10;
1401
1402  int32 foo_four = 13;
1403
1404  extensions 15 to 15;
1405  extensions 17 to 17;
1406  extensions 19 to 19;
1407
1408  extend TestExtensionRangeSerialize {
1409    int32 bar_one = 2;
1410    int32 bar_two = 4;
1411
1412    int32 bar_three = 10;
1413
1414    int32 bar_four = 15;
1415    int32 bar_five = 19;
1416  }
1417}
1418
1419message TestVerifyInt32Simple {
1420    int32 optional_int32_1 = 1;
1421    int32 optional_int32_2 = 2;
1422    int32 optional_int32_63 = 63;
1423    int32 optional_int32_64 = 64;
1424}
1425
1426message TestVerifyInt32 {
1427    int32 optional_int32_1 = 1;
1428    int32 optional_int32_2 = 2;
1429    int32 optional_int32_63 = 63;
1430    int32 optional_int32_64 = 64;
1431
1432    TestAllTypes optional_all_types = 9;
1433    repeated TestAllTypes repeated_all_types = 10;
1434}
1435
1436message TestVerifyMostlyInt32 {
1437    int64 optional_int64_30 = 30;
1438
1439    int32 optional_int32_1 = 1;
1440    int32 optional_int32_2 = 2;
1441    int32 optional_int32_3 = 3;
1442    int32 optional_int32_4 = 4;
1443    int32 optional_int32_63 = 63;
1444    int32 optional_int32_64 = 64;
1445
1446    TestAllTypes optional_all_types = 9;
1447    repeated TestAllTypes repeated_all_types = 10;
1448}
1449
1450message TestVerifyMostlyInt32BigFieldNumber {
1451    int64 optional_int64_30 = 30;
1452    int32 optional_int32_300 = 300;
1453
1454    int32 optional_int32_1 = 1;
1455    int32 optional_int32_2 = 2;
1456    int32 optional_int32_3 = 3;
1457    int32 optional_int32_4 = 4;
1458    int32 optional_int32_63 = 63;
1459    int32 optional_int32_64 = 64;
1460
1461    TestAllTypes optional_all_types = 9;
1462    repeated TestAllTypes repeated_all_types = 10;
1463}
1464
1465message TestVerifyUint32Simple {
1466    uint32 optional_uint32_1 = 1;
1467    uint32 optional_uint32_2 = 2;
1468    uint32 optional_uint32_63 = 63;
1469    uint32 optional_uint32_64 = 64;
1470}
1471
1472message TestVerifyUint32 {
1473    uint32 optional_uint32_1 = 1;
1474    uint32 optional_uint32_2 = 2;
1475    uint32 optional_uint32_63 = 63;
1476    uint32 optional_uint32_64 = 64;
1477
1478    TestAllTypes optional_all_types = 9;
1479    repeated TestAllTypes repeated_all_types = 10;
1480}
1481
1482message TestVerifyOneUint32 {
1483    uint32 optional_uint32_1 = 1;
1484    int32 optional_int32_2 = 2;
1485    int32 optional_int32_63 = 63;
1486    int32 optional_int32_64 = 64;
1487
1488    TestAllTypes optional_all_types = 9;
1489    repeated TestAllTypes repeated_all_types = 10;
1490}
1491
1492message TestVerifyOneInt32BigFieldNumber {
1493    int32 optional_int32_65 = 65;
1494
1495    int64 optional_int64_1 = 1;
1496    int64 optional_int64_2 = 2;
1497    int64 optional_int64_63 = 63;
1498    int64 optional_int64_64 = 64;
1499
1500    TestAllTypes optional_all_types = 9;
1501    repeated TestAllTypes repeated_all_types = 10;
1502}
1503
1504message TestVerifyInt32BigFieldNumber {
1505    int32 optional_int32_1000 = 1000;
1506    int32 optional_int32_65 = 65;
1507
1508    int32 optional_int32_1 = 1;
1509    int32 optional_int32_2 = 2;
1510    int32 optional_int32_63 = 63;
1511    int32 optional_int32_64 = 64;
1512
1513    TestAllTypes optional_all_types = 9;
1514    repeated TestAllTypes repeated_all_types = 10;
1515}
1516
1517message TestVerifyUint32BigFieldNumber {
1518    uint32 optional_uint32_1000 = 1000;
1519    uint32 optional_uint32_65 = 65;
1520
1521    uint32 optional_uint32_1 = 1;
1522    uint32 optional_uint32_2 = 2;
1523    uint32 optional_uint32_63 = 63;
1524    uint32 optional_uint32_64 = 64;
1525
1526    TestAllTypes optional_all_types = 9;
1527    repeated TestAllTypes repeated_all_types = 10;
1528}
1529
1530message TestVerifyBigFieldNumberUint32 {
1531  message Nested {
1532    uint32 optional_uint32_5000 = 5000;
1533    uint32 optional_uint32_1000 = 1000;
1534    uint32 optional_uint32_66 = 66;
1535    uint32 optional_uint32_65 = 65;
1536
1537    uint32 optional_uint32_1 = 1;
1538    uint32 optional_uint32_2 = 2;
1539    uint32 optional_uint32_63 = 63;
1540    uint32 optional_uint32_64 = 64;
1541
1542    Nested optional_nested = 9;
1543    repeated Nested repeated_nested = 10;
1544  }
1545  Nested optional_nested = 1;
1546}
1547
1548// This message contains different kind of enums to exercise the different
1549// parsers in table-driven.
1550message EnumParseTester {
1551  enum SeqSmall0 {
1552    SEQ_SMALL_0_DEFAULT = 0;
1553    SEQ_SMALL_0_1 = 1;
1554    SEQ_SMALL_0_2 = 2;
1555  };
1556  SeqSmall0 optional_seq_small_0_lowfield = 1;
1557  SeqSmall0 optional_seq_small_0_midfield = 1001;
1558  SeqSmall0 optional_seq_small_0_hifield = 1000001;
1559  repeated SeqSmall0 repeated_seq_small_0_lowfield = 2;
1560  repeated SeqSmall0 repeated_seq_small_0_midfield = 1002;
1561  repeated SeqSmall0 repeated_seq_small_0_hifield = 1000002;
1562  repeated SeqSmall0 packed_seq_small_0_lowfield = 3
1563      [features.repeated_field_encoding = PACKED];
1564  repeated SeqSmall0 packed_seq_small_0_midfield = 1003
1565      [features.repeated_field_encoding = PACKED];
1566  repeated SeqSmall0 packed_seq_small_0_hifield = 1000003
1567      [features.repeated_field_encoding = PACKED];
1568
1569  enum SeqSmall1 {
1570    UNKNOWN = 0;
1571    SEQ_SMALL_1_DEFAULT = 1;
1572    SEQ_SMALL_1_2 = 2;
1573    SEQ_SMALL_1_3 = 3;
1574  };
1575  SeqSmall1 optional_seq_small_1_lowfield = 4;
1576  SeqSmall1 optional_seq_small_1_midfield = 1004;
1577  SeqSmall1 optional_seq_small_1_hifield = 1000004;
1578  repeated SeqSmall1 repeated_seq_small_1_lowfield = 5;
1579  repeated SeqSmall1 repeated_seq_small_1_midfield = 1005;
1580  repeated SeqSmall1 repeated_seq_small_1_hifield = 1000005;
1581  repeated SeqSmall1 packed_seq_small_1_lowfield = 6
1582      [features.repeated_field_encoding = PACKED];
1583  repeated SeqSmall1 packed_seq_small_1_midfield = 1006
1584      [features.repeated_field_encoding = PACKED];
1585  repeated SeqSmall1 packed_seq_small_1_hifield = 1000006
1586      [features.repeated_field_encoding = PACKED];
1587
1588  enum SeqLarge {
1589    SEQ_LARGE_DEFAULT = -1;
1590    SEQ_LARGE_0 = 0;
1591    SEQ_LARGE_1 = 1;
1592    SEQ_LARGE_2 = 2;
1593    SEQ_LARGE_3 = 3;
1594    SEQ_LARGE_4 = 4;
1595    SEQ_LARGE_5 = 5;
1596    SEQ_LARGE_6 = 6;
1597    SEQ_LARGE_7 = 7;
1598    SEQ_LARGE_8 = 8;
1599    SEQ_LARGE_9 = 9;
1600    SEQ_LARGE_10 = 10;
1601    SEQ_LARGE_11 = 11;
1602    SEQ_LARGE_12 = 12;
1603    SEQ_LARGE_13 = 13;
1604    SEQ_LARGE_14 = 14;
1605    SEQ_LARGE_15 = 15;
1606    SEQ_LARGE_16 = 16;
1607    SEQ_LARGE_17 = 17;
1608    SEQ_LARGE_18 = 18;
1609    SEQ_LARGE_19 = 19;
1610    SEQ_LARGE_20 = 20;
1611    SEQ_LARGE_21 = 21;
1612    SEQ_LARGE_22 = 22;
1613    SEQ_LARGE_23 = 23;
1614    SEQ_LARGE_24 = 24;
1615    SEQ_LARGE_25 = 25;
1616    SEQ_LARGE_26 = 26;
1617    SEQ_LARGE_27 = 27;
1618    SEQ_LARGE_28 = 28;
1619    SEQ_LARGE_29 = 29;
1620    SEQ_LARGE_30 = 30;
1621    SEQ_LARGE_31 = 31;
1622    SEQ_LARGE_32 = 32;
1623    SEQ_LARGE_33 = 33;
1624  };
1625  SeqLarge optional_seq_large_lowfield = 7;
1626  SeqLarge optional_seq_large_midfield = 1007;
1627  SeqLarge optional_seq_large_hifield = 1000007;
1628  repeated SeqLarge repeated_seq_large_lowfield = 8;
1629  repeated SeqLarge repeated_seq_large_midfield = 1008;
1630  repeated SeqLarge repeated_seq_large_hifield = 1000008;
1631  repeated SeqLarge packed_seq_large_lowfield = 9
1632      [features.repeated_field_encoding = PACKED];
1633  repeated SeqLarge packed_seq_large_midfield = 1009
1634      [features.repeated_field_encoding = PACKED];
1635  repeated SeqLarge packed_seq_large_hifield = 1000009
1636      [features.repeated_field_encoding = PACKED];
1637
1638  enum Arbitrary {
1639    ARBITRARY_DEFAULT = -123123;
1640    ARBITRARY_1 = -123;
1641    ARBITRARY_2 = 213;
1642    ARBITRARY_3 = 213213;
1643    ARBITRARY_MIN = -2147483648;
1644    ARBITRARY_MAX = 2147483647;
1645  };
1646  Arbitrary optional_arbitrary_lowfield = 10;
1647  Arbitrary optional_arbitrary_midfield = 1010;
1648  Arbitrary optional_arbitrary_hifield = 1000010;
1649  repeated Arbitrary repeated_arbitrary_lowfield = 11;
1650  repeated Arbitrary repeated_arbitrary_midfield = 1011;
1651  repeated Arbitrary repeated_arbitrary_hifield = 1000011;
1652  repeated Arbitrary packed_arbitrary_lowfield = 12
1653      [features.repeated_field_encoding = PACKED];
1654  repeated Arbitrary packed_arbitrary_midfield = 1012
1655      [features.repeated_field_encoding = PACKED];
1656  repeated Arbitrary packed_arbitrary_hifield = 1000012
1657      [features.repeated_field_encoding = PACKED];
1658
1659  extensions 2000000 to max;
1660  extend EnumParseTester {
1661    Arbitrary optional_arbitrary_ext = 2000000;
1662    repeated Arbitrary repeated_arbitrary_ext = 2000001;
1663    repeated Arbitrary packed_arbitrary_ext = 2000002
1664        [features.repeated_field_encoding = PACKED];
1665  }
1666
1667  // An arbitrary field we can append to to break the runs of repeated fields.
1668  int32 other_field = 99;
1669}
1670
1671// This message contains different kind of bool fields to exercise the different
1672// parsers in table-drived.
1673message BoolParseTester {
1674  bool optional_bool_lowfield = 1;
1675  bool optional_bool_midfield = 1001;
1676  bool optional_bool_hifield = 1000001;
1677  repeated bool repeated_bool_lowfield = 2;
1678  repeated bool repeated_bool_midfield = 1002;
1679  repeated bool repeated_bool_hifield = 1000002;
1680  repeated bool packed_bool_lowfield = 3
1681      [features.repeated_field_encoding = PACKED];
1682  repeated bool packed_bool_midfield = 1003
1683      [features.repeated_field_encoding = PACKED];
1684  repeated bool packed_bool_hifield = 1000003
1685      [features.repeated_field_encoding = PACKED];
1686
1687  extensions 2000000 to max;
1688  extend BoolParseTester {
1689    bool optional_bool_ext = 2000000;
1690    repeated bool repeated_bool_ext = 2000001;
1691    repeated bool packed_bool_ext = 2000002
1692        [features.repeated_field_encoding = PACKED];
1693  }
1694
1695  // An arbitrary field we can append to to break the runs of repeated fields.
1696  int32 other_field = 99;
1697}
1698
1699message Int32ParseTester {
1700  int32 optional_int32_lowfield = 1;
1701  int32 optional_int32_midfield = 1001;
1702  int32 optional_int32_hifield = 1000001;
1703  repeated int32 repeated_int32_lowfield = 2;
1704  repeated int32 repeated_int32_midfield = 1002;
1705  repeated int32 repeated_int32_hifield = 1000002;
1706  repeated int32 packed_int32_lowfield = 3
1707      [features.repeated_field_encoding = PACKED];
1708  repeated int32 packed_int32_midfield = 1003
1709      [features.repeated_field_encoding = PACKED];
1710  repeated int32 packed_int32_hifield = 1000003
1711      [features.repeated_field_encoding = PACKED];
1712
1713  extensions 2000000 to max;
1714  extend Int32ParseTester {
1715    int32 optional_int32_ext = 2000000;
1716    repeated int32 repeated_int32_ext = 2000001;
1717    repeated int32 packed_int32_ext = 2000002
1718        [features.repeated_field_encoding = PACKED];
1719  }
1720
1721  // An arbitrary field we can append to to break the runs of repeated fields.
1722  int32 other_field = 99;
1723}
1724
1725message Int64ParseTester {
1726  int64 optional_int64_lowfield = 1;
1727  int64 optional_int64_midfield = 1001;
1728  int64 optional_int64_hifield = 1000001;
1729  repeated int64 repeated_int64_lowfield = 2;
1730  repeated int64 repeated_int64_midfield = 1002;
1731  repeated int64 repeated_int64_hifield = 1000002;
1732  repeated int64 packed_int64_lowfield = 3
1733      [features.repeated_field_encoding = PACKED];
1734  repeated int64 packed_int64_midfield = 1003
1735      [features.repeated_field_encoding = PACKED];
1736  repeated int64 packed_int64_hifield = 1000003
1737      [features.repeated_field_encoding = PACKED];
1738
1739  extensions 2000000 to max;
1740  extend Int64ParseTester {
1741    int64 optional_int64_ext = 2000000;
1742    repeated int64 repeated_int64_ext = 2000001;
1743    repeated int64 packed_int64_ext = 2000002
1744        [features.repeated_field_encoding = PACKED];
1745  }
1746
1747  // An arbitrary field we can append to to break the runs of repeated fields.
1748  int32 other_field = 99;
1749}
1750
1751message InlinedStringIdxRegressionProto {
1752  // We mix data to make sure aux ids and inlined string idx do not match.
1753  // aux_idx == inlined_string_idx == 1
1754  string str1 = 1;
1755  // aux_idx == 2
1756  InlinedStringIdxRegressionProto sub = 2;
1757  // aux_idx == 3, inlined_string_idx == 2
1758  string str2 = 3;
1759  // aux_idx == 4, inlined_string_idx == 3
1760  bytes str3 = 4;
1761}
1762
1763message StringParseTester {
1764  string optional_string_lowfield = 1;
1765  string optional_string_midfield = 1001;
1766  string optional_string_hifield = 1000001;
1767  repeated string repeated_string_lowfield = 2;
1768  repeated string repeated_string_midfield = 1002;
1769  repeated string repeated_string_hifield = 1000002;
1770
1771  extensions 2000000 to max;
1772  extend StringParseTester {
1773    string optional_string_ext = 2000000;
1774    repeated string repeated_string_ext = 2000001;
1775  }
1776}
1777
1778message BadFieldNames{
1779  int32 OptionalInt32 = 1;
1780  int32 for = 2;
1781}
1782
1783message TestNestedMessageRedaction {
1784  string optional_unredacted_nested_string = 1;
1785  string optional_redacted_nested_string = 2 [debug_redact = true];
1786}
1787
1788message RedactedFields {
1789  string optional_redacted_string = 1 [debug_redact = true];
1790  string optional_unredacted_string = 2;
1791  repeated string repeated_redacted_string = 3 [debug_redact = true];
1792  repeated string repeated_unredacted_string = 4;
1793  TestNestedMessageRedaction optional_redacted_message = 5 [debug_redact = true];
1794  TestNestedMessageRedaction optional_unredacted_message = 6;
1795  repeated TestNestedMessageRedaction repeated_redacted_message = 7
1796      [debug_redact = true];
1797  repeated TestNestedMessageRedaction repeated_unredacted_message = 8;
1798  map<string, string> map_redacted_string = 9 [debug_redact = true];
1799  map<string, string> map_unredacted_string = 10;
1800}
1801
1802message TestCord{
1803  bytes optional_bytes_cord = 1 [ctype=CORD];
1804  bytes optional_bytes_cord_default = 2 [ctype=CORD, default = "hello"];
1805}
1806
1807message TestPackedEnumSmallRange {
1808  enum NestedEnum {
1809    UNSPECIFIED = 0;
1810    FOO = 1;
1811    BAR = 2;
1812    BAZ = 3;
1813  }
1814  repeated NestedEnum vals = 1
1815      [features.repeated_field_encoding = PACKED];
1816}
1817
1818message EnumsForBenchmark {
1819  enum Flat {
1820    A0 = 0;
1821    A1 = 1;
1822    A2 = 2;
1823    A3 = 3;
1824    A4 = 4;
1825    A5 = 5;
1826    A6 = 6;
1827    A7 = 7;
1828    A8 = 8;
1829    A9 = 9;
1830    A10 = 10;
1831    A11 = 11;
1832    A12 = 12;
1833    A13 = 13;
1834    A14 = 14;
1835    A15 = 15;
1836  }
1837  // Has a few holes, bitmap can be used.
1838  enum AlmostFlat {
1839    B0 = 0;
1840    B1 = 1;
1841    B2 = 2;
1842    B3 = 3;
1843    B5 = 5;
1844    B6 = 6;
1845    B7 = 7;
1846    B8 = 8;
1847    B9 = 9;
1848    B11 = 11;
1849    B12 = 12;
1850    B13 = 13;
1851    B14 = 14;
1852    B15 = 15;
1853    B17 = 17;
1854    B19 = 19;
1855  }
1856  enum Sparse {
1857    C0 = 0;
1858    C536 = 536;
1859    C8387 = 8387;
1860    C9673 = 9673;
1861    C10285 = 10285;
1862    C13318 = 13318;
1863    C15963 = 15963;
1864    C16439 = 16439;
1865    C18197 = 18197;
1866    C19430 = 19430;
1867    C20361 = 20361;
1868    C20706 = 20706;
1869    C21050 = 21050;
1870    C21906 = 21906;
1871    C27265 = 27265;
1872    C30109 = 30109;
1873    C31670 = 31670;
1874  }
1875}
1876
1877message TestMessageWithManyRepeatedPtrFields {
1878  repeated string repeated_string_1 = 1;
1879  repeated string repeated_string_2 = 2;
1880  repeated string repeated_string_3 = 3;
1881  repeated string repeated_string_4 = 4;
1882  repeated string repeated_string_5 = 5;
1883  repeated string repeated_string_6 = 6;
1884  repeated string repeated_string_7 = 7;
1885  repeated string repeated_string_8 = 8;
1886  repeated string repeated_string_9 = 9;
1887  repeated string repeated_string_10 = 10;
1888  repeated string repeated_string_11 = 11;
1889  repeated string repeated_string_12 = 12;
1890  repeated string repeated_string_13 = 13;
1891  repeated string repeated_string_14 = 14;
1892  repeated string repeated_string_15 = 15;
1893  repeated string repeated_string_16 = 16;
1894  repeated string repeated_string_17 = 17;
1895  repeated string repeated_string_18 = 18;
1896  repeated string repeated_string_19 = 19;
1897  repeated string repeated_string_20 = 20;
1898  repeated string repeated_string_21 = 21;
1899  repeated string repeated_string_22 = 22;
1900  repeated string repeated_string_23 = 23;
1901  repeated string repeated_string_24 = 24;
1902  repeated string repeated_string_25 = 25;
1903  repeated string repeated_string_26 = 26;
1904  repeated string repeated_string_27 = 27;
1905  repeated string repeated_string_28 = 28;
1906  repeated string repeated_string_29 = 29;
1907  repeated string repeated_string_30 = 30;
1908  repeated string repeated_string_31 = 31;
1909  repeated string repeated_string_32 = 32;
1910}
1911