aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/include/protobuf/unittest_lite.proto
blob: 92282a6fc7784775102e0e4c8db611f86adda6aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc.  All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// Author: kenton@google.com (Kenton Varda)
//
// This is like unittest.proto but with optimize_for = LITE_RUNTIME.

syntax = "proto2";

package protobuf_unittest;

import "google/protobuf/unittest_import_lite.proto";

option cc_enable_arenas = true;
option optimize_for = LITE_RUNTIME;
option java_package = "com.google.protobuf";

// Same as TestAllTypes but with the lite runtime.
message TestAllTypesLite {
  message NestedMessage {
    optional int32 bb = 1;
    optional int64 cc = 2;
  }

  message NestedMessage2 {
    optional int32 dd = 1;
  }

  enum NestedEnum {
    FOO = 1;
    BAR = 2;
    BAZ = 3;
  }

  // Singular
  optional int32 optional_int32 = 1;
  optional int64 optional_int64 = 2;
  optional uint32 optional_uint32 = 3;
  optional uint64 optional_uint64 = 4;
  optional sint32 optional_sint32 = 5;
  optional sint64 optional_sint64 = 6;
  optional fixed32 optional_fixed32 = 7;
  optional fixed64 optional_fixed64 = 8;
  optional sfixed32 optional_sfixed32 = 9;
  optional sfixed64 optional_sfixed64 = 10;
  optional float optional_float = 11;
  optional double optional_double = 12;
  optional bool optional_bool = 13;
  optional string optional_string = 14;
  optional bytes optional_bytes = 15;

  optional group OptionalGroup = 16 {
    optional int32 a = 17;
  }

  optional NestedMessage optional_nested_message = 18;
  optional ForeignMessageLite optional_foreign_message = 19;
  optional protobuf_unittest_import.ImportMessageLite optional_import_message =
      20;

  optional NestedEnum optional_nested_enum = 21;
  optional ForeignEnumLite optional_foreign_enum = 22;
  optional protobuf_unittest_import.ImportEnumLite optional_import_enum = 23;

  optional string optional_string_piece = 24 [ctype = STRING_PIECE];
  optional string optional_cord = 25 [ctype = CORD];

  // Defined in unittest_import_public.proto
  optional protobuf_unittest_import.PublicImportMessageLite
      optional_public_import_message = 26;

  optional NestedMessage optional_lazy_message = 27 [lazy = true];

  // Repeated
  repeated int32 repeated_int32 = 31;
  repeated int64 repeated_int64 = 32;
  repeated uint32 repeated_uint32 = 33;
  repeated uint64 repeated_uint64 = 34;
  repeated sint32 repeated_sint32 = 35;
  repeated sint64 repeated_sint64 = 36;
  repeated fixed32 repeated_fixed32 = 37;
  repeated fixed64 repeated_fixed64 = 38;
  repeated sfixed32 repeated_sfixed32 = 39;
  repeated sfixed64 repeated_sfixed64 = 40;
  repeated float repeated_float = 41;
  repeated double repeated_double = 42;
  repeated bool repeated_bool = 43;
  repeated string repeated_string = 44;
  repeated bytes repeated_bytes = 45;

  repeated group RepeatedGroup = 46 {
    optional int32 a = 47;
  }

  repeated NestedMessage repeated_nested_message = 48;
  repeated ForeignMessageLite repeated_foreign_message = 49;
  repeated protobuf_unittest_import.ImportMessageLite repeated_import_message =
      50;

  repeated NestedEnum repeated_nested_enum = 51;
  repeated ForeignEnumLite repeated_foreign_enum = 52;
  repeated protobuf_unittest_import.ImportEnumLite repeated_import_enum = 53;

  repeated string repeated_string_piece = 54 [ctype = STRING_PIECE];
  repeated string repeated_cord = 55 [ctype = CORD];

  repeated NestedMessage repeated_lazy_message = 57 [lazy = true];

  // Singular with defaults
  optional int32 default_int32 = 61 [default = 41];
  optional int64 default_int64 = 62 [default = 42];
  optional uint32 default_uint32 = 63 [default = 43];
  optional uint64 default_uint64 = 64 [default = 44];
  optional sint32 default_sint32 = 65 [default = -45];
  optional sint64 default_sint64 = 66 [default = 46];
  optional fixed32 default_fixed32 = 67 [default = 47];
  optional fixed64 default_fixed64 = 68 [default = 48];
  optional sfixed32 default_sfixed32 = 69 [default = 49];
  optional sfixed64 default_sfixed64 = 70 [default = -50];
  optional float default_float = 71 [default = 51.5];
  optional double default_double = 72 [default = 52e3];
  optional bool default_bool = 73 [default = true];
  optional string default_string = 74 [default = "hello"];
  optional bytes default_bytes = 75 [default = "world"];

  optional NestedEnum default_nested_enum = 81 [default = BAR];
  optional ForeignEnumLite default_foreign_enum = 82
      [default = FOREIGN_LITE_BAR];
  optional protobuf_unittest_import.ImportEnumLite default_import_enum = 83
      [default = IMPORT_LITE_BAR];

  optional string default_string_piece = 84
      [ctype = STRING_PIECE, default = "abc"];
  optional string default_cord = 85 [ctype = CORD, default = "123"];

  // For oneof test
  oneof oneof_field {
    uint32 oneof_uint32 = 111;
    NestedMessage oneof_nested_message = 112;
    string oneof_string = 113;
    bytes oneof_bytes = 114;
    NestedMessage oneof_lazy_nested_message = 115 [lazy = true];
    NestedMessage2 oneof_nested_message2 = 117;
  }

  // Tests toString for non-repeated fields with a list suffix
  optional int32 deceptively_named_list = 116;
}

