1ffe3c632Sopenharmony_ci// Protocol Buffers - Google's data interchange format
2ffe3c632Sopenharmony_ci// Copyright 2008 Google Inc.  All rights reserved.
3ffe3c632Sopenharmony_ci// https://developers.google.com/protocol-buffers/
4ffe3c632Sopenharmony_ci//
5ffe3c632Sopenharmony_ci// Redistribution and use in source and binary forms, with or without
6ffe3c632Sopenharmony_ci// modification, are permitted provided that the following conditions are
7ffe3c632Sopenharmony_ci// met:
8ffe3c632Sopenharmony_ci//
9ffe3c632Sopenharmony_ci//     * Redistributions of source code must retain the above copyright
10ffe3c632Sopenharmony_ci// notice, this list of conditions and the following disclaimer.
11ffe3c632Sopenharmony_ci//     * Redistributions in binary form must reproduce the above
12ffe3c632Sopenharmony_ci// copyright notice, this list of conditions and the following disclaimer
13ffe3c632Sopenharmony_ci// in the documentation and/or other materials provided with the
14ffe3c632Sopenharmony_ci// distribution.
15ffe3c632Sopenharmony_ci//     * Neither the name of Google Inc. nor the names of its
16ffe3c632Sopenharmony_ci// contributors may be used to endorse or promote products derived from
17ffe3c632Sopenharmony_ci// this software without specific prior written permission.
18ffe3c632Sopenharmony_ci//
19ffe3c632Sopenharmony_ci// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20ffe3c632Sopenharmony_ci// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21ffe3c632Sopenharmony_ci// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22ffe3c632Sopenharmony_ci// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23ffe3c632Sopenharmony_ci// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24ffe3c632Sopenharmony_ci// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25ffe3c632Sopenharmony_ci// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26ffe3c632Sopenharmony_ci// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27ffe3c632Sopenharmony_ci// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28ffe3c632Sopenharmony_ci// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29ffe3c632Sopenharmony_ci// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30ffe3c632Sopenharmony_ci
31ffe3c632Sopenharmony_ci// Author: kenton@google.com (Kenton Varda)
32ffe3c632Sopenharmony_ci//  Based on original Protocol Buffers design by
33ffe3c632Sopenharmony_ci//  Sanjay Ghemawat, Jeff Dean, and others.
34ffe3c632Sopenharmony_ci//
35ffe3c632Sopenharmony_ci// A proto file we will use for unit testing.
36ffe3c632Sopenharmony_ci
37ffe3c632Sopenharmony_cisyntax = "proto3";
38ffe3c632Sopenharmony_ci
39ffe3c632Sopenharmony_cioption csharp_namespace = "Google.Protobuf.TestProtos";
40ffe3c632Sopenharmony_ci
41ffe3c632Sopenharmony_ci// Only present so we can test that we can read it (as an example
42ffe3c632Sopenharmony_ci// of a non-C# option)
43ffe3c632Sopenharmony_cioption java_outer_classname = "UnittestProto";
44ffe3c632Sopenharmony_ci
45ffe3c632Sopenharmony_ciimport "unittest_import_proto3.proto";
46ffe3c632Sopenharmony_ci
47ffe3c632Sopenharmony_cipackage protobuf_unittest3;
48ffe3c632Sopenharmony_ci
49ffe3c632Sopenharmony_ci// This proto includes every type of field in both singular and repeated
50ffe3c632Sopenharmony_ci// forms.
51ffe3c632Sopenharmony_cimessage TestAllTypes {
52ffe3c632Sopenharmony_ci  message NestedMessage {
53ffe3c632Sopenharmony_ci    // The field name "b" fails to compile in proto1 because it conflicts with
54ffe3c632Sopenharmony_ci    // a local variable named "b" in one of the generated methods.  Doh.
55ffe3c632Sopenharmony_ci    // This file needs to compile in proto1 to test backwards-compatibility.
56ffe3c632Sopenharmony_ci    int32 bb = 1;
57ffe3c632Sopenharmony_ci  }
58ffe3c632Sopenharmony_ci
59ffe3c632Sopenharmony_ci  enum NestedEnum {
60ffe3c632Sopenharmony_ci    NESTED_ENUM_UNSPECIFIED = 0;
61ffe3c632Sopenharmony_ci    FOO = 1;
62ffe3c632Sopenharmony_ci    BAR = 2;
63ffe3c632Sopenharmony_ci    BAZ = 3;
64ffe3c632Sopenharmony_ci    NEG = -1;  // Intentionally negative.
65ffe3c632Sopenharmony_ci  }
66ffe3c632Sopenharmony_ci
67ffe3c632Sopenharmony_ci  // Singular
68ffe3c632Sopenharmony_ci  int32 single_int32 = 1;
69ffe3c632Sopenharmony_ci  int64 single_int64 = 2;
70ffe3c632Sopenharmony_ci  uint32 single_uint32 = 3;
71ffe3c632Sopenharmony_ci  uint64 single_uint64 = 4;
72ffe3c632Sopenharmony_ci  sint32 single_sint32 = 5;
73ffe3c632Sopenharmony_ci  sint64 single_sint64 = 6;
74ffe3c632Sopenharmony_ci  fixed32 single_fixed32 = 7;
75ffe3c632Sopenharmony_ci  fixed64 single_fixed64 = 8;
76ffe3c632Sopenharmony_ci  sfixed32 single_sfixed32 = 9;
77ffe3c632Sopenharmony_ci  sfixed64 single_sfixed64 = 10;
78ffe3c632Sopenharmony_ci  float single_float = 11;
79ffe3c632Sopenharmony_ci  double single_double = 12;
80ffe3c632Sopenharmony_ci  bool single_bool = 13;
81ffe3c632Sopenharmony_ci  string single_string = 14;
82ffe3c632Sopenharmony_ci  bytes single_bytes = 15;
83ffe3c632Sopenharmony_ci
84ffe3c632Sopenharmony_ci  NestedMessage single_nested_message = 18;
85ffe3c632Sopenharmony_ci  ForeignMessage single_foreign_message = 19;
86ffe3c632Sopenharmony_ci  protobuf_unittest_import.ImportMessage single_import_message = 20;
87ffe3c632Sopenharmony_ci
88ffe3c632Sopenharmony_ci  NestedEnum single_nested_enum = 21;
89ffe3c632Sopenharmony_ci  ForeignEnum single_foreign_enum = 22;
90ffe3c632Sopenharmony_ci  protobuf_unittest_import.ImportEnum single_import_enum = 23;
91ffe3c632Sopenharmony_ci
92ffe3c632Sopenharmony_ci  // Defined in unittest_import_public.proto
93ffe3c632Sopenharmony_ci  protobuf_unittest_import.PublicImportMessage
94ffe3c632Sopenharmony_ci      single_public_import_message = 26;
95ffe3c632Sopenharmony_ci
96ffe3c632Sopenharmony_ci  // Repeated
97ffe3c632Sopenharmony_ci  repeated    int32 repeated_int32    = 31;
98ffe3c632Sopenharmony_ci  repeated    int64 repeated_int64    = 32;
99ffe3c632Sopenharmony_ci  repeated   uint32 repeated_uint32   = 33;
100ffe3c632Sopenharmony_ci  repeated   uint64 repeated_uint64   = 34;
101ffe3c632Sopenharmony_ci  repeated   sint32 repeated_sint32   = 35;
102ffe3c632Sopenharmony_ci  repeated   sint64 repeated_sint64   = 36;
103ffe3c632Sopenharmony_ci  repeated  fixed32 repeated_fixed32  = 37;
104ffe3c632Sopenharmony_ci  repeated  fixed64 repeated_fixed64  = 38;
105ffe3c632Sopenharmony_ci  repeated sfixed32 repeated_sfixed32 = 39;
106ffe3c632Sopenharmony_ci  repeated sfixed64 repeated_sfixed64 = 40;
107ffe3c632Sopenharmony_ci  repeated    float repeated_float    = 41;
108ffe3c632Sopenharmony_ci  repeated   double repeated_double   = 42;
109ffe3c632Sopenharmony_ci  repeated     bool repeated_bool     = 43;
110ffe3c632Sopenharmony_ci  repeated   string repeated_string   = 44;
111ffe3c632Sopenharmony_ci  repeated    bytes repeated_bytes    = 45;
112ffe3c632Sopenharmony_ci
113ffe3c632Sopenharmony_ci  repeated NestedMessage                        repeated_nested_message  = 48;
114ffe3c632Sopenharmony_ci  repeated ForeignMessage                       repeated_foreign_message = 49;
115ffe3c632Sopenharmony_ci  repeated protobuf_unittest_import.ImportMessage repeated_import_message  = 50;
116ffe3c632Sopenharmony_ci
117ffe3c632Sopenharmony_ci  repeated NestedEnum                           repeated_nested_enum     = 51;
118ffe3c632Sopenharmony_ci  repeated ForeignEnum                          repeated_foreign_enum    = 52;
119ffe3c632Sopenharmony_ci  repeated protobuf_unittest_import.ImportEnum    repeated_import_enum     = 53;
120ffe3c632Sopenharmony_ci  // Defined in unittest_import_public.proto
121ffe3c632Sopenharmony_ci  repeated protobuf_unittest_import.PublicImportMessage
122ffe3c632Sopenharmony_ci      repeated_public_import_message = 54;
123ffe3c632Sopenharmony_ci
124ffe3c632Sopenharmony_ci  // For oneof test
125ffe3c632Sopenharmony_ci  oneof oneof_field {
126ffe3c632Sopenharmony_ci    uint32 oneof_uint32 = 111;
127ffe3c632Sopenharmony_ci    NestedMessage oneof_nested_message = 112;
128ffe3c632Sopenharmony_ci    string oneof_string = 113;
129ffe3c632Sopenharmony_ci    bytes oneof_bytes = 114;
130ffe3c632Sopenharmony_ci  }
131ffe3c632Sopenharmony_ci}
132ffe3c632Sopenharmony_ci
133ffe3c632Sopenharmony_ci// This proto includes a recursively nested message.
134ffe3c632Sopenharmony_cimessage NestedTestAllTypes {
135ffe3c632Sopenharmony_ci  NestedTestAllTypes child = 1;
136ffe3c632Sopenharmony_ci  TestAllTypes payload = 2;
137ffe3c632Sopenharmony_ci  repeated NestedTestAllTypes repeated_child = 3;
138ffe3c632Sopenharmony_ci}
139ffe3c632Sopenharmony_ci
140ffe3c632Sopenharmony_cimessage TestDeprecatedFields {
141ffe3c632Sopenharmony_ci  int32 deprecated_int32 = 1 [deprecated=true];
142ffe3c632Sopenharmony_ci}
143ffe3c632Sopenharmony_ci
144ffe3c632Sopenharmony_ci// Define these after TestAllTypes to make sure the compiler can handle
145ffe3c632Sopenharmony_ci// that.
146ffe3c632Sopenharmony_cimessage ForeignMessage {
147ffe3c632Sopenharmony_ci  int32 c = 1;
148ffe3c632Sopenharmony_ci}
149ffe3c632Sopenharmony_ci
150ffe3c632Sopenharmony_cienum ForeignEnum {
151ffe3c632Sopenharmony_ci  FOREIGN_UNSPECIFIED = 0;
152ffe3c632Sopenharmony_ci  FOREIGN_FOO = 4;
153ffe3c632Sopenharmony_ci  FOREIGN_BAR = 5;
154ffe3c632Sopenharmony_ci  FOREIGN_BAZ = 6;
155ffe3c632Sopenharmony_ci}
156ffe3c632Sopenharmony_ci
157ffe3c632Sopenharmony_cimessage TestReservedFields {
158ffe3c632Sopenharmony_ci  reserved 2, 15, 9 to 11;
159ffe3c632Sopenharmony_ci  reserved "bar", "baz";
160ffe3c632Sopenharmony_ci}
161ffe3c632Sopenharmony_ci
162ffe3c632Sopenharmony_ci
163ffe3c632Sopenharmony_ci// Test that we can use NestedMessage from outside TestAllTypes.
164ffe3c632Sopenharmony_cimessage TestForeignNested {
165ffe3c632Sopenharmony_ci  TestAllTypes.NestedMessage foreign_nested = 1;
166ffe3c632Sopenharmony_ci}
167ffe3c632Sopenharmony_ci
168ffe3c632Sopenharmony_ci// Test that really large tag numbers don't break anything.
169ffe3c632Sopenharmony_cimessage TestReallyLargeTagNumber {
170ffe3c632Sopenharmony_ci  // The largest possible tag number is 2^28 - 1, since the wire format uses
171ffe3c632Sopenharmony_ci  // three bits to communicate wire type.
172ffe3c632Sopenharmony_ci  int32 a = 1;
173ffe3c632Sopenharmony_ci  int32 bb = 268435455;
174ffe3c632Sopenharmony_ci}
175ffe3c632Sopenharmony_ci
176ffe3c632Sopenharmony_cimessage TestRecursiveMessage {
177ffe3c632Sopenharmony_ci  TestRecursiveMessage a = 1;
178ffe3c632Sopenharmony_ci  int32 i = 2;
179ffe3c632Sopenharmony_ci}
180ffe3c632Sopenharmony_ci
181ffe3c632Sopenharmony_ci// Test that mutual recursion works.
182ffe3c632Sopenharmony_cimessage TestMutualRecursionA {
183ffe3c632Sopenharmony_ci  TestMutualRecursionB bb = 1;
184ffe3c632Sopenharmony_ci}
185ffe3c632Sopenharmony_ci
186ffe3c632Sopenharmony_cimessage TestMutualRecursionB {
187ffe3c632Sopenharmony_ci  TestMutualRecursionA a = 1;
188ffe3c632Sopenharmony_ci  int32 optional_int32 = 2;
189ffe3c632Sopenharmony_ci}
190ffe3c632Sopenharmony_ci
191ffe3c632Sopenharmony_cimessage TestEnumAllowAlias {
192ffe3c632Sopenharmony_ci  TestEnumWithDupValue value = 1;
193ffe3c632Sopenharmony_ci}
194ffe3c632Sopenharmony_ci
195ffe3c632Sopenharmony_ci// Test an enum that has multiple values with the same number.
196ffe3c632Sopenharmony_cienum TestEnumWithDupValue {
197ffe3c632Sopenharmony_ci  TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0;
198ffe3c632Sopenharmony_ci  option allow_alias = true;
199ffe3c632Sopenharmony_ci
200ffe3c632Sopenharmony_ci  FOO1 = 1;
201ffe3c632Sopenharmony_ci  BAR1 = 2;
202ffe3c632Sopenharmony_ci  BAZ = 3;
203ffe3c632Sopenharmony_ci  FOO2 = 1;
204ffe3c632Sopenharmony_ci  BAR2 = 2;
205ffe3c632Sopenharmony_ci}
206ffe3c632Sopenharmony_ci
207ffe3c632Sopenharmony_ci// Test an enum with large, unordered values.
208ffe3c632Sopenharmony_cienum TestSparseEnum {
209ffe3c632Sopenharmony_ci  TEST_SPARSE_ENUM_UNSPECIFIED = 0;
210ffe3c632Sopenharmony_ci  SPARSE_A = 123;
211ffe3c632Sopenharmony_ci  SPARSE_B = 62374;
212ffe3c632Sopenharmony_ci  SPARSE_C = 12589234;
213ffe3c632Sopenharmony_ci  SPARSE_D = -15;
214ffe3c632Sopenharmony_ci  SPARSE_E = -53452;
215ffe3c632Sopenharmony_ci  // In proto3, value 0 must be the first one specified
216ffe3c632Sopenharmony_ci  // SPARSE_F = 0;
217ffe3c632Sopenharmony_ci  SPARSE_G = 2;
218ffe3c632Sopenharmony_ci}
219ffe3c632Sopenharmony_ci
220ffe3c632Sopenharmony_ci// Test message with CamelCase field names.  This violates Protocol Buffer
221ffe3c632Sopenharmony_ci// standard style.
222ffe3c632Sopenharmony_cimessage TestCamelCaseFieldNames {
223ffe3c632Sopenharmony_ci  int32 PrimitiveField = 1;
224ffe3c632Sopenharmony_ci  string StringField = 2;
225ffe3c632Sopenharmony_ci  ForeignEnum EnumField = 3;
226ffe3c632Sopenharmony_ci  ForeignMessage MessageField = 4;
227ffe3c632Sopenharmony_ci
228ffe3c632Sopenharmony_ci  repeated int32 RepeatedPrimitiveField = 7;
229ffe3c632Sopenharmony_ci  repeated string RepeatedStringField = 8;
230ffe3c632Sopenharmony_ci  repeated ForeignEnum RepeatedEnumField = 9;
231ffe3c632Sopenharmony_ci  repeated ForeignMessage RepeatedMessageField = 10;
232ffe3c632Sopenharmony_ci}
233ffe3c632Sopenharmony_ci
234ffe3c632Sopenharmony_ci
235ffe3c632Sopenharmony_ci// We list fields out of order, to ensure that we're using field number and not
236ffe3c632Sopenharmony_ci// field index to determine serialization order.
237ffe3c632Sopenharmony_cimessage TestFieldOrderings {
238ffe3c632Sopenharmony_ci  string my_string = 11;
239ffe3c632Sopenharmony_ci  int64 my_int = 1;
240ffe3c632Sopenharmony_ci  float my_float = 101;
241ffe3c632Sopenharmony_ci  message NestedMessage {
242ffe3c632Sopenharmony_ci    int64 oo = 2;
243ffe3c632Sopenharmony_ci    // The field name "b" fails to compile in proto1 because it conflicts with
244ffe3c632Sopenharmony_ci    // a local variable named "b" in one of the generated methods.  Doh.
245ffe3c632Sopenharmony_ci    // This file needs to compile in proto1 to test backwards-compatibility.
246ffe3c632Sopenharmony_ci    int32 bb = 1;
247ffe3c632Sopenharmony_ci  }
248ffe3c632Sopenharmony_ci
249ffe3c632Sopenharmony_ci  NestedMessage single_nested_message  = 200;
250ffe3c632Sopenharmony_ci}
251ffe3c632Sopenharmony_ci
252ffe3c632Sopenharmony_cimessage SparseEnumMessage {
253ffe3c632Sopenharmony_ci  TestSparseEnum sparse_enum = 1;
254ffe3c632Sopenharmony_ci}
255ffe3c632Sopenharmony_ci
256ffe3c632Sopenharmony_ci// Test String and Bytes: string is for valid UTF-8 strings
257ffe3c632Sopenharmony_cimessage OneString {
258ffe3c632Sopenharmony_ci  string data = 1;
259ffe3c632Sopenharmony_ci}
260ffe3c632Sopenharmony_ci
261ffe3c632Sopenharmony_cimessage MoreString {
262ffe3c632Sopenharmony_ci  repeated string data = 1;
263ffe3c632Sopenharmony_ci}
264ffe3c632Sopenharmony_ci
265ffe3c632Sopenharmony_cimessage OneBytes {
266ffe3c632Sopenharmony_ci  bytes data = 1;
267ffe3c632Sopenharmony_ci}
268ffe3c632Sopenharmony_ci
269ffe3c632Sopenharmony_cimessage MoreBytes {
270ffe3c632Sopenharmony_ci  bytes data = 1;
271ffe3c632Sopenharmony_ci}
272ffe3c632Sopenharmony_ci
273ffe3c632Sopenharmony_ci// Test int32, uint32, int64, uint64, and bool are all compatible
274ffe3c632Sopenharmony_cimessage Int32Message {
275ffe3c632Sopenharmony_ci  int32 data = 1;
276ffe3c632Sopenharmony_ci}
277ffe3c632Sopenharmony_ci
278ffe3c632Sopenharmony_cimessage Uint32Message {
279ffe3c632Sopenharmony_ci  uint32 data = 1;
280ffe3c632Sopenharmony_ci}
281ffe3c632Sopenharmony_ci
282ffe3c632Sopenharmony_cimessage Int64Message {
283ffe3c632Sopenharmony_ci  int64 data = 1;
284ffe3c632Sopenharmony_ci}
285ffe3c632Sopenharmony_ci
286ffe3c632Sopenharmony_cimessage Uint64Message {
287ffe3c632Sopenharmony_ci  uint64 data = 1;
288ffe3c632Sopenharmony_ci}
289ffe3c632Sopenharmony_ci
290ffe3c632Sopenharmony_cimessage BoolMessage {
291ffe3c632Sopenharmony_ci  bool data = 1;
292ffe3c632Sopenharmony_ci}
293ffe3c632Sopenharmony_ci
294ffe3c632Sopenharmony_ci// Test oneofs.
295ffe3c632Sopenharmony_cimessage TestOneof {
296ffe3c632Sopenharmony_ci  oneof foo {
297ffe3c632Sopenharmony_ci    int32 foo_int = 1;
298ffe3c632Sopenharmony_ci    string foo_string = 2;
299ffe3c632Sopenharmony_ci    TestAllTypes foo_message = 3;
300ffe3c632Sopenharmony_ci  }
301ffe3c632Sopenharmony_ci}
302ffe3c632Sopenharmony_ci
303ffe3c632Sopenharmony_ci// Test messages for packed fields
304ffe3c632Sopenharmony_ci
305ffe3c632Sopenharmony_cimessage TestPackedTypes {
306ffe3c632Sopenharmony_ci  repeated    int32 packed_int32    =  90 [packed = true];
307ffe3c632Sopenharmony_ci  repeated    int64 packed_int64    =  91 [packed = true];
308ffe3c632Sopenharmony_ci  repeated   uint32 packed_uint32   =  92 [packed = true];
309ffe3c632Sopenharmony_ci  repeated   uint64 packed_uint64   =  93 [packed = true];
310ffe3c632Sopenharmony_ci  repeated   sint32 packed_sint32   =  94 [packed = true];
311ffe3c632Sopenharmony_ci  repeated   sint64 packed_sint64   =  95 [packed = true];
312ffe3c632Sopenharmony_ci  repeated  fixed32 packed_fixed32  =  96 [packed = true];
313ffe3c632Sopenharmony_ci  repeated  fixed64 packed_fixed64  =  97 [packed = true];
314ffe3c632Sopenharmony_ci  repeated sfixed32 packed_sfixed32 =  98 [packed = true];
315ffe3c632Sopenharmony_ci  repeated sfixed64 packed_sfixed64 =  99 [packed = true];
316ffe3c632Sopenharmony_ci  repeated    float packed_float    = 100 [packed = true];
317ffe3c632Sopenharmony_ci  repeated   double packed_double   = 101 [packed = true];
318ffe3c632Sopenharmony_ci  repeated     bool packed_bool     = 102 [packed = true];
319ffe3c632Sopenharmony_ci  repeated ForeignEnum packed_enum  = 103 [packed = true];
320ffe3c632Sopenharmony_ci}
321ffe3c632Sopenharmony_ci
322ffe3c632Sopenharmony_ci// A message with the same fields as TestPackedTypes, but without packing. Used
323ffe3c632Sopenharmony_ci// to test packed <-> unpacked wire compatibility.
324ffe3c632Sopenharmony_cimessage TestUnpackedTypes {
325ffe3c632Sopenharmony_ci  repeated    int32 unpacked_int32    =  90 [packed = false];
326ffe3c632Sopenharmony_ci  repeated    int64 unpacked_int64    =  91 [packed = false];
327ffe3c632Sopenharmony_ci  repeated   uint32 unpacked_uint32   =  92 [packed = false];
328ffe3c632Sopenharmony_ci  repeated   uint64 unpacked_uint64   =  93 [packed = false];
329ffe3c632Sopenharmony_ci  repeated   sint32 unpacked_sint32   =  94 [packed = false];
330ffe3c632Sopenharmony_ci  repeated   sint64 unpacked_sint64   =  95 [packed = false];
331ffe3c632Sopenharmony_ci  repeated  fixed32 unpacked_fixed32  =  96 [packed = false];
332ffe3c632Sopenharmony_ci  repeated  fixed64 unpacked_fixed64  =  97 [packed = false];
333ffe3c632Sopenharmony_ci  repeated sfixed32 unpacked_sfixed32 =  98 [packed = false];
334ffe3c632Sopenharmony_ci  repeated sfixed64 unpacked_sfixed64 =  99 [packed = false];
335ffe3c632Sopenharmony_ci  repeated    float unpacked_float    = 100 [packed = false];
336ffe3c632Sopenharmony_ci  repeated   double unpacked_double   = 101 [packed = false];
337ffe3c632Sopenharmony_ci  repeated     bool unpacked_bool     = 102 [packed = false];
338ffe3c632Sopenharmony_ci  repeated ForeignEnum unpacked_enum  = 103 [packed = false];
339ffe3c632Sopenharmony_ci}
340ffe3c632Sopenharmony_ci
341ffe3c632Sopenharmony_cimessage TestRepeatedScalarDifferentTagSizes {
342ffe3c632Sopenharmony_ci  // Parsing repeated fixed size values used to fail. This message needs to be
343ffe3c632Sopenharmony_ci  // used in order to get a tag of the right size; all of the repeated fields
344ffe3c632Sopenharmony_ci  // in TestAllTypes didn't trigger the check.
345ffe3c632Sopenharmony_ci  repeated fixed32 repeated_fixed32 = 12;
346ffe3c632Sopenharmony_ci  // Check for a varint type, just for good measure.
347ffe3c632Sopenharmony_ci  repeated int32   repeated_int32   = 13;
348ffe3c632Sopenharmony_ci
349ffe3c632Sopenharmony_ci  // These have two-byte tags.
350ffe3c632Sopenharmony_ci  repeated fixed64 repeated_fixed64 = 2046;
351ffe3c632Sopenharmony_ci  repeated int64   repeated_int64   = 2047;
352ffe3c632Sopenharmony_ci
353ffe3c632Sopenharmony_ci  // Three byte tags.
354ffe3c632Sopenharmony_ci  repeated float   repeated_float   = 262142;
355ffe3c632Sopenharmony_ci  repeated uint64  repeated_uint64  = 262143;
356ffe3c632Sopenharmony_ci}
357ffe3c632Sopenharmony_ci
358ffe3c632Sopenharmony_cimessage TestCommentInjectionMessage {
359ffe3c632Sopenharmony_ci  // */ <- This should not close the generated doc comment
360ffe3c632Sopenharmony_ci  string a = 1;
361ffe3c632Sopenharmony_ci}
362ffe3c632Sopenharmony_ci
363ffe3c632Sopenharmony_ci
364ffe3c632Sopenharmony_ci// Test that RPC services work.
365ffe3c632Sopenharmony_cimessage FooRequest  {}
366ffe3c632Sopenharmony_cimessage FooResponse {}
367ffe3c632Sopenharmony_ci
368ffe3c632Sopenharmony_cimessage FooClientMessage {}
369ffe3c632Sopenharmony_cimessage FooServerMessage{}
370ffe3c632Sopenharmony_ci
371ffe3c632Sopenharmony_ci// This is a test service
372ffe3c632Sopenharmony_ciservice TestService {
373ffe3c632Sopenharmony_ci  // This is a test method
374ffe3c632Sopenharmony_ci  rpc Foo(FooRequest) returns (FooResponse);
375ffe3c632Sopenharmony_ci  rpc Bar(BarRequest) returns (BarResponse);
376ffe3c632Sopenharmony_ci}
377ffe3c632Sopenharmony_ci
378ffe3c632Sopenharmony_ci
379ffe3c632Sopenharmony_cimessage BarRequest  {}
380ffe3c632Sopenharmony_cimessage BarResponse {}
381ffe3c632Sopenharmony_ci
382ffe3c632Sopenharmony_cimessage TestEmptyMessage {}
383ffe3c632Sopenharmony_ci
384ffe3c632Sopenharmony_ci// This is leading detached comment 1
385ffe3c632Sopenharmony_ci
386ffe3c632Sopenharmony_ci// This is leading detached comment 2
387ffe3c632Sopenharmony_ci
388ffe3c632Sopenharmony_ci// This is a leading comment
389ffe3c632Sopenharmony_cimessage CommentMessage {
390ffe3c632Sopenharmony_ci  // Leading nested message comment
391ffe3c632Sopenharmony_ci  message NestedCommentMessage {
392ffe3c632Sopenharmony_ci    // Leading nested message field comment
393ffe3c632Sopenharmony_ci    string nested_text = 1;
394ffe3c632Sopenharmony_ci  }
395ffe3c632Sopenharmony_ci
396ffe3c632Sopenharmony_ci  // Leading nested enum comment
397ffe3c632Sopenharmony_ci  enum NestedCommentEnum {
398ffe3c632Sopenharmony_ci    // Zero value comment
399ffe3c632Sopenharmony_ci    ZERO_VALUE = 0;
400ffe3c632Sopenharmony_ci  }
401ffe3c632Sopenharmony_ci
402ffe3c632Sopenharmony_ci  // Leading field comment
403ffe3c632Sopenharmony_ci  string text = 1; // Trailing field comment
404ffe3c632Sopenharmony_ci}
405ffe3c632Sopenharmony_ci
406ffe3c632Sopenharmony_ci// Leading enum comment
407ffe3c632Sopenharmony_cienum CommentEnum {
408ffe3c632Sopenharmony_ci  // Zero value comment
409ffe3c632Sopenharmony_ci  ZERO_VALUE = 0;
410ffe3c632Sopenharmony_ci}
411