• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Protocol Buffers - Google's data interchange format
2// Copyright 2008 Google Inc.  All rights reserved.
3// http://code.google.com/p/protobuf/
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9//     * Redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer.
11//     * Redistributions in binary form must reproduce the above
12// copyright notice, this list of conditions and the following disclaimer
13// in the documentation and/or other materials provided with the
14// distribution.
15//     * Neither the name of Google Inc. nor the names of its
16// contributors may be used to endorse or promote products derived from
17// this software without specific prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31// Author: kenton@google.com (Kenton Varda)
32//  Based on original Protocol Buffers design by
33//  Sanjay Ghemawat, Jeff Dean, and others.
34//
35// A proto file we will use for unit testing.
36
37
38import "google/protobuf/unittest_import.proto";
39
40// We don't put this in a package within proto2 because we need to make sure
41// that the generated code doesn't depend on being in the proto2 namespace.
42// In test_util.h we do "using namespace unittest = protobuf_unittest".
43package protobuf_unittest;
44
45// Protos optimized for SPEED use a strict superset of the generated code
46// of equivalent ones optimized for CODE_SIZE, so we should optimize all our
47// tests for speed unless explicitly testing code size optimization.
48option optimize_for = SPEED;
49
50option java_outer_classname = "UnittestProto";
51
52// This proto includes every type of field in both singular and repeated
53// forms.
54message TestAllTypes {
55  message NestedMessage {
56    // The field name "b" fails to compile in proto1 because it conflicts with
57    // a local variable named "b" in one of the generated methods.  Doh.
58    // This file needs to compile in proto1 to test backwards-compatibility.
59    optional int32 bb = 1;
60  }
61
62  enum NestedEnum {
63    FOO = 1;
64    BAR = 2;
65    BAZ = 3;
66  }
67
68  // Singular
69  optional    int32 optional_int32    =  1;
70  optional    int64 optional_int64    =  2;
71  optional   uint32 optional_uint32   =  3;
72  optional   uint64 optional_uint64   =  4;
73  optional   sint32 optional_sint32   =  5;
74  optional   sint64 optional_sint64   =  6;
75  optional  fixed32 optional_fixed32  =  7;
76  optional  fixed64 optional_fixed64  =  8;
77  optional sfixed32 optional_sfixed32 =  9;
78  optional sfixed64 optional_sfixed64 = 10;
79  optional    float optional_float    = 11;
80  optional   double optional_double   = 12;
81  optional     bool optional_bool     = 13;
82  optional   string optional_string   = 14;
83  optional    bytes optional_bytes    = 15;
84
85  optional group OptionalGroup = 16 {
86    optional int32 a = 17;
87  }
88
89  optional NestedMessage                        optional_nested_message  = 18;
90  optional ForeignMessage                       optional_foreign_message = 19;
91  optional protobuf_unittest_import.ImportMessage optional_import_message  = 20;
92
93  optional NestedEnum                           optional_nested_enum     = 21;
94  optional ForeignEnum                          optional_foreign_enum    = 22;
95  optional protobuf_unittest_import.ImportEnum    optional_import_enum     = 23;
96
97  optional string optional_string_piece = 24 [ctype=STRING_PIECE];
98  optional string optional_cord = 25 [ctype=CORD];
99
100  // Repeated
101  repeated    int32 repeated_int32    = 31;
102  repeated    int64 repeated_int64    = 32;
103  repeated   uint32 repeated_uint32   = 33;
104  repeated   uint64 repeated_uint64   = 34;
105  repeated   sint32 repeated_sint32   = 35;
106  repeated   sint64 repeated_sint64   = 36;
107  repeated  fixed32 repeated_fixed32  = 37;
108  repeated  fixed64 repeated_fixed64  = 38;
109  repeated sfixed32 repeated_sfixed32 = 39;
110  repeated sfixed64 repeated_sfixed64 = 40;
111  repeated    float repeated_float    = 41;
112  repeated   double repeated_double   = 42;
113  repeated     bool repeated_bool     = 43;
114  repeated   string repeated_string   = 44;
115  repeated    bytes repeated_bytes    = 45;
116
117  repeated group RepeatedGroup = 46 {
118    optional int32 a = 47;
119  }
120
121  repeated NestedMessage                        repeated_nested_message  = 48;
122  repeated ForeignMessage                       repeated_foreign_message = 49;
123  repeated protobuf_unittest_import.ImportMessage repeated_import_message  = 50;
124
125  repeated NestedEnum                           repeated_nested_enum     = 51;
126  repeated ForeignEnum                          repeated_foreign_enum    = 52;
127  repeated protobuf_unittest_import.ImportEnum    repeated_import_enum     = 53;
128
129  repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
130  repeated string repeated_cord = 55 [ctype=CORD];
131
132  // Singular with defaults
133  optional    int32 default_int32    = 61 [default =  41    ];
134  optional    int64 default_int64    = 62 [default =  42    ];
135  optional   uint32 default_uint32   = 63 [default =  43    ];
136  optional   uint64 default_uint64   = 64 [default =  44    ];
137  optional   sint32 default_sint32   = 65 [default = -45    ];
138  optional   sint64 default_sint64   = 66 [default =  46    ];
139  optional  fixed32 default_fixed32  = 67 [default =  47    ];
140  optional  fixed64 default_fixed64  = 68 [default =  48    ];
141  optional sfixed32 default_sfixed32 = 69 [default =  49    ];
142  optional sfixed64 default_sfixed64 = 70 [default = -50    ];
143  optional    float default_float    = 71 [default =  51.5  ];
144  optional   double default_double   = 72 [default =  52e3  ];
145  optional     bool default_bool     = 73 [default = true   ];
146  optional   string default_string   = 74 [default = "hello"];
147  optional    bytes default_bytes    = 75 [default = "world"];
148
149  optional NestedEnum  default_nested_enum  = 81 [default = BAR        ];
150  optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR];
151  optional protobuf_unittest_import.ImportEnum
152      default_import_enum = 83 [default = IMPORT_BAR];
153
154  optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
155  optional string default_cord = 85 [ctype=CORD,default="123"];
156}
157
158message TestDeprecatedFields {
159  optional int32 deprecated_int32 = 1 [deprecated=true];
160}
161
162// Define these after TestAllTypes to make sure the compiler can handle
163// that.
164message ForeignMessage {
165  optional int32 c = 1;
166}
167
168enum ForeignEnum {
169  FOREIGN_FOO = 4;
170  FOREIGN_BAR = 5;
171  FOREIGN_BAZ = 6;
172}
173
174message TestAllExtensions {
175  extensions 1 to max;
176}
177
178extend TestAllExtensions {
179  // Singular
180  optional    int32 optional_int32_extension    =  1;
181  optional    int64 optional_int64_extension    =  2;
182  optional   uint32 optional_uint32_extension   =  3;
183  optional   uint64 optional_uint64_extension   =  4;
184  optional   sint32 optional_sint32_extension   =  5;
185  optional   sint64 optional_sint64_extension   =  6;
186  optional  fixed32 optional_fixed32_extension  =  7;
187  optional  fixed64 optional_fixed64_extension  =  8;
188  optional sfixed32 optional_sfixed32_extension =  9;
189  optional sfixed64 optional_sfixed64_extension = 10;
190  optional    float optional_float_extension    = 11;
191  optional   double optional_double_extension   = 12;
192  optional     bool optional_bool_extension     = 13;
193  optional   string optional_string_extension   = 14;
194  optional    bytes optional_bytes_extension    = 15;
195
196  optional group OptionalGroup_extension = 16 {
197    optional int32 a = 17;
198  }
199
200  optional TestAllTypes.NestedMessage optional_nested_message_extension = 18;
201  optional ForeignMessage optional_foreign_message_extension = 19;
202  optional protobuf_unittest_import.ImportMessage
203    optional_import_message_extension = 20;
204
205  optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21;
206  optional ForeignEnum optional_foreign_enum_extension = 22;
207  optional protobuf_unittest_import.ImportEnum
208    optional_import_enum_extension = 23;
209
210  optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE];
211  optional string optional_cord_extension = 25 [ctype=CORD];
212
213  // Repeated
214  repeated    int32 repeated_int32_extension    = 31;
215  repeated    int64 repeated_int64_extension    = 32;
216  repeated   uint32 repeated_uint32_extension   = 33;
217  repeated   uint64 repeated_uint64_extension   = 34;
218  repeated   sint32 repeated_sint32_extension   = 35;
219  repeated   sint64 repeated_sint64_extension   = 36;
220  repeated  fixed32 repeated_fixed32_extension  = 37;
221  repeated  fixed64 repeated_fixed64_extension  = 38;
222  repeated sfixed32 repeated_sfixed32_extension = 39;
223  repeated sfixed64 repeated_sfixed64_extension = 40;
224  repeated    float repeated_float_extension    = 41;
225  repeated   double repeated_double_extension   = 42;
226  repeated     bool repeated_bool_extension     = 43;
227  repeated   string repeated_string_extension   = 44;
228  repeated    bytes repeated_bytes_extension    = 45;
229
230  repeated group RepeatedGroup_extension = 46 {
231    optional int32 a = 47;
232  }
233
234  repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48;
235  repeated ForeignMessage repeated_foreign_message_extension = 49;
236  repeated protobuf_unittest_import.ImportMessage
237    repeated_import_message_extension = 50;
238
239  repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51;
240  repeated ForeignEnum repeated_foreign_enum_extension = 52;
241  repeated protobuf_unittest_import.ImportEnum
242    repeated_import_enum_extension = 53;
243
244  repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE];
245  repeated string repeated_cord_extension = 55 [ctype=CORD];
246
247  // Singular with defaults
248  optional    int32 default_int32_extension    = 61 [default =  41    ];
249  optional    int64 default_int64_extension    = 62 [default =  42    ];
250  optional   uint32 default_uint32_extension   = 63 [default =  43    ];
251  optional   uint64 default_uint64_extension   = 64 [default =  44    ];
252  optional   sint32 default_sint32_extension   = 65 [default = -45    ];
253  optional   sint64 default_sint64_extension   = 66 [default =  46    ];
254  optional  fixed32 default_fixed32_extension  = 67 [default =  47    ];
255  optional  fixed64 default_fixed64_extension  = 68 [default =  48    ];
256  optional sfixed32 default_sfixed32_extension = 69 [default =  49    ];
257  optional sfixed64 default_sfixed64_extension = 70 [default = -50    ];
258  optional    float default_float_extension    = 71 [default =  51.5  ];
259  optional   double default_double_extension   = 72 [default =  52e3  ];
260  optional     bool default_bool_extension     = 73 [default = true   ];
261  optional   string default_string_extension   = 74 [default = "hello"];
262  optional    bytes default_bytes_extension    = 75 [default = "world"];
263
264  optional TestAllTypes.NestedEnum
265    default_nested_enum_extension = 81 [default = BAR];
266  optional ForeignEnum
267    default_foreign_enum_extension = 82 [default = FOREIGN_BAR];
268  optional protobuf_unittest_import.ImportEnum
269    default_import_enum_extension = 83 [default = IMPORT_BAR];
270
271  optional string default_string_piece_extension = 84 [ctype=STRING_PIECE,
272                                                       default="abc"];
273  optional string default_cord_extension = 85 [ctype=CORD, default="123"];
274}
275
276message TestNestedExtension {
277  extend TestAllExtensions {
278    // Check for bug where string extensions declared in tested scope did not
279    // compile.
280    optional string test = 1002 [default="test"];
281  }
282}
283
284// We have separate messages for testing required fields because it's
285// annoying to have to fill in required fields in TestProto in order to
286// do anything with it.  Note that we don't need to test every type of
287// required filed because the code output is basically identical to
288// optional fields for all types.
289message TestRequired {
290  required int32 a = 1;
291  optional int32 dummy2 = 2;
292  required int32 b = 3;
293
294  extend TestAllExtensions {
295    optional TestRequired single = 1000;
296    repeated TestRequired multi  = 1001;
297  }
298
299  // Pad the field count to 32 so that we can test that IsInitialized()
300  // properly checks multiple elements of has_bits_.
301  optional int32 dummy4  =  4;
302  optional int32 dummy5  =  5;
303  optional int32 dummy6  =  6;
304  optional int32 dummy7  =  7;
305  optional int32 dummy8  =  8;
306  optional int32 dummy9  =  9;
307  optional int32 dummy10 = 10;
308  optional int32 dummy11 = 11;
309  optional int32 dummy12 = 12;
310  optional int32 dummy13 = 13;
311  optional int32 dummy14 = 14;
312  optional int32 dummy15 = 15;
313  optional int32 dummy16 = 16;
314  optional int32 dummy17 = 17;
315  optional int32 dummy18 = 18;
316  optional int32 dummy19 = 19;
317  optional int32 dummy20 = 20;
318  optional int32 dummy21 = 21;
319  optional int32 dummy22 = 22;
320  optional int32 dummy23 = 23;
321  optional int32 dummy24 = 24;
322  optional int32 dummy25 = 25;
323  optional int32 dummy26 = 26;
324  optional int32 dummy27 = 27;
325  optional int32 dummy28 = 28;
326  optional int32 dummy29 = 29;
327  optional int32 dummy30 = 30;
328  optional int32 dummy31 = 31;
329  optional int32 dummy32 = 32;
330
331  required int32 c = 33;
332}
333
334message TestRequiredForeign {
335  optional TestRequired optional_message = 1;
336  repeated TestRequired repeated_message = 2;
337  optional int32 dummy = 3;
338}
339
340// Test that we can use NestedMessage from outside TestAllTypes.
341message TestForeignNested {
342  optional TestAllTypes.NestedMessage foreign_nested = 1;
343}
344
345// TestEmptyMessage is used to test unknown field support.
346message TestEmptyMessage {
347}
348
349// Like above, but declare all field numbers as potential extensions.  No
350// actual extensions should ever be defined for this type.
351message TestEmptyMessageWithExtensions {
352  extensions 1 to max;
353}
354
355message TestMultipleExtensionRanges {
356  extensions 42;
357  extensions 4143 to 4243;
358  extensions 65536 to max;
359}
360
361// Test that really large tag numbers don't break anything.
362message TestReallyLargeTagNumber {
363  // The largest possible tag number is 2^28 - 1, since the wire format uses
364  // three bits to communicate wire type.
365  optional int32 a = 1;
366  optional int32 bb = 268435455;
367}
368
369message TestRecursiveMessage {
370  optional TestRecursiveMessage a = 1;
371  optional int32 i = 2;
372}
373
374// Test that mutual recursion works.
375message TestMutualRecursionA {
376  optional TestMutualRecursionB bb = 1;
377}
378
379message TestMutualRecursionB {
380  optional TestMutualRecursionA a = 1;
381  optional int32 optional_int32 = 2;
382}
383
384// Test that groups have disjoint field numbers from their siblings and
385// parents.  This is NOT possible in proto1; only proto2.  When attempting
386// to compile with proto1, this will emit an error; so we only include it
387// in protobuf_unittest_proto.
388message TestDupFieldNumber {                        // NO_PROTO1
389  optional int32 a = 1;                             // NO_PROTO1
390  optional group Foo = 2 { optional int32 a = 1; }  // NO_PROTO1
391  optional group Bar = 3 { optional int32 a = 1; }  // NO_PROTO1
392}                                                   // NO_PROTO1
393
394
395// Needed for a Python test.
396message TestNestedMessageHasBits {
397  message NestedMessage {
398    repeated int32 nestedmessage_repeated_int32 = 1;
399    repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2;
400  }
401  optional NestedMessage optional_nested_message = 1;
402}
403
404
405// Test an enum that has multiple values with the same number.
406enum TestEnumWithDupValue {
407  FOO1 = 1;
408  BAR1 = 2;
409  BAZ = 3;
410  FOO2 = 1;
411  BAR2 = 2;
412}
413
414// Test an enum with large, unordered values.
415enum TestSparseEnum {
416  SPARSE_A = 123;
417  SPARSE_B = 62374;
418  SPARSE_C = 12589234;
419  SPARSE_D = -15;
420  SPARSE_E = -53452;
421  SPARSE_F = 0;
422  SPARSE_G = 2;
423}
424
425// Test message with CamelCase field names.  This violates Protocol Buffer
426// standard style.
427message TestCamelCaseFieldNames {
428  optional int32 PrimitiveField = 1;
429  optional string StringField = 2;
430  optional ForeignEnum EnumField = 3;
431  optional ForeignMessage MessageField = 4;
432  optional string StringPieceField = 5 [ctype=STRING_PIECE];
433  optional string CordField = 6 [ctype=CORD];
434
435  repeated int32 RepeatedPrimitiveField = 7;
436  repeated string RepeatedStringField = 8;
437  repeated ForeignEnum RepeatedEnumField = 9;
438  repeated ForeignMessage RepeatedMessageField = 10;
439  repeated string RepeatedStringPieceField = 11 [ctype=STRING_PIECE];
440  repeated string RepeatedCordField = 12 [ctype=CORD];
441}
442
443
444// We list fields out of order, to ensure that we're using field number and not
445// field index to determine serialization order.
446message TestFieldOrderings {
447  optional string my_string = 11;
448  extensions 2 to 10;
449  optional int64 my_int = 1;
450  extensions 12 to 100;
451  optional float my_float = 101;
452}
453
454
455extend TestFieldOrderings {
456  optional string my_extension_string = 50;
457  optional int32 my_extension_int = 5;
458}
459
460
461message TestExtremeDefaultValues {
462  optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
463  optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF];
464  optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF];
465  optional  int32 small_int32  = 4 [default = -0x7FFFFFFF];
466  optional  int64 small_int64  = 5 [default = -0x7FFFFFFFFFFFFFFF];
467
468  // The default value here is UTF-8 for "\u1234".  (We could also just type
469  // the UTF-8 text directly into this text file rather than escape it, but
470  // lots of people use editors that would be confused by this.)
471  optional string utf8_string = 6 [default = "\341\210\264"];
472
473  // Tests for single-precision floating-point values.
474  optional float zero_float = 7 [default = 0];
475  optional float one_float = 8 [default = 1];
476  optional float small_float = 9 [default = 1.5];
477  optional float negative_one_float = 10 [default = -1];
478  optional float negative_float = 11 [default = -1.5];
479  // Using exponents
480  optional float large_float = 12 [default = 2E8];
481  optional float small_negative_float = 13 [default = -8e-28];
482
483  // Text for nonfinite floating-point values.
484  optional double inf_double = 14 [default = inf];
485  optional double neg_inf_double = 15 [default = -inf];
486  optional double nan_double = 16 [default = nan];
487  optional float inf_float = 17 [default = inf];
488  optional float neg_inf_float = 18 [default = -inf];
489  optional float nan_float = 19 [default = nan];
490}
491
492// Test String and Bytes: string is for valid UTF-8 strings
493message OneString {
494  optional string data = 1;
495}
496
497message OneBytes {
498  optional bytes data = 1;
499}
500
501// Test messages for packed fields
502
503message TestPackedTypes {
504  repeated    int32 packed_int32    =  90 [packed = true];
505  repeated    int64 packed_int64    =  91 [packed = true];
506  repeated   uint32 packed_uint32   =  92 [packed = true];
507  repeated   uint64 packed_uint64   =  93 [packed = true];
508  repeated   sint32 packed_sint32   =  94 [packed = true];
509  repeated   sint64 packed_sint64   =  95 [packed = true];
510  repeated  fixed32 packed_fixed32  =  96 [packed = true];
511  repeated  fixed64 packed_fixed64  =  97 [packed = true];
512  repeated sfixed32 packed_sfixed32 =  98 [packed = true];
513  repeated sfixed64 packed_sfixed64 =  99 [packed = true];
514  repeated    float packed_float    = 100 [packed = true];
515  repeated   double packed_double   = 101 [packed = true];
516  repeated     bool packed_bool     = 102 [packed = true];
517  repeated ForeignEnum packed_enum  = 103 [packed = true];
518}
519
520// A message with the same fields as TestPackedTypes, but without packing. Used
521// to test packed <-> unpacked wire compatibility.
522message TestUnpackedTypes {
523  repeated    int32 unpacked_int32    =  90 [packed = false];
524  repeated    int64 unpacked_int64    =  91 [packed = false];
525  repeated   uint32 unpacked_uint32   =  92 [packed = false];
526  repeated   uint64 unpacked_uint64   =  93 [packed = false];
527  repeated   sint32 unpacked_sint32   =  94 [packed = false];
528  repeated   sint64 unpacked_sint64   =  95 [packed = false];
529  repeated  fixed32 unpacked_fixed32  =  96 [packed = false];
530  repeated  fixed64 unpacked_fixed64  =  97 [packed = false];
531  repeated sfixed32 unpacked_sfixed32 =  98 [packed = false];
532  repeated sfixed64 unpacked_sfixed64 =  99 [packed = false];
533  repeated    float unpacked_float    = 100 [packed = false];
534  repeated   double unpacked_double   = 101 [packed = false];
535  repeated     bool unpacked_bool     = 102 [packed = false];
536  repeated ForeignEnum unpacked_enum  = 103 [packed = false];
537}
538
539message TestPackedExtensions {
540  extensions 1 to max;
541}
542
543extend TestPackedExtensions {
544  repeated    int32 packed_int32_extension    =  90 [packed = true];
545  repeated    int64 packed_int64_extension    =  91 [packed = true];
546  repeated   uint32 packed_uint32_extension   =  92 [packed = true];
547  repeated   uint64 packed_uint64_extension   =  93 [packed = true];
548  repeated   sint32 packed_sint32_extension   =  94 [packed = true];
549  repeated   sint64 packed_sint64_extension   =  95 [packed = true];
550  repeated  fixed32 packed_fixed32_extension  =  96 [packed = true];
551  repeated  fixed64 packed_fixed64_extension  =  97 [packed = true];
552  repeated sfixed32 packed_sfixed32_extension =  98 [packed = true];
553  repeated sfixed64 packed_sfixed64_extension =  99 [packed = true];
554  repeated    float packed_float_extension    = 100 [packed = true];
555  repeated   double packed_double_extension   = 101 [packed = true];
556  repeated     bool packed_bool_extension     = 102 [packed = true];
557  repeated ForeignEnum packed_enum_extension  = 103 [packed = true];
558}
559
560// Used by ExtensionSetTest/DynamicExtensions.  The test actually builds
561// a set of extensions to TestAllExtensions dynamically, based on the fields
562// of this message type.
563message TestDynamicExtensions {
564  enum DynamicEnumType {
565    DYNAMIC_FOO = 2200;
566    DYNAMIC_BAR = 2201;
567    DYNAMIC_BAZ = 2202;
568  }
569  message DynamicMessageType {
570    optional int32 dynamic_field = 2100;
571  }
572
573  optional fixed32 scalar_extension = 2000;
574  optional ForeignEnum enum_extension = 2001;
575  optional DynamicEnumType dynamic_enum_extension = 2002;
576
577  optional ForeignMessage message_extension = 2003;
578  optional DynamicMessageType dynamic_message_extension = 2004;
579
580  repeated string repeated_extension = 2005;
581  repeated sint32 packed_extension = 2006 [packed = true];
582}
583
584message TestRepeatedScalarDifferentTagSizes {
585  // Parsing repeated fixed size values used to fail. This message needs to be
586  // used in order to get a tag of the right size; all of the repeated fields
587  // in TestAllTypes didn't trigger the check.
588  repeated fixed32 repeated_fixed32 = 12;
589  // Check for a varint type, just for good measure.
590  repeated int32   repeated_int32   = 13;
591
592  // These have two-byte tags.
593  repeated fixed64 repeated_fixed64 = 2046;
594  repeated int64   repeated_int64   = 2047;
595
596  // Three byte tags.
597  repeated float   repeated_float   = 262142;
598  repeated uint64  repeated_uint64  = 262143;
599}
600
601// Test that RPC services work.
602message FooRequest  {}
603message FooResponse {}
604
605service TestService {
606  rpc Foo(FooRequest) returns (FooResponse);
607  rpc Bar(BarRequest) returns (BarResponse);
608}
609
610
611message BarRequest  {}
612message BarResponse {}
613