message ForeignMessageLite {
  optional int32 c = 1;
}

enum ForeignEnumLite {
  FOREIGN_LITE_FOO = 4;
  FOREIGN_LITE_BAZ = 6;
  FOREIGN_LITE_BAR = 5;
}

message TestPackedTypesLite {
  repeated int32 packed_int32 = 90 [packed = true];
  repeated int64 packed_int64 = 91 [packed = true];
  repeated uint32 packed_uint32 = 92 [packed = true];
  repeated uint64 packed_uint64 = 93 [packed = true];
  repeated sint32 packed_sint32 = 94 [packed = true];
  repeated sint64 packed_sint64 = 95 [packed = true];
  repeated fixed32 packed_fixed32 = 96 [packed = true];
  repeated fixed64 packed_fixed64 = 97 [packed = true];
  repeated sfixed32 packed_sfixed32 = 98 [packed = true];
  repeated sfixed64 packed_sfixed64 = 99 [packed = true];
  repeated float packed_float = 100 [packed = true];
  repeated double packed_double = 101 [packed = true];
  repeated bool packed_bool = 102 [packed = true];
  repeated ForeignEnumLite packed_enum = 103 [packed = true];
}

message TestAllExtensionsLite {
  extensions 1 to max;
}

extend TestAllExtensionsLite {
  // Singular
  optional int32 optional_int32_extension_lite = 1;
  optional int64 optional_int64_extension_lite = 2;
  optional uint32 optional_uint32_extension_lite = 3;
  optional uint64 optional_uint64_extension_lite = 4;
  optional sint32 optional_sint32_extension_lite = 5;
  optional sint64 optional_sint64_extension_lite = 6;
  optional fixed32 optional_fixed32_extension_lite = 7;
  optional fixed64 optional_fixed64_extension_lite = 8;
  optional sfixed32 optional_sfixed32_extension_lite = 9;
  optional sfixed64 optional_sfixed64_extension_lite = 10;
  optional float optional_float_extension_lite = 11;
  optional double optional_double_extension_lite = 12;
  optional bool optional_bool_extension_lite = 13;
  optional string optional_string_extension_lite = 14;
  optional bytes optional_bytes_extension_lite = 15;

  optional group OptionalGroup_extension_lite = 16 {
    optional int32 a = 17;
  }

  optional TestAllTypesLite.NestedMessage
      optional_nested_message_extension_lite = 18;
  optional ForeignMessageLite optional_foreign_message_extension_lite = 19;
  optional protobuf_unittest_import.ImportMessageLite
      optional_import_message_extension_lite = 20;

  optional TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21;
  optional ForeignEnumLite optional_foreign_enum_extension_lite = 22;
  optional protobuf_unittest_import.ImportEnumLite
      optional_import_enum_extension_lite = 23;

  optional string optional_string_piece_extension_lite = 24
      [ctype = STRING_PIECE];
  optional string optional_cord_extension_lite = 25 [ctype = CORD];

  optional protobuf_unittest_import.PublicImportMessageLite
      optional_public_import_message_extension_lite = 26;

  optional TestAllTypesLite.NestedMessage optional_lazy_message_extension_lite =
      27 [lazy = true];

  // Repeated
  repeated int32 repeated_int32_extension_lite = 31;
  repeated int64 repeated_int64_extension_lite = 32;
  repeated uint32 repeated_uint32_extension_lite = 33;
  repeated uint64 repeated_uint64_extension_lite = 34;
  repeated sint32 repeated_sint32_extension_lite = 35;
  repeated sint64 repeated_sint64_extension_lite = 36;
  repeated fixed32 repeated_fixed32_extension_lite = 37;
  repeated fixed64 repeated_fixed64_extension_lite = 38;
  repeated sfixed32 repeated_sfixed32_extension_lite = 39;
  repeated sfixed64 repeated_sfixed64_extension_lite = 40;
  repeated float repeated_float_extension_lite = 41;
  repeated double repeated_double_extension_lite = 42;
  repeated bool repeated_bool_extension_lite = 43;
  repeated string repeated_string_extension_lite = 44;
  repeated bytes repeated_bytes_extension_lite = 45;

  repeated group RepeatedGroup_extension_lite = 46 {
    optional int32 a = 47;
  }

  repeated TestAllTypesLite.NestedMessage
      repeated_nested_message_extension_lite = 48;
  repeated ForeignMessageLite repeated_foreign_message_extension_lite = 49;
  repeated protobuf_unittest_import.ImportMessageLite
      repeated_import_message_extension_lite = 50;

  repeated TestAllTypesLite.NestedEnum repeated_nested_enum_extension_lite = 51;
  repeated ForeignEnumLite repeated_foreign_enum_extension_lite = 52;
  repeated protobuf_unittest_import.ImportEnumLite
      repeated_import_enum_extension_lite = 53;

  repeated string repeated_string_piece_extension_lite = 54
      [ctype = STRING_PIECE];
  repeated string repeated_cord_extension_lite = 55 [ctype = CORD];

  repeated TestAllTypesLite.NestedMessage repeated_lazy_message_extension_lite =
      57 [lazy = true];

  // Singular with defaults
  optional int32 default_int32_extension_lite = 61 [default = 41];
  optional int64 default_int64_extension_lite = 62 [default = 42];
  optional uint32 default_uint32_extension_lite = 63 [default = 43];
  optional uint64 default_uint64_extension_lite = 64 [default = 44];
  optional sint32 default_sint32_extension_lite = 65 [default = -45];
  optional sint64 default_sint64_extension_lite = 66 [default = 46];
  optional fixed32 default_fixed32_extension_lite = 67 [default = 47];
  optional fixed64 default_fixed64_extension_lite = 68 [default = 48];
  optional sfixed32 default_sfixed32_extension_lite = 69 [default = 49];
  optional sfixed64 default_sfixed64_extension_lite = 70 [default = -50];
  optional float default_float_extension_lite = 71 [default = 51.5];
  optional double default_double_extension_lite = 72 [default = 52e3];
  optional bool default_bool_extension_lite = 73 [default = true];
  optional string default_string_extension_lite = 74 [default = "hello"];
  optional bytes default_bytes_extension_lite = 75 [default = "world"];

  optional TestAllTypesLite.NestedEnum default_nested_enum_extension_lite = 81
      [default = BAR];
  optional ForeignEnumLite default_foreign_enum_extension_lite = 82
      [default = FOREIGN_LITE_BAR];
  optional protobuf_unittest_import.ImportEnumLite
      default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR];

  optional string default_string_piece_extension_lite = 84
      [ctype = STRING_PIECE, default = "abc"];
  optional string default_cord_extension_lite = 85
      [ctype = CORD, default = "123"];

  // For oneof test
  optional uint32 oneof_uint32_extension_lite = 111;
  optional TestAllTypesLite.NestedMessage oneof_nested_message_extension_lite =
      112;
  optional string oneof_string_extension_lite = 113;
  optional bytes oneof_bytes_extension_lite = 114;
}

