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_ci// LINT: ALLOW_GROUPS, LEGACY_NAMES 38ffe3c632Sopenharmony_ci 39ffe3c632Sopenharmony_cisyntax = "proto2"; 40ffe3c632Sopenharmony_ci 41ffe3c632Sopenharmony_ci// Some generic_services option(s) added automatically. 42ffe3c632Sopenharmony_ci// See: http://go/proto2-generic-services-default 43ffe3c632Sopenharmony_cioption cc_generic_services = true; // auto-added 44ffe3c632Sopenharmony_cioption java_generic_services = true; // auto-added 45ffe3c632Sopenharmony_cioption py_generic_services = true; // auto-added 46ffe3c632Sopenharmony_cioption cc_enable_arenas = true; 47ffe3c632Sopenharmony_ci 48ffe3c632Sopenharmony_ciimport "unittest_import.proto"; 49ffe3c632Sopenharmony_ci 50ffe3c632Sopenharmony_ci// We don't put this in a package within proto2 because we need to make sure 51ffe3c632Sopenharmony_ci// that the generated code doesn't depend on being in the proto2 namespace. 52ffe3c632Sopenharmony_ci// In test_util.h we do "using namespace unittest = protobuf_unittest". 53ffe3c632Sopenharmony_cipackage protobuf_unittest_proto2; 54ffe3c632Sopenharmony_ci 55ffe3c632Sopenharmony_ci// Protos optimized for SPEED use a strict superset of the generated code 56ffe3c632Sopenharmony_ci// of equivalent ones optimized for CODE_SIZE, so we should optimize all our 57ffe3c632Sopenharmony_ci// tests for speed unless explicitly testing code size optimization. 58ffe3c632Sopenharmony_cioption optimize_for = SPEED; 59ffe3c632Sopenharmony_ci 60ffe3c632Sopenharmony_cioption csharp_namespace = "Google.Protobuf.TestProtos.Proto2"; 61ffe3c632Sopenharmony_ci 62ffe3c632Sopenharmony_ci// This proto includes every type of field in both singular and repeated 63ffe3c632Sopenharmony_ci// forms. 64ffe3c632Sopenharmony_cimessage TestAllTypes { 65ffe3c632Sopenharmony_ci message NestedMessage { 66ffe3c632Sopenharmony_ci // The field name "b" fails to compile in proto1 because it conflicts with 67ffe3c632Sopenharmony_ci // a local variable named "b" in one of the generated methods. Doh. 68ffe3c632Sopenharmony_ci // This file needs to compile in proto1 to test backwards-compatibility. 69ffe3c632Sopenharmony_ci optional int32 bb = 1; 70ffe3c632Sopenharmony_ci } 71ffe3c632Sopenharmony_ci 72ffe3c632Sopenharmony_ci enum NestedEnum { 73ffe3c632Sopenharmony_ci FOO = 1; 74ffe3c632Sopenharmony_ci BAR = 2; 75ffe3c632Sopenharmony_ci BAZ = 3; 76ffe3c632Sopenharmony_ci NEG = -1; // Intentionally negative. 77ffe3c632Sopenharmony_ci } 78ffe3c632Sopenharmony_ci 79ffe3c632Sopenharmony_ci // Singular 80ffe3c632Sopenharmony_ci optional int32 optional_int32 = 1; 81ffe3c632Sopenharmony_ci optional int64 optional_int64 = 2; 82ffe3c632Sopenharmony_ci optional uint32 optional_uint32 = 3; 83ffe3c632Sopenharmony_ci optional uint64 optional_uint64 = 4; 84ffe3c632Sopenharmony_ci optional sint32 optional_sint32 = 5; 85ffe3c632Sopenharmony_ci optional sint64 optional_sint64 = 6; 86ffe3c632Sopenharmony_ci optional fixed32 optional_fixed32 = 7; 87ffe3c632Sopenharmony_ci optional fixed64 optional_fixed64 = 8; 88ffe3c632Sopenharmony_ci optional sfixed32 optional_sfixed32 = 9; 89ffe3c632Sopenharmony_ci optional sfixed64 optional_sfixed64 = 10; 90ffe3c632Sopenharmony_ci optional float optional_float = 11; 91ffe3c632Sopenharmony_ci optional double optional_double = 12; 92ffe3c632Sopenharmony_ci optional bool optional_bool = 13; 93ffe3c632Sopenharmony_ci optional string optional_string = 14; 94ffe3c632Sopenharmony_ci optional bytes optional_bytes = 15; 95ffe3c632Sopenharmony_ci 96ffe3c632Sopenharmony_ci optional group OptionalGroup = 16 { 97ffe3c632Sopenharmony_ci optional int32 a = 17; 98ffe3c632Sopenharmony_ci } 99ffe3c632Sopenharmony_ci 100ffe3c632Sopenharmony_ci optional NestedMessage optional_nested_message = 18; 101ffe3c632Sopenharmony_ci optional ForeignMessage optional_foreign_message = 19; 102ffe3c632Sopenharmony_ci optional protobuf_unittest_import_proto2.ImportMessage optional_import_message = 20; 103ffe3c632Sopenharmony_ci 104ffe3c632Sopenharmony_ci optional NestedEnum optional_nested_enum = 21; 105ffe3c632Sopenharmony_ci optional ForeignEnum optional_foreign_enum = 22; 106ffe3c632Sopenharmony_ci optional protobuf_unittest_import_proto2.ImportEnum optional_import_enum = 23; 107ffe3c632Sopenharmony_ci 108ffe3c632Sopenharmony_ci optional string optional_string_piece = 24 [ctype=STRING_PIECE]; 109ffe3c632Sopenharmony_ci optional string optional_cord = 25 [ctype=CORD]; 110ffe3c632Sopenharmony_ci 111ffe3c632Sopenharmony_ci // Defined in unittest_import_public.proto 112ffe3c632Sopenharmony_ci optional protobuf_unittest_import_proto2.PublicImportMessage 113ffe3c632Sopenharmony_ci optional_public_import_message = 26; 114ffe3c632Sopenharmony_ci 115ffe3c632Sopenharmony_ci optional NestedMessage optional_lazy_message = 27 [lazy=true]; 116ffe3c632Sopenharmony_ci 117ffe3c632Sopenharmony_ci // Repeated 118ffe3c632Sopenharmony_ci repeated int32 repeated_int32 = 31; 119ffe3c632Sopenharmony_ci repeated int64 repeated_int64 = 32; 120ffe3c632Sopenharmony_ci repeated uint32 repeated_uint32 = 33; 121ffe3c632Sopenharmony_ci repeated uint64 repeated_uint64 = 34; 122ffe3c632Sopenharmony_ci repeated sint32 repeated_sint32 = 35; 123ffe3c632Sopenharmony_ci repeated sint64 repeated_sint64 = 36; 124ffe3c632Sopenharmony_ci repeated fixed32 repeated_fixed32 = 37; 125ffe3c632Sopenharmony_ci repeated fixed64 repeated_fixed64 = 38; 126ffe3c632Sopenharmony_ci repeated sfixed32 repeated_sfixed32 = 39; 127ffe3c632Sopenharmony_ci repeated sfixed64 repeated_sfixed64 = 40; 128ffe3c632Sopenharmony_ci repeated float repeated_float = 41; 129ffe3c632Sopenharmony_ci repeated double repeated_double = 42; 130ffe3c632Sopenharmony_ci repeated bool repeated_bool = 43; 131ffe3c632Sopenharmony_ci repeated string repeated_string = 44; 132ffe3c632Sopenharmony_ci repeated bytes repeated_bytes = 45; 133ffe3c632Sopenharmony_ci 134ffe3c632Sopenharmony_ci repeated group RepeatedGroup = 46 { 135ffe3c632Sopenharmony_ci optional int32 a = 47; 136ffe3c632Sopenharmony_ci } 137ffe3c632Sopenharmony_ci 138ffe3c632Sopenharmony_ci repeated NestedMessage repeated_nested_message = 48; 139ffe3c632Sopenharmony_ci repeated ForeignMessage repeated_foreign_message = 49; 140ffe3c632Sopenharmony_ci repeated protobuf_unittest_import_proto2.ImportMessage repeated_import_message = 50; 141ffe3c632Sopenharmony_ci 142ffe3c632Sopenharmony_ci repeated NestedEnum repeated_nested_enum = 51; 143ffe3c632Sopenharmony_ci repeated ForeignEnum repeated_foreign_enum = 52; 144ffe3c632Sopenharmony_ci repeated protobuf_unittest_import_proto2.ImportEnum repeated_import_enum = 53; 145ffe3c632Sopenharmony_ci 146ffe3c632Sopenharmony_ci repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; 147ffe3c632Sopenharmony_ci repeated string repeated_cord = 55 [ctype=CORD]; 148ffe3c632Sopenharmony_ci 149ffe3c632Sopenharmony_ci repeated NestedMessage repeated_lazy_message = 57 [lazy=true]; 150ffe3c632Sopenharmony_ci 151ffe3c632Sopenharmony_ci // Singular with defaults 152ffe3c632Sopenharmony_ci optional int32 default_int32 = 61 [default = 41 ]; 153ffe3c632Sopenharmony_ci optional int64 default_int64 = 62 [default = 42 ]; 154ffe3c632Sopenharmony_ci optional uint32 default_uint32 = 63 [default = 43 ]; 155ffe3c632Sopenharmony_ci optional uint64 default_uint64 = 64 [default = 44 ]; 156ffe3c632Sopenharmony_ci optional sint32 default_sint32 = 65 [default = -45 ]; 157ffe3c632Sopenharmony_ci optional sint64 default_sint64 = 66 [default = 46 ]; 158ffe3c632Sopenharmony_ci optional fixed32 default_fixed32 = 67 [default = 47 ]; 159ffe3c632Sopenharmony_ci optional fixed64 default_fixed64 = 68 [default = 48 ]; 160ffe3c632Sopenharmony_ci optional sfixed32 default_sfixed32 = 69 [default = 49 ]; 161ffe3c632Sopenharmony_ci optional sfixed64 default_sfixed64 = 70 [default = -50 ]; 162ffe3c632Sopenharmony_ci optional float default_float = 71 [default = 51.5 ]; 163ffe3c632Sopenharmony_ci optional double default_double = 72 [default = 52e3 ]; 164ffe3c632Sopenharmony_ci optional bool default_bool = 73 [default = true ]; 165ffe3c632Sopenharmony_ci optional string default_string = 74 [default = "hello"]; 166ffe3c632Sopenharmony_ci optional bytes default_bytes = 75 [default = "world"]; 167ffe3c632Sopenharmony_ci 168ffe3c632Sopenharmony_ci optional NestedEnum default_nested_enum = 81 [default = BAR ]; 169ffe3c632Sopenharmony_ci optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; 170ffe3c632Sopenharmony_ci optional protobuf_unittest_import_proto2.ImportEnum 171ffe3c632Sopenharmony_ci default_import_enum = 83 [default = IMPORT_BAR]; 172ffe3c632Sopenharmony_ci 173ffe3c632Sopenharmony_ci optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; 174ffe3c632Sopenharmony_ci optional string default_cord = 85 [ctype=CORD,default="123"]; 175ffe3c632Sopenharmony_ci 176ffe3c632Sopenharmony_ci // For oneof test 177ffe3c632Sopenharmony_ci oneof oneof_field { 178ffe3c632Sopenharmony_ci uint32 oneof_uint32 = 111; 179ffe3c632Sopenharmony_ci NestedMessage oneof_nested_message = 112; 180ffe3c632Sopenharmony_ci string oneof_string = 113; 181ffe3c632Sopenharmony_ci bytes oneof_bytes = 114; 182ffe3c632Sopenharmony_ci } 183ffe3c632Sopenharmony_ci} 184ffe3c632Sopenharmony_ci 185ffe3c632Sopenharmony_ci// This proto includes a recursively nested message. 186ffe3c632Sopenharmony_cimessage NestedTestAllTypes { 187ffe3c632Sopenharmony_ci optional NestedTestAllTypes child = 1; 188ffe3c632Sopenharmony_ci optional TestAllTypes payload = 2; 189ffe3c632Sopenharmony_ci repeated NestedTestAllTypes repeated_child = 3; 190ffe3c632Sopenharmony_ci} 191ffe3c632Sopenharmony_ci 192ffe3c632Sopenharmony_cimessage TestDeprecatedFields { 193ffe3c632Sopenharmony_ci optional int32 deprecated_int32 = 1 [deprecated=true]; 194ffe3c632Sopenharmony_ci oneof oneof_fields { 195ffe3c632Sopenharmony_ci int32 deprecated_int32_in_oneof = 2 [deprecated=true]; 196ffe3c632Sopenharmony_ci } 197ffe3c632Sopenharmony_ci} 198ffe3c632Sopenharmony_ci 199ffe3c632Sopenharmony_cimessage TestDeprecatedMessage { 200ffe3c632Sopenharmony_ci option deprecated = true; 201ffe3c632Sopenharmony_ci} 202ffe3c632Sopenharmony_ci 203ffe3c632Sopenharmony_ci// Define these after TestAllTypes to make sure the compiler can handle 204ffe3c632Sopenharmony_ci// that. 205ffe3c632Sopenharmony_cimessage ForeignMessage { 206ffe3c632Sopenharmony_ci optional int32 c = 1; 207ffe3c632Sopenharmony_ci optional int32 d = 2; 208ffe3c632Sopenharmony_ci} 209ffe3c632Sopenharmony_ci 210ffe3c632Sopenharmony_cienum ForeignEnum { 211ffe3c632Sopenharmony_ci FOREIGN_FOO = 4; 212ffe3c632Sopenharmony_ci FOREIGN_BAR = 5; 213ffe3c632Sopenharmony_ci FOREIGN_BAZ = 6; 214ffe3c632Sopenharmony_ci} 215ffe3c632Sopenharmony_ci 216ffe3c632Sopenharmony_cimessage TestReservedFields { 217ffe3c632Sopenharmony_ci reserved 2, 15, 9 to 11; 218ffe3c632Sopenharmony_ci reserved "bar", "baz"; 219ffe3c632Sopenharmony_ci} 220ffe3c632Sopenharmony_ci 221ffe3c632Sopenharmony_cimessage TestAllExtensions { 222ffe3c632Sopenharmony_ci extensions 1 to max; 223ffe3c632Sopenharmony_ci} 224ffe3c632Sopenharmony_ci 225ffe3c632Sopenharmony_ciextend TestAllExtensions { 226ffe3c632Sopenharmony_ci // Singular 227ffe3c632Sopenharmony_ci optional int32 optional_int32_extension = 1; 228ffe3c632Sopenharmony_ci optional int64 optional_int64_extension = 2; 229ffe3c632Sopenharmony_ci optional uint32 optional_uint32_extension = 3; 230ffe3c632Sopenharmony_ci optional uint64 optional_uint64_extension = 4; 231ffe3c632Sopenharmony_ci optional sint32 optional_sint32_extension = 5; 232ffe3c632Sopenharmony_ci optional sint64 optional_sint64_extension = 6; 233ffe3c632Sopenharmony_ci optional fixed32 optional_fixed32_extension = 7; 234ffe3c632Sopenharmony_ci optional fixed64 optional_fixed64_extension = 8; 235ffe3c632Sopenharmony_ci optional sfixed32 optional_sfixed32_extension = 9; 236ffe3c632Sopenharmony_ci optional sfixed64 optional_sfixed64_extension = 10; 237ffe3c632Sopenharmony_ci optional float optional_float_extension = 11; 238ffe3c632Sopenharmony_ci optional double optional_double_extension = 12; 239ffe3c632Sopenharmony_ci optional bool optional_bool_extension = 13; 240ffe3c632Sopenharmony_ci optional string optional_string_extension = 14; 241ffe3c632Sopenharmony_ci optional bytes optional_bytes_extension = 15; 242ffe3c632Sopenharmony_ci 243ffe3c632Sopenharmony_ci optional group OptionalGroup_extension = 16 { 244ffe3c632Sopenharmony_ci optional int32 a = 17; 245ffe3c632Sopenharmony_ci } 246ffe3c632Sopenharmony_ci 247ffe3c632Sopenharmony_ci optional TestAllTypes.NestedMessage optional_nested_message_extension = 18; 248ffe3c632Sopenharmony_ci optional ForeignMessage optional_foreign_message_extension = 19; 249ffe3c632Sopenharmony_ci optional protobuf_unittest_import_proto2.ImportMessage 250ffe3c632Sopenharmony_ci optional_import_message_extension = 20; 251ffe3c632Sopenharmony_ci 252ffe3c632Sopenharmony_ci optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21; 253ffe3c632Sopenharmony_ci optional ForeignEnum optional_foreign_enum_extension = 22; 254ffe3c632Sopenharmony_ci optional protobuf_unittest_import_proto2.ImportEnum 255ffe3c632Sopenharmony_ci optional_import_enum_extension = 23; 256ffe3c632Sopenharmony_ci 257ffe3c632Sopenharmony_ci optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE]; 258ffe3c632Sopenharmony_ci optional string optional_cord_extension = 25 [ctype=CORD]; 259ffe3c632Sopenharmony_ci 260ffe3c632Sopenharmony_ci optional protobuf_unittest_import_proto2.PublicImportMessage 261ffe3c632Sopenharmony_ci optional_public_import_message_extension = 26; 262ffe3c632Sopenharmony_ci 263ffe3c632Sopenharmony_ci optional TestAllTypes.NestedMessage 264ffe3c632Sopenharmony_ci optional_lazy_message_extension = 27 [lazy=true]; 265ffe3c632Sopenharmony_ci 266ffe3c632Sopenharmony_ci // Repeated 267ffe3c632Sopenharmony_ci repeated int32 repeated_int32_extension = 31; 268ffe3c632Sopenharmony_ci repeated int64 repeated_int64_extension = 32; 269ffe3c632Sopenharmony_ci repeated uint32 repeated_uint32_extension = 33; 270ffe3c632Sopenharmony_ci repeated uint64 repeated_uint64_extension = 34; 271ffe3c632Sopenharmony_ci repeated sint32 repeated_sint32_extension = 35; 272ffe3c632Sopenharmony_ci repeated sint64 repeated_sint64_extension = 36; 273ffe3c632Sopenharmony_ci repeated fixed32 repeated_fixed32_extension = 37; 274ffe3c632Sopenharmony_ci repeated fixed64 repeated_fixed64_extension = 38; 275ffe3c632Sopenharmony_ci repeated sfixed32 repeated_sfixed32_extension = 39; 276ffe3c632Sopenharmony_ci repeated sfixed64 repeated_sfixed64_extension = 40; 277ffe3c632Sopenharmony_ci repeated float repeated_float_extension = 41; 278ffe3c632Sopenharmony_ci repeated double repeated_double_extension = 42; 279ffe3c632Sopenharmony_ci repeated bool repeated_bool_extension = 43; 280ffe3c632Sopenharmony_ci repeated string repeated_string_extension = 44; 281ffe3c632Sopenharmony_ci repeated bytes repeated_bytes_extension = 45; 282ffe3c632Sopenharmony_ci 283ffe3c632Sopenharmony_ci repeated group RepeatedGroup_extension = 46 { 284ffe3c632Sopenharmony_ci optional int32 a = 47; 285ffe3c632Sopenharmony_ci } 286ffe3c632Sopenharmony_ci 287ffe3c632Sopenharmony_ci repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48; 288ffe3c632Sopenharmony_ci repeated ForeignMessage repeated_foreign_message_extension = 49; 289ffe3c632Sopenharmony_ci repeated protobuf_unittest_import_proto2.ImportMessage 290ffe3c632Sopenharmony_ci repeated_import_message_extension = 50; 291ffe3c632Sopenharmony_ci 292ffe3c632Sopenharmony_ci repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51; 293ffe3c632Sopenharmony_ci repeated ForeignEnum repeated_foreign_enum_extension = 52; 294ffe3c632Sopenharmony_ci repeated protobuf_unittest_import_proto2.ImportEnum 295ffe3c632Sopenharmony_ci repeated_import_enum_extension = 53; 296ffe3c632Sopenharmony_ci 297ffe3c632Sopenharmony_ci repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE]; 298ffe3c632Sopenharmony_ci repeated string repeated_cord_extension = 55 [ctype=CORD]; 299ffe3c632Sopenharmony_ci 300ffe3c632Sopenharmony_ci repeated TestAllTypes.NestedMessage 301ffe3c632Sopenharmony_ci repeated_lazy_message_extension = 57 [lazy=true]; 302ffe3c632Sopenharmony_ci 303ffe3c632Sopenharmony_ci // Singular with defaults 304ffe3c632Sopenharmony_ci optional int32 default_int32_extension = 61 [default = 41 ]; 305ffe3c632Sopenharmony_ci optional int64 default_int64_extension = 62 [default = 42 ]; 306ffe3c632Sopenharmony_ci optional uint32 default_uint32_extension = 63 [default = 43 ]; 307ffe3c632Sopenharmony_ci optional uint64 default_uint64_extension = 64 [default = 44 ]; 308ffe3c632Sopenharmony_ci optional sint32 default_sint32_extension = 65 [default = -45 ]; 309ffe3c632Sopenharmony_ci optional sint64 default_sint64_extension = 66 [default = 46 ]; 310ffe3c632Sopenharmony_ci optional fixed32 default_fixed32_extension = 67 [default = 47 ]; 311ffe3c632Sopenharmony_ci optional fixed64 default_fixed64_extension = 68 [default = 48 ]; 312ffe3c632Sopenharmony_ci optional sfixed32 default_sfixed32_extension = 69 [default = 49 ]; 313ffe3c632Sopenharmony_ci optional sfixed64 default_sfixed64_extension = 70 [default = -50 ]; 314ffe3c632Sopenharmony_ci optional float default_float_extension = 71 [default = 51.5 ]; 315ffe3c632Sopenharmony_ci optional double default_double_extension = 72 [default = 52e3 ]; 316ffe3c632Sopenharmony_ci optional bool default_bool_extension = 73 [default = true ]; 317ffe3c632Sopenharmony_ci optional string default_string_extension = 74 [default = "hello"]; 318ffe3c632Sopenharmony_ci optional bytes default_bytes_extension = 75 [default = "world"]; 319ffe3c632Sopenharmony_ci 320ffe3c632Sopenharmony_ci optional TestAllTypes.NestedEnum 321ffe3c632Sopenharmony_ci default_nested_enum_extension = 81 [default = BAR]; 322ffe3c632Sopenharmony_ci optional ForeignEnum 323ffe3c632Sopenharmony_ci default_foreign_enum_extension = 82 [default = FOREIGN_BAR]; 324ffe3c632Sopenharmony_ci optional protobuf_unittest_import_proto2.ImportEnum 325ffe3c632Sopenharmony_ci default_import_enum_extension = 83 [default = IMPORT_BAR]; 326ffe3c632Sopenharmony_ci 327ffe3c632Sopenharmony_ci optional string default_string_piece_extension = 84 [ctype=STRING_PIECE, 328ffe3c632Sopenharmony_ci default="abc"]; 329ffe3c632Sopenharmony_ci optional string default_cord_extension = 85 [ctype=CORD, default="123"]; 330ffe3c632Sopenharmony_ci 331ffe3c632Sopenharmony_ci // For oneof test 332ffe3c632Sopenharmony_ci optional uint32 oneof_uint32_extension = 111; 333ffe3c632Sopenharmony_ci optional TestAllTypes.NestedMessage oneof_nested_message_extension = 112; 334ffe3c632Sopenharmony_ci optional string oneof_string_extension = 113; 335ffe3c632Sopenharmony_ci optional bytes oneof_bytes_extension = 114; 336ffe3c632Sopenharmony_ci} 337ffe3c632Sopenharmony_ci 338ffe3c632Sopenharmony_cimessage TestGroup { 339ffe3c632Sopenharmony_ci optional group OptionalGroup = 16 { 340ffe3c632Sopenharmony_ci optional int32 a = 17; 341ffe3c632Sopenharmony_ci } 342ffe3c632Sopenharmony_ci optional ForeignEnum optional_foreign_enum = 22; 343ffe3c632Sopenharmony_ci} 344ffe3c632Sopenharmony_ci 345ffe3c632Sopenharmony_cimessage TestGroupExtension { 346ffe3c632Sopenharmony_ci extensions 1 to max; 347ffe3c632Sopenharmony_ci} 348ffe3c632Sopenharmony_ci 349ffe3c632Sopenharmony_cimessage TestNestedExtension { 350ffe3c632Sopenharmony_ci extend TestAllExtensions { 351ffe3c632Sopenharmony_ci // Check for bug where string extensions declared in tested scope did not 352ffe3c632Sopenharmony_ci // compile. 353ffe3c632Sopenharmony_ci optional string test = 1002 [default="test"]; 354ffe3c632Sopenharmony_ci // Used to test if generated extension name is correct when there are 355ffe3c632Sopenharmony_ci // underscores. 356ffe3c632Sopenharmony_ci optional string nested_string_extension = 1003; 357ffe3c632Sopenharmony_ci } 358ffe3c632Sopenharmony_ci 359ffe3c632Sopenharmony_ci extend TestGroupExtension { 360ffe3c632Sopenharmony_ci optional group OptionalGroup_extension = 16 { 361ffe3c632Sopenharmony_ci optional int32 a = 17; 362ffe3c632Sopenharmony_ci } 363ffe3c632Sopenharmony_ci optional ForeignEnum optional_foreign_enum_extension = 22; 364ffe3c632Sopenharmony_ci } 365ffe3c632Sopenharmony_ci} 366ffe3c632Sopenharmony_ci 367ffe3c632Sopenharmony_ci// We have separate messages for testing required fields because it's 368ffe3c632Sopenharmony_ci// annoying to have to fill in required fields in TestProto in order to 369ffe3c632Sopenharmony_ci// do anything with it. Note that we don't need to test every type of 370ffe3c632Sopenharmony_ci// required filed because the code output is basically identical to 371ffe3c632Sopenharmony_ci// optional fields for all types. 372ffe3c632Sopenharmony_cimessage TestRequired { 373ffe3c632Sopenharmony_ci required int32 a = 1; 374ffe3c632Sopenharmony_ci optional int32 dummy2 = 2; 375ffe3c632Sopenharmony_ci required int32 b = 3; 376ffe3c632Sopenharmony_ci 377ffe3c632Sopenharmony_ci extend TestAllExtensions { 378ffe3c632Sopenharmony_ci optional TestRequired single = 1000; 379ffe3c632Sopenharmony_ci repeated TestRequired multi = 1001; 380ffe3c632Sopenharmony_ci } 381ffe3c632Sopenharmony_ci 382ffe3c632Sopenharmony_ci // Pad the field count to 32 so that we can test that IsInitialized() 383ffe3c632Sopenharmony_ci // properly checks multiple elements of has_bits_. 384ffe3c632Sopenharmony_ci optional int32 dummy4 = 4; 385ffe3c632Sopenharmony_ci optional int32 dummy5 = 5; 386ffe3c632Sopenharmony_ci optional int32 dummy6 = 6; 387ffe3c632Sopenharmony_ci optional int32 dummy7 = 7; 388ffe3c632Sopenharmony_ci optional int32 dummy8 = 8; 389ffe3c632Sopenharmony_ci optional int32 dummy9 = 9; 390ffe3c632Sopenharmony_ci optional int32 dummy10 = 10; 391ffe3c632Sopenharmony_ci optional int32 dummy11 = 11; 392ffe3c632Sopenharmony_ci optional int32 dummy12 = 12; 393ffe3c632Sopenharmony_ci optional int32 dummy13 = 13; 394ffe3c632Sopenharmony_ci optional int32 dummy14 = 14; 395ffe3c632Sopenharmony_ci optional int32 dummy15 = 15; 396ffe3c632Sopenharmony_ci optional int32 dummy16 = 16; 397ffe3c632Sopenharmony_ci optional int32 dummy17 = 17; 398ffe3c632Sopenharmony_ci optional int32 dummy18 = 18; 399ffe3c632Sopenharmony_ci optional int32 dummy19 = 19; 400ffe3c632Sopenharmony_ci optional int32 dummy20 = 20; 401ffe3c632Sopenharmony_ci optional int32 dummy21 = 21; 402ffe3c632Sopenharmony_ci optional int32 dummy22 = 22; 403ffe3c632Sopenharmony_ci optional int32 dummy23 = 23; 404ffe3c632Sopenharmony_ci optional int32 dummy24 = 24; 405ffe3c632Sopenharmony_ci optional int32 dummy25 = 25; 406ffe3c632Sopenharmony_ci optional int32 dummy26 = 26; 407ffe3c632Sopenharmony_ci optional int32 dummy27 = 27; 408ffe3c632Sopenharmony_ci optional int32 dummy28 = 28; 409ffe3c632Sopenharmony_ci optional int32 dummy29 = 29; 410ffe3c632Sopenharmony_ci optional int32 dummy30 = 30; 411ffe3c632Sopenharmony_ci optional int32 dummy31 = 31; 412ffe3c632Sopenharmony_ci optional int32 dummy32 = 32; 413ffe3c632Sopenharmony_ci 414ffe3c632Sopenharmony_ci required int32 c = 33; 415ffe3c632Sopenharmony_ci} 416ffe3c632Sopenharmony_ci 417ffe3c632Sopenharmony_cimessage TestRequiredForeign { 418ffe3c632Sopenharmony_ci optional TestRequired optional_message = 1; 419ffe3c632Sopenharmony_ci repeated TestRequired repeated_message = 2; 420ffe3c632Sopenharmony_ci optional int32 dummy = 3; 421ffe3c632Sopenharmony_ci} 422ffe3c632Sopenharmony_ci 423ffe3c632Sopenharmony_cimessage TestRequiredMessage { 424ffe3c632Sopenharmony_ci optional TestRequired optional_message = 1; 425ffe3c632Sopenharmony_ci repeated TestRequired repeated_message = 2; 426ffe3c632Sopenharmony_ci required TestRequired required_message = 3; 427ffe3c632Sopenharmony_ci} 428ffe3c632Sopenharmony_ci 429ffe3c632Sopenharmony_ci// Test that we can use NestedMessage from outside TestAllTypes. 430ffe3c632Sopenharmony_cimessage TestForeignNested { 431ffe3c632Sopenharmony_ci optional TestAllTypes.NestedMessage foreign_nested = 1; 432ffe3c632Sopenharmony_ci} 433ffe3c632Sopenharmony_ci 434ffe3c632Sopenharmony_ci// TestEmptyMessage is used to test unknown field support. 435ffe3c632Sopenharmony_cimessage TestEmptyMessage { 436ffe3c632Sopenharmony_ci} 437ffe3c632Sopenharmony_ci 438ffe3c632Sopenharmony_ci// Like above, but declare all field numbers as potential extensions. No 439ffe3c632Sopenharmony_ci// actual extensions should ever be defined for this type. 440ffe3c632Sopenharmony_cimessage TestEmptyMessageWithExtensions { 441ffe3c632Sopenharmony_ci extensions 1 to max; 442ffe3c632Sopenharmony_ci} 443ffe3c632Sopenharmony_ci 444ffe3c632Sopenharmony_cimessage TestMultipleExtensionRanges { 445ffe3c632Sopenharmony_ci extensions 42; 446ffe3c632Sopenharmony_ci extensions 4143 to 4243; 447ffe3c632Sopenharmony_ci extensions 65536 to max; 448ffe3c632Sopenharmony_ci} 449ffe3c632Sopenharmony_ci 450ffe3c632Sopenharmony_ci// Test that really large tag numbers don't break anything. 451ffe3c632Sopenharmony_cimessage TestReallyLargeTagNumber { 452ffe3c632Sopenharmony_ci // The largest possible tag number is 2^28 - 1, since the wire format uses 453ffe3c632Sopenharmony_ci // three bits to communicate wire type. 454ffe3c632Sopenharmony_ci optional int32 a = 1; 455ffe3c632Sopenharmony_ci optional int32 bb = 268435455; 456ffe3c632Sopenharmony_ci} 457ffe3c632Sopenharmony_ci 458ffe3c632Sopenharmony_cimessage TestRecursiveMessage { 459ffe3c632Sopenharmony_ci optional TestRecursiveMessage a = 1; 460ffe3c632Sopenharmony_ci optional int32 i = 2; 461ffe3c632Sopenharmony_ci} 462ffe3c632Sopenharmony_ci 463ffe3c632Sopenharmony_ci// Test that mutual recursion works. 464ffe3c632Sopenharmony_cimessage TestMutualRecursionA { 465ffe3c632Sopenharmony_ci message SubMessage { 466ffe3c632Sopenharmony_ci optional TestMutualRecursionB b = 1; 467ffe3c632Sopenharmony_ci } 468ffe3c632Sopenharmony_ci optional TestMutualRecursionB bb = 1; 469ffe3c632Sopenharmony_ci optional group SubGroup = 2 { 470ffe3c632Sopenharmony_ci optional SubMessage sub_message = 3; // Needed because of bug in javatest 471ffe3c632Sopenharmony_ci optional TestAllTypes not_in_this_scc = 4; 472ffe3c632Sopenharmony_ci } 473ffe3c632Sopenharmony_ci} 474ffe3c632Sopenharmony_ci 475ffe3c632Sopenharmony_cimessage TestMutualRecursionB { 476ffe3c632Sopenharmony_ci optional TestMutualRecursionA a = 1; 477ffe3c632Sopenharmony_ci optional int32 optional_int32 = 2; 478ffe3c632Sopenharmony_ci} 479ffe3c632Sopenharmony_ci 480ffe3c632Sopenharmony_cimessage TestIsInitialized { 481ffe3c632Sopenharmony_ci message SubMessage { 482ffe3c632Sopenharmony_ci optional group SubGroup = 1 { 483ffe3c632Sopenharmony_ci required int32 i = 2; 484ffe3c632Sopenharmony_ci } 485ffe3c632Sopenharmony_ci } 486ffe3c632Sopenharmony_ci optional SubMessage sub_message = 1; 487ffe3c632Sopenharmony_ci} 488ffe3c632Sopenharmony_ci 489ffe3c632Sopenharmony_ci// Test that groups have disjoint field numbers from their siblings and 490ffe3c632Sopenharmony_ci// parents. This is NOT possible in proto1; only google.protobuf. When attempting 491ffe3c632Sopenharmony_ci// to compile with proto1, this will emit an error; so we only include it 492ffe3c632Sopenharmony_ci// in protobuf_unittest_proto. 493ffe3c632Sopenharmony_cimessage TestDupFieldNumber { // NO_PROTO1 494ffe3c632Sopenharmony_ci optional int32 a = 1; // NO_PROTO1 495ffe3c632Sopenharmony_ci optional group Foo = 2 { optional int32 a = 1; } // NO_PROTO1 496ffe3c632Sopenharmony_ci optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1 497ffe3c632Sopenharmony_ci} // NO_PROTO1 498ffe3c632Sopenharmony_ci 499ffe3c632Sopenharmony_ci// Additional messages for testing lazy fields. 500ffe3c632Sopenharmony_cimessage TestEagerMessage { 501ffe3c632Sopenharmony_ci optional TestAllTypes sub_message = 1 [lazy=false]; 502ffe3c632Sopenharmony_ci} 503ffe3c632Sopenharmony_cimessage TestLazyMessage { 504ffe3c632Sopenharmony_ci optional TestAllTypes sub_message = 1 [lazy=true]; 505ffe3c632Sopenharmony_ci} 506ffe3c632Sopenharmony_ci 507ffe3c632Sopenharmony_ci// Needed for a Python test. 508ffe3c632Sopenharmony_cimessage TestNestedMessageHasBits { 509ffe3c632Sopenharmony_ci message NestedMessage { 510ffe3c632Sopenharmony_ci repeated int32 nestedmessage_repeated_int32 = 1; 511ffe3c632Sopenharmony_ci repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2; 512ffe3c632Sopenharmony_ci } 513ffe3c632Sopenharmony_ci optional NestedMessage optional_nested_message = 1; 514ffe3c632Sopenharmony_ci} 515ffe3c632Sopenharmony_ci 516ffe3c632Sopenharmony_ci 517ffe3c632Sopenharmony_ci// Test an enum that has multiple values with the same number. 518ffe3c632Sopenharmony_cienum TestEnumWithDupValue { 519ffe3c632Sopenharmony_ci option allow_alias = true; 520ffe3c632Sopenharmony_ci 521ffe3c632Sopenharmony_ci FOO1 = 1; 522ffe3c632Sopenharmony_ci BAR1 = 2; 523ffe3c632Sopenharmony_ci BAZ = 3; 524ffe3c632Sopenharmony_ci FOO2 = 1; 525ffe3c632Sopenharmony_ci BAR2 = 2; 526ffe3c632Sopenharmony_ci} 527ffe3c632Sopenharmony_ci 528ffe3c632Sopenharmony_ci// Test an enum with large, unordered values. 529ffe3c632Sopenharmony_cienum TestSparseEnum { 530ffe3c632Sopenharmony_ci SPARSE_A = 123; 531ffe3c632Sopenharmony_ci SPARSE_B = 62374; 532ffe3c632Sopenharmony_ci SPARSE_C = 12589234; 533ffe3c632Sopenharmony_ci SPARSE_D = -15; 534ffe3c632Sopenharmony_ci SPARSE_E = -53452; 535ffe3c632Sopenharmony_ci SPARSE_F = 0; 536ffe3c632Sopenharmony_ci SPARSE_G = 2; 537ffe3c632Sopenharmony_ci} 538ffe3c632Sopenharmony_ci 539ffe3c632Sopenharmony_ci// Test message with CamelCase field names. This violates Protocol Buffer 540ffe3c632Sopenharmony_ci// standard style. 541ffe3c632Sopenharmony_cimessage TestCamelCaseFieldNames { 542ffe3c632Sopenharmony_ci optional int32 PrimitiveField = 1; 543ffe3c632Sopenharmony_ci optional string StringField = 2; 544ffe3c632Sopenharmony_ci optional ForeignEnum EnumField = 3; 545ffe3c632Sopenharmony_ci optional ForeignMessage MessageField = 4; 546ffe3c632Sopenharmony_ci optional string StringPieceField = 5 [ctype=STRING_PIECE]; 547ffe3c632Sopenharmony_ci optional string CordField = 6 [ctype=CORD]; 548ffe3c632Sopenharmony_ci 549ffe3c632Sopenharmony_ci repeated int32 RepeatedPrimitiveField = 7; 550ffe3c632Sopenharmony_ci repeated string RepeatedStringField = 8; 551ffe3c632Sopenharmony_ci repeated ForeignEnum RepeatedEnumField = 9; 552ffe3c632Sopenharmony_ci repeated ForeignMessage RepeatedMessageField = 10; 553ffe3c632Sopenharmony_ci repeated string RepeatedStringPieceField = 11 [ctype=STRING_PIECE]; 554ffe3c632Sopenharmony_ci repeated string RepeatedCordField = 12 [ctype=CORD]; 555ffe3c632Sopenharmony_ci} 556ffe3c632Sopenharmony_ci 557ffe3c632Sopenharmony_ci 558ffe3c632Sopenharmony_ci// We list fields out of order, to ensure that we're using field number and not 559ffe3c632Sopenharmony_ci// field index to determine serialization order. 560ffe3c632Sopenharmony_cimessage TestFieldOrderings { 561ffe3c632Sopenharmony_ci optional string my_string = 11; 562ffe3c632Sopenharmony_ci extensions 2 to 10; 563ffe3c632Sopenharmony_ci optional int64 my_int = 1; 564ffe3c632Sopenharmony_ci extensions 12 to 100; 565ffe3c632Sopenharmony_ci optional float my_float = 101; 566ffe3c632Sopenharmony_ci message NestedMessage { 567ffe3c632Sopenharmony_ci optional int64 oo = 2; 568ffe3c632Sopenharmony_ci // The field name "b" fails to compile in proto1 because it conflicts with 569ffe3c632Sopenharmony_ci // a local variable named "b" in one of the generated methods. Doh. 570ffe3c632Sopenharmony_ci // This file needs to compile in proto1 to test backwards-compatibility. 571ffe3c632Sopenharmony_ci optional int32 bb = 1; 572ffe3c632Sopenharmony_ci } 573ffe3c632Sopenharmony_ci 574ffe3c632Sopenharmony_ci optional NestedMessage optional_nested_message = 200; 575ffe3c632Sopenharmony_ci} 576ffe3c632Sopenharmony_ci 577ffe3c632Sopenharmony_ciextend TestFieldOrderings { 578ffe3c632Sopenharmony_ci optional string my_extension_string = 50; 579ffe3c632Sopenharmony_ci optional int32 my_extension_int = 5; 580ffe3c632Sopenharmony_ci} 581ffe3c632Sopenharmony_ci 582ffe3c632Sopenharmony_cimessage TestExtensionOrderings1 { 583ffe3c632Sopenharmony_ci extend TestFieldOrderings { 584ffe3c632Sopenharmony_ci optional TestExtensionOrderings1 test_ext_orderings1 = 13; 585ffe3c632Sopenharmony_ci } 586ffe3c632Sopenharmony_ci optional string my_string = 1; 587ffe3c632Sopenharmony_ci} 588ffe3c632Sopenharmony_ci 589ffe3c632Sopenharmony_cimessage TestExtensionOrderings2 { 590ffe3c632Sopenharmony_ci extend TestFieldOrderings { 591ffe3c632Sopenharmony_ci optional TestExtensionOrderings2 test_ext_orderings2 = 12; 592ffe3c632Sopenharmony_ci } 593ffe3c632Sopenharmony_ci message TestExtensionOrderings3 { 594ffe3c632Sopenharmony_ci extend TestFieldOrderings { 595ffe3c632Sopenharmony_ci optional TestExtensionOrderings3 test_ext_orderings3 = 14; 596ffe3c632Sopenharmony_ci } 597ffe3c632Sopenharmony_ci optional string my_string = 1; 598ffe3c632Sopenharmony_ci } 599ffe3c632Sopenharmony_ci optional string my_string = 1; 600ffe3c632Sopenharmony_ci} 601ffe3c632Sopenharmony_ci 602ffe3c632Sopenharmony_cimessage TestExtremeDefaultValues { 603ffe3c632Sopenharmony_ci optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"]; 604ffe3c632Sopenharmony_ci optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF]; 605ffe3c632Sopenharmony_ci optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF]; 606ffe3c632Sopenharmony_ci optional int32 small_int32 = 4 [default = -0x7FFFFFFF]; 607ffe3c632Sopenharmony_ci optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF]; 608ffe3c632Sopenharmony_ci optional int32 really_small_int32 = 21 [default = -0x80000000]; 609ffe3c632Sopenharmony_ci optional int64 really_small_int64 = 22 [default = -0x8000000000000000]; 610ffe3c632Sopenharmony_ci 611ffe3c632Sopenharmony_ci // The default value here is UTF-8 for "\u1234". (We could also just type 612ffe3c632Sopenharmony_ci // the UTF-8 text directly into this text file rather than escape it, but 613ffe3c632Sopenharmony_ci // lots of people use editors that would be confused by this.) 614ffe3c632Sopenharmony_ci optional string utf8_string = 6 [default = "\341\210\264"]; 615ffe3c632Sopenharmony_ci 616ffe3c632Sopenharmony_ci // Tests for single-precision floating-point values. 617ffe3c632Sopenharmony_ci optional float zero_float = 7 [default = 0]; 618ffe3c632Sopenharmony_ci optional float one_float = 8 [default = 1]; 619ffe3c632Sopenharmony_ci optional float small_float = 9 [default = 1.5]; 620ffe3c632Sopenharmony_ci optional float negative_one_float = 10 [default = -1]; 621ffe3c632Sopenharmony_ci optional float negative_float = 11 [default = -1.5]; 622ffe3c632Sopenharmony_ci // Using exponents 623ffe3c632Sopenharmony_ci optional float large_float = 12 [default = 2E8]; 624ffe3c632Sopenharmony_ci optional float small_negative_float = 13 [default = -8e-28]; 625ffe3c632Sopenharmony_ci 626ffe3c632Sopenharmony_ci // Text for nonfinite floating-point values. 627ffe3c632Sopenharmony_ci optional double inf_double = 14 [default = inf]; 628ffe3c632Sopenharmony_ci optional double neg_inf_double = 15 [default = -inf]; 629ffe3c632Sopenharmony_ci optional double nan_double = 16 [default = nan]; 630ffe3c632Sopenharmony_ci optional float inf_float = 17 [default = inf]; 631ffe3c632Sopenharmony_ci optional float neg_inf_float = 18 [default = -inf]; 632ffe3c632Sopenharmony_ci optional float nan_float = 19 [default = nan]; 633ffe3c632Sopenharmony_ci 634ffe3c632Sopenharmony_ci // Tests for C++ trigraphs. 635ffe3c632Sopenharmony_ci // Trigraphs should be escaped in C++ generated files, but they should not be 636ffe3c632Sopenharmony_ci // escaped for other languages. 637ffe3c632Sopenharmony_ci // Note that in .proto file, "\?" is a valid way to escape ? in string 638ffe3c632Sopenharmony_ci // literals. 639ffe3c632Sopenharmony_ci optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"]; 640ffe3c632Sopenharmony_ci 641ffe3c632Sopenharmony_ci // String defaults containing the character '\000' 642ffe3c632Sopenharmony_ci optional string string_with_zero = 23 [default = "hel\000lo"]; 643ffe3c632Sopenharmony_ci optional bytes bytes_with_zero = 24 [default = "wor\000ld"]; 644ffe3c632Sopenharmony_ci optional string string_piece_with_zero = 25 [ctype=STRING_PIECE, 645ffe3c632Sopenharmony_ci default="ab\000c"]; 646ffe3c632Sopenharmony_ci optional string cord_with_zero = 26 [ctype=CORD, 647ffe3c632Sopenharmony_ci default="12\0003"]; 648ffe3c632Sopenharmony_ci optional string replacement_string = 27 [default="${unknown}"]; 649ffe3c632Sopenharmony_ci} 650ffe3c632Sopenharmony_ci 651ffe3c632Sopenharmony_cimessage SparseEnumMessage { 652ffe3c632Sopenharmony_ci optional TestSparseEnum sparse_enum = 1; 653ffe3c632Sopenharmony_ci} 654ffe3c632Sopenharmony_ci 655ffe3c632Sopenharmony_ci// Test String and Bytes: string is for valid UTF-8 strings 656ffe3c632Sopenharmony_cimessage OneString { 657ffe3c632Sopenharmony_ci optional string data = 1; 658ffe3c632Sopenharmony_ci} 659ffe3c632Sopenharmony_ci 660ffe3c632Sopenharmony_cimessage MoreString { 661ffe3c632Sopenharmony_ci repeated string data = 1; 662ffe3c632Sopenharmony_ci} 663ffe3c632Sopenharmony_ci 664ffe3c632Sopenharmony_cimessage OneBytes { 665ffe3c632Sopenharmony_ci optional bytes data = 1; 666ffe3c632Sopenharmony_ci} 667ffe3c632Sopenharmony_ci 668ffe3c632Sopenharmony_cimessage MoreBytes { 669ffe3c632Sopenharmony_ci repeated bytes data = 1; 670ffe3c632Sopenharmony_ci} 671ffe3c632Sopenharmony_ci 672ffe3c632Sopenharmony_ci// Test int32, uint32, int64, uint64, and bool are all compatible 673ffe3c632Sopenharmony_cimessage Int32Message { 674ffe3c632Sopenharmony_ci optional int32 data = 1; 675ffe3c632Sopenharmony_ci} 676ffe3c632Sopenharmony_ci 677ffe3c632Sopenharmony_cimessage Uint32Message { 678ffe3c632Sopenharmony_ci optional uint32 data = 1; 679ffe3c632Sopenharmony_ci} 680ffe3c632Sopenharmony_ci 681ffe3c632Sopenharmony_cimessage Int64Message { 682ffe3c632Sopenharmony_ci optional int64 data = 1; 683ffe3c632Sopenharmony_ci} 684ffe3c632Sopenharmony_ci 685ffe3c632Sopenharmony_cimessage Uint64Message { 686ffe3c632Sopenharmony_ci optional uint64 data = 1; 687ffe3c632Sopenharmony_ci} 688ffe3c632Sopenharmony_ci 689ffe3c632Sopenharmony_cimessage BoolMessage { 690ffe3c632Sopenharmony_ci optional bool data = 1; 691ffe3c632Sopenharmony_ci} 692ffe3c632Sopenharmony_ci 693ffe3c632Sopenharmony_ci// Test oneofs. 694ffe3c632Sopenharmony_cimessage TestOneof { 695ffe3c632Sopenharmony_ci oneof foo { 696ffe3c632Sopenharmony_ci int32 foo_int = 1; 697ffe3c632Sopenharmony_ci string foo_string = 2; 698ffe3c632Sopenharmony_ci TestAllTypes foo_message = 3; 699ffe3c632Sopenharmony_ci group FooGroup = 4 { 700ffe3c632Sopenharmony_ci optional int32 a = 5; 701ffe3c632Sopenharmony_ci optional string b = 6; 702ffe3c632Sopenharmony_ci } 703ffe3c632Sopenharmony_ci } 704ffe3c632Sopenharmony_ci} 705ffe3c632Sopenharmony_ci 706ffe3c632Sopenharmony_cimessage TestOneofBackwardsCompatible { 707ffe3c632Sopenharmony_ci optional int32 foo_int = 1; 708ffe3c632Sopenharmony_ci optional string foo_string = 2; 709ffe3c632Sopenharmony_ci optional TestAllTypes foo_message = 3; 710ffe3c632Sopenharmony_ci optional group FooGroup = 4 { 711ffe3c632Sopenharmony_ci optional int32 a = 5; 712ffe3c632Sopenharmony_ci optional string b = 6; 713ffe3c632Sopenharmony_ci } 714ffe3c632Sopenharmony_ci} 715ffe3c632Sopenharmony_ci 716ffe3c632Sopenharmony_cimessage TestOneof2 { 717ffe3c632Sopenharmony_ci oneof foo { 718ffe3c632Sopenharmony_ci int32 foo_int = 1; 719ffe3c632Sopenharmony_ci string foo_string = 2; 720ffe3c632Sopenharmony_ci string foo_cord = 3 [ctype=CORD]; 721ffe3c632Sopenharmony_ci string foo_string_piece = 4 [ctype=STRING_PIECE]; 722ffe3c632Sopenharmony_ci bytes foo_bytes = 5; 723ffe3c632Sopenharmony_ci NestedEnum foo_enum = 6; 724ffe3c632Sopenharmony_ci NestedMessage foo_message = 7; 725ffe3c632Sopenharmony_ci group FooGroup = 8 { 726ffe3c632Sopenharmony_ci optional int32 a = 9; 727ffe3c632Sopenharmony_ci optional string b = 10; 728ffe3c632Sopenharmony_ci } 729ffe3c632Sopenharmony_ci NestedMessage foo_lazy_message = 11 [lazy=true]; 730ffe3c632Sopenharmony_ci } 731ffe3c632Sopenharmony_ci 732ffe3c632Sopenharmony_ci oneof bar { 733ffe3c632Sopenharmony_ci int32 bar_int = 12 [default = 5]; 734ffe3c632Sopenharmony_ci string bar_string = 13 [default = "STRING"]; 735ffe3c632Sopenharmony_ci string bar_cord = 14 [ctype=CORD, default = "CORD"]; 736ffe3c632Sopenharmony_ci string bar_string_piece = 15 [ctype=STRING_PIECE, default = "SPIECE"]; 737ffe3c632Sopenharmony_ci bytes bar_bytes = 16 [default = "BYTES"]; 738ffe3c632Sopenharmony_ci NestedEnum bar_enum = 17 [default = BAR]; 739ffe3c632Sopenharmony_ci } 740ffe3c632Sopenharmony_ci 741ffe3c632Sopenharmony_ci optional int32 baz_int = 18; 742ffe3c632Sopenharmony_ci optional string baz_string = 19 [default = "BAZ"]; 743ffe3c632Sopenharmony_ci 744ffe3c632Sopenharmony_ci message NestedMessage { 745ffe3c632Sopenharmony_ci optional int64 qux_int = 1; 746ffe3c632Sopenharmony_ci repeated int32 corge_int = 2; 747ffe3c632Sopenharmony_ci } 748ffe3c632Sopenharmony_ci 749ffe3c632Sopenharmony_ci enum NestedEnum { 750ffe3c632Sopenharmony_ci FOO = 1; 751ffe3c632Sopenharmony_ci BAR = 2; 752ffe3c632Sopenharmony_ci BAZ = 3; 753ffe3c632Sopenharmony_ci } 754ffe3c632Sopenharmony_ci} 755ffe3c632Sopenharmony_ci 756ffe3c632Sopenharmony_cimessage TestRequiredOneof { 757ffe3c632Sopenharmony_ci oneof foo { 758ffe3c632Sopenharmony_ci int32 foo_int = 1; 759ffe3c632Sopenharmony_ci string foo_string = 2; 760ffe3c632Sopenharmony_ci NestedMessage foo_message = 3; 761ffe3c632Sopenharmony_ci } 762ffe3c632Sopenharmony_ci message NestedMessage { 763ffe3c632Sopenharmony_ci required double required_double = 1; 764ffe3c632Sopenharmony_ci } 765ffe3c632Sopenharmony_ci} 766ffe3c632Sopenharmony_ci 767ffe3c632Sopenharmony_cimessage TestRequiredMap { 768ffe3c632Sopenharmony_ci map<int32, NestedMessage> foo = 1; 769ffe3c632Sopenharmony_ci message NestedMessage { 770ffe3c632Sopenharmony_ci required int32 required_int32 = 1; 771ffe3c632Sopenharmony_ci } 772ffe3c632Sopenharmony_ci} 773ffe3c632Sopenharmony_ci 774ffe3c632Sopenharmony_ci// Test messages for packed fields 775ffe3c632Sopenharmony_ci 776ffe3c632Sopenharmony_cimessage TestPackedTypes { 777ffe3c632Sopenharmony_ci repeated int32 packed_int32 = 90 [packed = true]; 778ffe3c632Sopenharmony_ci repeated int64 packed_int64 = 91 [packed = true]; 779ffe3c632Sopenharmony_ci repeated uint32 packed_uint32 = 92 [packed = true]; 780ffe3c632Sopenharmony_ci repeated uint64 packed_uint64 = 93 [packed = true]; 781ffe3c632Sopenharmony_ci repeated sint32 packed_sint32 = 94 [packed = true]; 782ffe3c632Sopenharmony_ci repeated sint64 packed_sint64 = 95 [packed = true]; 783ffe3c632Sopenharmony_ci repeated fixed32 packed_fixed32 = 96 [packed = true]; 784ffe3c632Sopenharmony_ci repeated fixed64 packed_fixed64 = 97 [packed = true]; 785ffe3c632Sopenharmony_ci repeated sfixed32 packed_sfixed32 = 98 [packed = true]; 786ffe3c632Sopenharmony_ci repeated sfixed64 packed_sfixed64 = 99 [packed = true]; 787ffe3c632Sopenharmony_ci repeated float packed_float = 100 [packed = true]; 788ffe3c632Sopenharmony_ci repeated double packed_double = 101 [packed = true]; 789ffe3c632Sopenharmony_ci repeated bool packed_bool = 102 [packed = true]; 790ffe3c632Sopenharmony_ci repeated ForeignEnum packed_enum = 103 [packed = true]; 791ffe3c632Sopenharmony_ci} 792ffe3c632Sopenharmony_ci 793ffe3c632Sopenharmony_ci// A message with the same fields as TestPackedTypes, but without packing. Used 794ffe3c632Sopenharmony_ci// to test packed <-> unpacked wire compatibility. 795ffe3c632Sopenharmony_cimessage TestUnpackedTypes { 796ffe3c632Sopenharmony_ci repeated int32 unpacked_int32 = 90 [packed = false]; 797ffe3c632Sopenharmony_ci repeated int64 unpacked_int64 = 91 [packed = false]; 798ffe3c632Sopenharmony_ci repeated uint32 unpacked_uint32 = 92 [packed = false]; 799ffe3c632Sopenharmony_ci repeated uint64 unpacked_uint64 = 93 [packed = false]; 800ffe3c632Sopenharmony_ci repeated sint32 unpacked_sint32 = 94 [packed = false]; 801ffe3c632Sopenharmony_ci repeated sint64 unpacked_sint64 = 95 [packed = false]; 802ffe3c632Sopenharmony_ci repeated fixed32 unpacked_fixed32 = 96 [packed = false]; 803ffe3c632Sopenharmony_ci repeated fixed64 unpacked_fixed64 = 97 [packed = false]; 804ffe3c632Sopenharmony_ci repeated sfixed32 unpacked_sfixed32 = 98 [packed = false]; 805ffe3c632Sopenharmony_ci repeated sfixed64 unpacked_sfixed64 = 99 [packed = false]; 806ffe3c632Sopenharmony_ci repeated float unpacked_float = 100 [packed = false]; 807ffe3c632Sopenharmony_ci repeated double unpacked_double = 101 [packed = false]; 808ffe3c632Sopenharmony_ci repeated bool unpacked_bool = 102 [packed = false]; 809ffe3c632Sopenharmony_ci repeated ForeignEnum unpacked_enum = 103 [packed = false]; 810ffe3c632Sopenharmony_ci} 811ffe3c632Sopenharmony_ci 812ffe3c632Sopenharmony_cimessage TestPackedExtensions { 813ffe3c632Sopenharmony_ci extensions 1 to max; 814ffe3c632Sopenharmony_ci} 815ffe3c632Sopenharmony_ci 816ffe3c632Sopenharmony_ciextend TestPackedExtensions { 817ffe3c632Sopenharmony_ci repeated int32 packed_int32_extension = 90 [packed = true]; 818ffe3c632Sopenharmony_ci repeated int64 packed_int64_extension = 91 [packed = true]; 819ffe3c632Sopenharmony_ci repeated uint32 packed_uint32_extension = 92 [packed = true]; 820ffe3c632Sopenharmony_ci repeated uint64 packed_uint64_extension = 93 [packed = true]; 821ffe3c632Sopenharmony_ci repeated sint32 packed_sint32_extension = 94 [packed = true]; 822ffe3c632Sopenharmony_ci repeated sint64 packed_sint64_extension = 95 [packed = true]; 823ffe3c632Sopenharmony_ci repeated fixed32 packed_fixed32_extension = 96 [packed = true]; 824ffe3c632Sopenharmony_ci repeated fixed64 packed_fixed64_extension = 97 [packed = true]; 825ffe3c632Sopenharmony_ci repeated sfixed32 packed_sfixed32_extension = 98 [packed = true]; 826ffe3c632Sopenharmony_ci repeated sfixed64 packed_sfixed64_extension = 99 [packed = true]; 827ffe3c632Sopenharmony_ci repeated float packed_float_extension = 100 [packed = true]; 828ffe3c632Sopenharmony_ci repeated double packed_double_extension = 101 [packed = true]; 829ffe3c632Sopenharmony_ci repeated bool packed_bool_extension = 102 [packed = true]; 830ffe3c632Sopenharmony_ci repeated ForeignEnum packed_enum_extension = 103 [packed = true]; 831ffe3c632Sopenharmony_ci} 832ffe3c632Sopenharmony_ci 833ffe3c632Sopenharmony_cimessage TestUnpackedExtensions { 834ffe3c632Sopenharmony_ci extensions 1 to max; 835ffe3c632Sopenharmony_ci} 836ffe3c632Sopenharmony_ci 837ffe3c632Sopenharmony_ciextend TestUnpackedExtensions { 838ffe3c632Sopenharmony_ci repeated int32 unpacked_int32_extension = 90 [packed = false]; 839ffe3c632Sopenharmony_ci repeated int64 unpacked_int64_extension = 91 [packed = false]; 840ffe3c632Sopenharmony_ci repeated uint32 unpacked_uint32_extension = 92 [packed = false]; 841ffe3c632Sopenharmony_ci repeated uint64 unpacked_uint64_extension = 93 [packed = false]; 842ffe3c632Sopenharmony_ci repeated sint32 unpacked_sint32_extension = 94 [packed = false]; 843ffe3c632Sopenharmony_ci repeated sint64 unpacked_sint64_extension = 95 [packed = false]; 844ffe3c632Sopenharmony_ci repeated fixed32 unpacked_fixed32_extension = 96 [packed = false]; 845ffe3c632Sopenharmony_ci repeated fixed64 unpacked_fixed64_extension = 97 [packed = false]; 846ffe3c632Sopenharmony_ci repeated sfixed32 unpacked_sfixed32_extension = 98 [packed = false]; 847ffe3c632Sopenharmony_ci repeated sfixed64 unpacked_sfixed64_extension = 99 [packed = false]; 848ffe3c632Sopenharmony_ci repeated float unpacked_float_extension = 100 [packed = false]; 849ffe3c632Sopenharmony_ci repeated double unpacked_double_extension = 101 [packed = false]; 850ffe3c632Sopenharmony_ci repeated bool unpacked_bool_extension = 102 [packed = false]; 851ffe3c632Sopenharmony_ci repeated ForeignEnum unpacked_enum_extension = 103 [packed = false]; 852ffe3c632Sopenharmony_ci} 853ffe3c632Sopenharmony_ci 854ffe3c632Sopenharmony_ci// Used by ExtensionSetTest/DynamicExtensions. The test actually builds 855ffe3c632Sopenharmony_ci// a set of extensions to TestAllExtensions dynamically, based on the fields 856ffe3c632Sopenharmony_ci// of this message type. 857ffe3c632Sopenharmony_cimessage TestDynamicExtensions { 858ffe3c632Sopenharmony_ci enum DynamicEnumType { 859ffe3c632Sopenharmony_ci DYNAMIC_FOO = 2200; 860ffe3c632Sopenharmony_ci DYNAMIC_BAR = 2201; 861ffe3c632Sopenharmony_ci DYNAMIC_BAZ = 2202; 862ffe3c632Sopenharmony_ci } 863ffe3c632Sopenharmony_ci message DynamicMessageType { 864ffe3c632Sopenharmony_ci optional int32 dynamic_field = 2100; 865ffe3c632Sopenharmony_ci } 866ffe3c632Sopenharmony_ci 867ffe3c632Sopenharmony_ci optional fixed32 scalar_extension = 2000; 868ffe3c632Sopenharmony_ci optional ForeignEnum enum_extension = 2001; 869ffe3c632Sopenharmony_ci optional DynamicEnumType dynamic_enum_extension = 2002; 870ffe3c632Sopenharmony_ci 871ffe3c632Sopenharmony_ci optional ForeignMessage message_extension = 2003; 872ffe3c632Sopenharmony_ci optional DynamicMessageType dynamic_message_extension = 2004; 873ffe3c632Sopenharmony_ci 874ffe3c632Sopenharmony_ci repeated string repeated_extension = 2005; 875ffe3c632Sopenharmony_ci repeated sint32 packed_extension = 2006 [packed = true]; 876ffe3c632Sopenharmony_ci} 877ffe3c632Sopenharmony_ci 878ffe3c632Sopenharmony_cimessage TestRepeatedScalarDifferentTagSizes { 879ffe3c632Sopenharmony_ci // Parsing repeated fixed size values used to fail. This message needs to be 880ffe3c632Sopenharmony_ci // used in order to get a tag of the right size; all of the repeated fields 881ffe3c632Sopenharmony_ci // in TestAllTypes didn't trigger the check. 882ffe3c632Sopenharmony_ci repeated fixed32 repeated_fixed32 = 12; 883ffe3c632Sopenharmony_ci // Check for a varint type, just for good measure. 884ffe3c632Sopenharmony_ci repeated int32 repeated_int32 = 13; 885ffe3c632Sopenharmony_ci 886ffe3c632Sopenharmony_ci // These have two-byte tags. 887ffe3c632Sopenharmony_ci repeated fixed64 repeated_fixed64 = 2046; 888ffe3c632Sopenharmony_ci repeated int64 repeated_int64 = 2047; 889ffe3c632Sopenharmony_ci 890ffe3c632Sopenharmony_ci // Three byte tags. 891ffe3c632Sopenharmony_ci repeated float repeated_float = 262142; 892ffe3c632Sopenharmony_ci repeated uint64 repeated_uint64 = 262143; 893ffe3c632Sopenharmony_ci} 894ffe3c632Sopenharmony_ci 895ffe3c632Sopenharmony_ci// Test that if an optional or required message/group field appears multiple 896ffe3c632Sopenharmony_ci// times in the input, they need to be merged. 897ffe3c632Sopenharmony_cimessage TestParsingMerge { 898ffe3c632Sopenharmony_ci // RepeatedFieldsGenerator defines matching field types as TestParsingMerge, 899ffe3c632Sopenharmony_ci // except that all fields are repeated. In the tests, we will serialize the 900ffe3c632Sopenharmony_ci // RepeatedFieldsGenerator to bytes, and parse the bytes to TestParsingMerge. 901ffe3c632Sopenharmony_ci // Repeated fields in RepeatedFieldsGenerator are expected to be merged into 902ffe3c632Sopenharmony_ci // the corresponding required/optional fields in TestParsingMerge. 903ffe3c632Sopenharmony_ci message RepeatedFieldsGenerator { 904ffe3c632Sopenharmony_ci repeated TestAllTypes field1 = 1; 905ffe3c632Sopenharmony_ci repeated TestAllTypes field2 = 2; 906ffe3c632Sopenharmony_ci repeated TestAllTypes field3 = 3; 907ffe3c632Sopenharmony_ci repeated group Group1 = 10 { 908ffe3c632Sopenharmony_ci optional TestAllTypes field1 = 11; 909ffe3c632Sopenharmony_ci } 910ffe3c632Sopenharmony_ci repeated group Group2 = 20 { 911ffe3c632Sopenharmony_ci optional TestAllTypes field1 = 21; 912ffe3c632Sopenharmony_ci } 913ffe3c632Sopenharmony_ci repeated TestAllTypes ext1 = 1000; 914ffe3c632Sopenharmony_ci repeated TestAllTypes ext2 = 1001; 915ffe3c632Sopenharmony_ci } 916ffe3c632Sopenharmony_ci required TestAllTypes required_all_types = 1; 917ffe3c632Sopenharmony_ci optional TestAllTypes optional_all_types = 2; 918ffe3c632Sopenharmony_ci repeated TestAllTypes repeated_all_types = 3; 919ffe3c632Sopenharmony_ci optional group OptionalGroup = 10 { 920ffe3c632Sopenharmony_ci optional TestAllTypes optional_group_all_types = 11; 921ffe3c632Sopenharmony_ci } 922ffe3c632Sopenharmony_ci repeated group RepeatedGroup = 20 { 923ffe3c632Sopenharmony_ci optional TestAllTypes repeated_group_all_types = 21; 924ffe3c632Sopenharmony_ci } 925ffe3c632Sopenharmony_ci extensions 1000 to max; 926ffe3c632Sopenharmony_ci extend TestParsingMerge { 927ffe3c632Sopenharmony_ci optional TestAllTypes optional_ext = 1000; 928ffe3c632Sopenharmony_ci repeated TestAllTypes repeated_ext = 1001; 929ffe3c632Sopenharmony_ci } 930ffe3c632Sopenharmony_ci} 931ffe3c632Sopenharmony_ci 932ffe3c632Sopenharmony_cimessage TestCommentInjectionMessage { 933ffe3c632Sopenharmony_ci // */ <- This should not close the generated doc comment 934ffe3c632Sopenharmony_ci optional string a = 1 [default="*/ <- Neither should this."]; 935ffe3c632Sopenharmony_ci} 936ffe3c632Sopenharmony_ci 937ffe3c632Sopenharmony_ci 938ffe3c632Sopenharmony_ci// Test that RPC services work. 939ffe3c632Sopenharmony_cimessage FooRequest {} 940ffe3c632Sopenharmony_cimessage FooResponse {} 941ffe3c632Sopenharmony_ci 942ffe3c632Sopenharmony_cimessage FooClientMessage {} 943ffe3c632Sopenharmony_cimessage FooServerMessage{} 944ffe3c632Sopenharmony_ci 945ffe3c632Sopenharmony_ciservice TestService { 946ffe3c632Sopenharmony_ci rpc Foo(FooRequest) returns (FooResponse); 947ffe3c632Sopenharmony_ci rpc Bar(BarRequest) returns (BarResponse); 948ffe3c632Sopenharmony_ci} 949ffe3c632Sopenharmony_ci 950ffe3c632Sopenharmony_ci 951ffe3c632Sopenharmony_cimessage BarRequest {} 952ffe3c632Sopenharmony_cimessage BarResponse {} 953ffe3c632Sopenharmony_ci 954ffe3c632Sopenharmony_cimessage TestJsonName { 955ffe3c632Sopenharmony_ci optional int32 field_name1 = 1; 956ffe3c632Sopenharmony_ci optional int32 fieldName2 = 2; 957ffe3c632Sopenharmony_ci optional int32 FieldName3 = 3; 958ffe3c632Sopenharmony_ci optional int32 _field_name4 = 4; 959ffe3c632Sopenharmony_ci optional int32 FIELD_NAME5 = 5; 960ffe3c632Sopenharmony_ci optional int32 field_name6 = 6 [json_name = "@type"]; 961ffe3c632Sopenharmony_ci} 962ffe3c632Sopenharmony_ci 963ffe3c632Sopenharmony_cimessage TestHugeFieldNumbers { 964ffe3c632Sopenharmony_ci optional int32 optional_int32 = 536870000; 965ffe3c632Sopenharmony_ci optional int32 fixed_32 = 536870001; 966ffe3c632Sopenharmony_ci repeated int32 repeated_int32 = 536870002 [packed = false]; 967ffe3c632Sopenharmony_ci repeated int32 packed_int32 = 536870003 [packed = true]; 968ffe3c632Sopenharmony_ci 969ffe3c632Sopenharmony_ci optional ForeignEnum optional_enum = 536870004; 970ffe3c632Sopenharmony_ci optional string optional_string = 536870005; 971ffe3c632Sopenharmony_ci optional bytes optional_bytes = 536870006; 972ffe3c632Sopenharmony_ci optional ForeignMessage optional_message = 536870007; 973ffe3c632Sopenharmony_ci 974ffe3c632Sopenharmony_ci optional group OptionalGroup = 536870008 { 975ffe3c632Sopenharmony_ci optional int32 group_a = 536870009; 976ffe3c632Sopenharmony_ci } 977ffe3c632Sopenharmony_ci 978ffe3c632Sopenharmony_ci map<string, string> string_string_map = 536870010; 979ffe3c632Sopenharmony_ci 980ffe3c632Sopenharmony_ci oneof oneof_field { 981ffe3c632Sopenharmony_ci uint32 oneof_uint32 = 536870011; 982ffe3c632Sopenharmony_ci TestAllTypes oneof_test_all_types = 536870012; 983ffe3c632Sopenharmony_ci string oneof_string = 536870013; 984ffe3c632Sopenharmony_ci bytes oneof_bytes = 536870014; 985ffe3c632Sopenharmony_ci } 986ffe3c632Sopenharmony_ci 987ffe3c632Sopenharmony_ci extensions 536860000 to 536869999; 988ffe3c632Sopenharmony_ci} 989ffe3c632Sopenharmony_ci 990ffe3c632Sopenharmony_ciextend TestHugeFieldNumbers { 991ffe3c632Sopenharmony_ci optional TestAllTypes test_all_types = 536860000; 992ffe3c632Sopenharmony_ci} 993ffe3c632Sopenharmony_ci 994ffe3c632Sopenharmony_cimessage TestExtensionInsideTable { 995ffe3c632Sopenharmony_ci optional int32 field1 = 1; 996ffe3c632Sopenharmony_ci optional int32 field2 = 2; 997ffe3c632Sopenharmony_ci optional int32 field3 = 3; 998ffe3c632Sopenharmony_ci optional int32 field4 = 4; 999ffe3c632Sopenharmony_ci extensions 5 to 5; 1000ffe3c632Sopenharmony_ci optional int32 field6 = 6; 1001ffe3c632Sopenharmony_ci optional int32 field7 = 7; 1002ffe3c632Sopenharmony_ci optional int32 field8 = 8; 1003ffe3c632Sopenharmony_ci optional int32 field9 = 9; 1004ffe3c632Sopenharmony_ci optional int32 field10 = 10; 1005ffe3c632Sopenharmony_ci} 1006ffe3c632Sopenharmony_ci 1007ffe3c632Sopenharmony_ciextend TestExtensionInsideTable { 1008ffe3c632Sopenharmony_ci optional int32 test_extension_inside_table_extension = 5; 1009ffe3c632Sopenharmony_ci} 1010ffe3c632Sopenharmony_ci 1011ffe3c632Sopenharmony_cienum VeryLargeEnum { 1012ffe3c632Sopenharmony_ci ENUM_LABEL_DEFAULT = 0; 1013ffe3c632Sopenharmony_ci ENUM_LABEL_1 = 1; 1014ffe3c632Sopenharmony_ci ENUM_LABEL_2 = 2; 1015ffe3c632Sopenharmony_ci ENUM_LABEL_3 = 3; 1016ffe3c632Sopenharmony_ci ENUM_LABEL_4 = 4; 1017ffe3c632Sopenharmony_ci ENUM_LABEL_5 = 5; 1018ffe3c632Sopenharmony_ci ENUM_LABEL_6 = 6; 1019ffe3c632Sopenharmony_ci ENUM_LABEL_7 = 7; 1020ffe3c632Sopenharmony_ci ENUM_LABEL_8 = 8; 1021ffe3c632Sopenharmony_ci ENUM_LABEL_9 = 9; 1022ffe3c632Sopenharmony_ci ENUM_LABEL_10 = 10; 1023ffe3c632Sopenharmony_ci ENUM_LABEL_11 = 11; 1024ffe3c632Sopenharmony_ci ENUM_LABEL_12 = 12; 1025ffe3c632Sopenharmony_ci ENUM_LABEL_13 = 13; 1026ffe3c632Sopenharmony_ci ENUM_LABEL_14 = 14; 1027ffe3c632Sopenharmony_ci ENUM_LABEL_15 = 15; 1028ffe3c632Sopenharmony_ci ENUM_LABEL_16 = 16; 1029ffe3c632Sopenharmony_ci ENUM_LABEL_17 = 17; 1030ffe3c632Sopenharmony_ci ENUM_LABEL_18 = 18; 1031ffe3c632Sopenharmony_ci ENUM_LABEL_19 = 19; 1032ffe3c632Sopenharmony_ci ENUM_LABEL_20 = 20; 1033ffe3c632Sopenharmony_ci ENUM_LABEL_21 = 21; 1034ffe3c632Sopenharmony_ci ENUM_LABEL_22 = 22; 1035ffe3c632Sopenharmony_ci ENUM_LABEL_23 = 23; 1036ffe3c632Sopenharmony_ci ENUM_LABEL_24 = 24; 1037ffe3c632Sopenharmony_ci ENUM_LABEL_25 = 25; 1038ffe3c632Sopenharmony_ci ENUM_LABEL_26 = 26; 1039ffe3c632Sopenharmony_ci ENUM_LABEL_27 = 27; 1040ffe3c632Sopenharmony_ci ENUM_LABEL_28 = 28; 1041ffe3c632Sopenharmony_ci ENUM_LABEL_29 = 29; 1042ffe3c632Sopenharmony_ci ENUM_LABEL_30 = 30; 1043ffe3c632Sopenharmony_ci ENUM_LABEL_31 = 31; 1044ffe3c632Sopenharmony_ci ENUM_LABEL_32 = 32; 1045ffe3c632Sopenharmony_ci ENUM_LABEL_33 = 33; 1046ffe3c632Sopenharmony_ci ENUM_LABEL_34 = 34; 1047ffe3c632Sopenharmony_ci ENUM_LABEL_35 = 35; 1048ffe3c632Sopenharmony_ci ENUM_LABEL_36 = 36; 1049ffe3c632Sopenharmony_ci ENUM_LABEL_37 = 37; 1050ffe3c632Sopenharmony_ci ENUM_LABEL_38 = 38; 1051ffe3c632Sopenharmony_ci ENUM_LABEL_39 = 39; 1052ffe3c632Sopenharmony_ci ENUM_LABEL_40 = 40; 1053ffe3c632Sopenharmony_ci ENUM_LABEL_41 = 41; 1054ffe3c632Sopenharmony_ci ENUM_LABEL_42 = 42; 1055ffe3c632Sopenharmony_ci ENUM_LABEL_43 = 43; 1056ffe3c632Sopenharmony_ci ENUM_LABEL_44 = 44; 1057ffe3c632Sopenharmony_ci ENUM_LABEL_45 = 45; 1058ffe3c632Sopenharmony_ci ENUM_LABEL_46 = 46; 1059ffe3c632Sopenharmony_ci ENUM_LABEL_47 = 47; 1060ffe3c632Sopenharmony_ci ENUM_LABEL_48 = 48; 1061ffe3c632Sopenharmony_ci ENUM_LABEL_49 = 49; 1062ffe3c632Sopenharmony_ci ENUM_LABEL_50 = 50; 1063ffe3c632Sopenharmony_ci ENUM_LABEL_51 = 51; 1064ffe3c632Sopenharmony_ci ENUM_LABEL_52 = 52; 1065ffe3c632Sopenharmony_ci ENUM_LABEL_53 = 53; 1066ffe3c632Sopenharmony_ci ENUM_LABEL_54 = 54; 1067ffe3c632Sopenharmony_ci ENUM_LABEL_55 = 55; 1068ffe3c632Sopenharmony_ci ENUM_LABEL_56 = 56; 1069ffe3c632Sopenharmony_ci ENUM_LABEL_57 = 57; 1070ffe3c632Sopenharmony_ci ENUM_LABEL_58 = 58; 1071ffe3c632Sopenharmony_ci ENUM_LABEL_59 = 59; 1072ffe3c632Sopenharmony_ci ENUM_LABEL_60 = 60; 1073ffe3c632Sopenharmony_ci ENUM_LABEL_61 = 61; 1074ffe3c632Sopenharmony_ci ENUM_LABEL_62 = 62; 1075ffe3c632Sopenharmony_ci ENUM_LABEL_63 = 63; 1076ffe3c632Sopenharmony_ci ENUM_LABEL_64 = 64; 1077ffe3c632Sopenharmony_ci ENUM_LABEL_65 = 65; 1078ffe3c632Sopenharmony_ci ENUM_LABEL_66 = 66; 1079ffe3c632Sopenharmony_ci ENUM_LABEL_67 = 67; 1080ffe3c632Sopenharmony_ci ENUM_LABEL_68 = 68; 1081ffe3c632Sopenharmony_ci ENUM_LABEL_69 = 69; 1082ffe3c632Sopenharmony_ci ENUM_LABEL_70 = 70; 1083ffe3c632Sopenharmony_ci ENUM_LABEL_71 = 71; 1084ffe3c632Sopenharmony_ci ENUM_LABEL_72 = 72; 1085ffe3c632Sopenharmony_ci ENUM_LABEL_73 = 73; 1086ffe3c632Sopenharmony_ci ENUM_LABEL_74 = 74; 1087ffe3c632Sopenharmony_ci ENUM_LABEL_75 = 75; 1088ffe3c632Sopenharmony_ci ENUM_LABEL_76 = 76; 1089ffe3c632Sopenharmony_ci ENUM_LABEL_77 = 77; 1090ffe3c632Sopenharmony_ci ENUM_LABEL_78 = 78; 1091ffe3c632Sopenharmony_ci ENUM_LABEL_79 = 79; 1092ffe3c632Sopenharmony_ci ENUM_LABEL_80 = 80; 1093ffe3c632Sopenharmony_ci ENUM_LABEL_81 = 81; 1094ffe3c632Sopenharmony_ci ENUM_LABEL_82 = 82; 1095ffe3c632Sopenharmony_ci ENUM_LABEL_83 = 83; 1096ffe3c632Sopenharmony_ci ENUM_LABEL_84 = 84; 1097ffe3c632Sopenharmony_ci ENUM_LABEL_85 = 85; 1098ffe3c632Sopenharmony_ci ENUM_LABEL_86 = 86; 1099ffe3c632Sopenharmony_ci ENUM_LABEL_87 = 87; 1100ffe3c632Sopenharmony_ci ENUM_LABEL_88 = 88; 1101ffe3c632Sopenharmony_ci ENUM_LABEL_89 = 89; 1102ffe3c632Sopenharmony_ci ENUM_LABEL_90 = 90; 1103ffe3c632Sopenharmony_ci ENUM_LABEL_91 = 91; 1104ffe3c632Sopenharmony_ci ENUM_LABEL_92 = 92; 1105ffe3c632Sopenharmony_ci ENUM_LABEL_93 = 93; 1106ffe3c632Sopenharmony_ci ENUM_LABEL_94 = 94; 1107ffe3c632Sopenharmony_ci ENUM_LABEL_95 = 95; 1108ffe3c632Sopenharmony_ci ENUM_LABEL_96 = 96; 1109ffe3c632Sopenharmony_ci ENUM_LABEL_97 = 97; 1110ffe3c632Sopenharmony_ci ENUM_LABEL_98 = 98; 1111ffe3c632Sopenharmony_ci ENUM_LABEL_99 = 99; 1112ffe3c632Sopenharmony_ci ENUM_LABEL_100 = 100; 1113ffe3c632Sopenharmony_ci}; 1114