message TestPackedExtensionsLite {
  extensions 1 to max;
}

extend TestPackedExtensionsLite {
  repeated int32 packed_int32_extension_lite = 90 [packed = true];
  repeated int64 packed_int64_extension_lite = 91 [packed = true];
  repeated uint32 packed_uint32_extension_lite = 92 [packed = true];
  repeated uint64 packed_uint64_extension_lite = 93 [packed = true];
  repeated sint32 packed_sint32_extension_lite = 94 [packed = true];
  repeated sint64 packed_sint64_extension_lite = 95 [packed = true];
  repeated fixed32 packed_fixed32_extension_lite = 96 [packed = true];
  repeated fixed64 packed_fixed64_extension_lite = 97 [packed = true];
  repeated sfixed32 packed_sfixed32_extension_lite = 98 [packed = true];
  repeated sfixed64 packed_sfixed64_extension_lite = 99 [packed = true];
  repeated float packed_float_extension_lite = 100 [packed = true];
  repeated double packed_double_extension_lite = 101 [packed = true];
  repeated bool packed_bool_extension_lite = 102 [packed = true];
  repeated ForeignEnumLite packed_enum_extension_lite = 103 [packed = true];
}

message TestNestedExtensionLite {
  extend TestAllExtensionsLite {
    optional int32 nested_extension = 12345;
  }
}

// Test that deprecated fields work.  We only verify that they compile (at one
// point this failed).
message TestDeprecatedLite {
  optional int32 deprecated_field = 1 [deprecated = true];
  required int32 deprecated_field2 = 2 [deprecated = true];
  optional string deprecated_field3 = 3 [deprecated = true];
  optional TestDeprecatedLite deprecated_field4 = 4 [deprecated = true];
}

// See the comments of the same type in unittest.proto.
message TestParsingMergeLite {
  message RepeatedFieldsGenerator {
    repeated TestAllTypesLite field1 = 1;
    repeated TestAllTypesLite field2 = 2;
    repeated TestAllTypesLite field3 = 3;
    repeated group Group1 = 10 {
      optional TestAllTypesLite field1 = 11;
    }
    repeated group Group2 = 20 {
      optional TestAllTypesLite field1 = 21;
    }
    repeated TestAllTypesLite ext1 = 1000;
    repeated TestAllTypesLite ext2 = 1001;
  }
  required TestAllTypesLite required_all_types = 1;
  optional TestAllTypesLite optional_all_types = 2;
  repeated TestAllTypesLite repeated_all_types = 3;
  optional group OptionalGroup = 10 {
    optional TestAllTypesLite optional_group_all_types = 11;
  }
  repeated group RepeatedGroup = 20 {
    optional TestAllTypesLite repeated_group_all_types = 21;
  }
  extensions 1000 to max;
  extend TestParsingMergeLite {
    optional TestAllTypesLite optional_ext = 1000;
    repeated TestAllTypesLite repeated_ext = 1001;
  }
}

// TestEmptyMessageLite is used to test unknown fields support in lite mode.
message TestEmptyMessageLite {}

// Like above, but declare all field numbers as potential extensions.  No
// actual extensions should ever be defined for this type.
message TestEmptyMessageWithExtensionsLite {
  extensions 1 to max;
}

enum V1EnumLite { V1_FIRST = 1; }

enum V2EnumLite {
  V2_FIRST = 1;
  V2_SECOND = 2;
}

message V1MessageLite {
  required int32 int_field = 1;
  optional V1EnumLite enum_field = 2 [default = V1_FIRST];
}

message V2MessageLite {
  required int32 int_field = 1;
  optional V2EnumLite enum_field = 2 [default = V2_FIRST];
}

message TestHugeFieldNumbersLite {
  optional int32 optional_int32 = 536870000;
  optional int32 fixed_32 = 536870001;
  repeated int32 repeated_int32 = 536870002 [packed = false];
  repeated int32 packed_int32 = 536870003 [packed = true];

  optional ForeignEnumLite optional_enum = 536870004;
  optional string optional_string = 536870005;
  optional bytes optional_bytes = 536870006;
  optional ForeignMessageLite optional_message = 536870007;

  optional group OptionalGroup = 536870008 {
    optional int32 group_a = 536870009;
  }

  map<string, string> string_string_map = 536870010;

  oneof oneof_field {
    uint32 oneof_uint32 = 536870011;
    TestAllTypesLite oneof_test_all_types = 536870012;
    string oneof_string = 536870013;
    bytes oneof_bytes = 536870014;
  }

  extensions 536860000 to 536869999;
}

extend TestHugeFieldNumbersLite {
  optional TestAllTypesLite test_all_types_lite = 536860000;
}

message TestOneofParsingLite {
  oneof oneof_field {
    int32 oneof_int32 = 1;
    TestAllTypesLite oneof_submessage = 2;
    string oneof_string = 3;
    bytes oneof_bytes = 4 [default = "default bytes"];
    string oneof_string_cord = 5 [ctype = CORD, default = "default Cord"];
    bytes oneof_bytes_cord = 6 [ctype = CORD];
    string oneof_string_string_piece = 7 [ctype = STRING_PIECE];
    bytes oneof_bytes_string_piece = 8
        [ctype = STRING_PIECE, default = "default StringPiece"];
    V2EnumLite oneof_enum = 9;
  }
}

// The following four messages are set up to test for wire compatibility between
// packed and non-packed repeated fields. We use the field number 2048, because
// that is large enough to require a 3-byte varint for the tag.
message PackedInt32 {
  repeated int32 repeated_int32 = 2048 [packed = true];
}

message NonPackedInt32 {
  repeated int32 repeated_int32 = 2048;
}

message PackedFixed32 {
  repeated fixed32 repeated_fixed32 = 2048 [packed = true];
}

message NonPackedFixed32 {
  repeated fixed32 repeated_fixed32 = 2048;
}

// Test an enum that has multiple values with the same number.
message DupEnum {
  enum TestEnumWithDupValueLite {
    option allow_alias = true;

    FOO1 = 1;
    BAR1 = 2;
    BAZ = 3;
    FOO2 = 1;
    BAR2 = 2;
  }
}

message RecursiveMessage {
  optional RecursiveMessage recurse = 1;
  optional bytes payload = 2;
}