OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // http://code.google.com/p/protobuf/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
11 // * Redistributions in binary form must reproduce the above | 11 // * Redistributions in binary form must reproduce the above |
12 // copyright notice, this list of conditions and the following disclaimer | 12 // copyright notice, this list of conditions and the following disclaimer |
13 // in the documentation and/or other materials provided with the | 13 // in the documentation and/or other materials provided with the |
(...skipping 13 matching lines...) Expand all Loading... |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 // Author: kenton@google.com (Kenton Varda) | 31 // Author: kenton@google.com (Kenton Varda) |
32 // Based on original Protocol Buffers design by | 32 // Based on original Protocol Buffers design by |
33 // Sanjay Ghemawat, Jeff Dean, and others. | 33 // Sanjay Ghemawat, Jeff Dean, and others. |
34 // | 34 // |
35 // A proto file we will use for unit testing. | 35 // A proto file we will use for unit testing. |
36 | 36 |
37 syntax = "proto2"; | |
38 | 37 |
39 // Some generic_services option(s) added automatically. | 38 // Some generic_services option(s) added automatically. |
40 // See: http://go/proto2-generic-services-default | 39 // See: http://go/proto2-generic-services-default |
41 option cc_generic_services = true; // auto-added | 40 option cc_generic_services = true; // auto-added |
42 option java_generic_services = true; // auto-added | 41 option java_generic_services = true; // auto-added |
43 option py_generic_services = true; // auto-added | 42 option py_generic_services = true; // auto-added |
44 option cc_enable_arenas = true; | |
45 | 43 |
46 import "google/protobuf/unittest_import.proto"; | 44 import "google/protobuf/unittest_import.proto"; |
47 | 45 |
48 // We don't put this in a package within proto2 because we need to make sure | 46 // We don't put this in a package within proto2 because we need to make sure |
49 // that the generated code doesn't depend on being in the proto2 namespace. | 47 // that the generated code doesn't depend on being in the proto2 namespace. |
50 // In test_util.h we do "using namespace unittest = protobuf_unittest". | 48 // In test_util.h we do "using namespace unittest = protobuf_unittest". |
51 package protobuf_unittest; | 49 package protobuf_unittest; |
52 | 50 |
53 // Protos optimized for SPEED use a strict superset of the generated code | 51 // Protos optimized for SPEED use a strict superset of the generated code |
54 // of equivalent ones optimized for CODE_SIZE, so we should optimize all our | 52 // of equivalent ones optimized for CODE_SIZE, so we should optimize all our |
55 // tests for speed unless explicitly testing code size optimization. | 53 // tests for speed unless explicitly testing code size optimization. |
56 option optimize_for = SPEED; | 54 option optimize_for = SPEED; |
57 | 55 |
58 option java_outer_classname = "UnittestProto"; | 56 option java_outer_classname = "UnittestProto"; |
59 | 57 |
60 // This proto includes every type of field in both singular and repeated | 58 // This proto includes every type of field in both singular and repeated |
61 // forms. | 59 // forms. |
62 message TestAllTypes { | 60 message TestAllTypes { |
63 message NestedMessage { | 61 message NestedMessage { |
64 // The field name "b" fails to compile in proto1 because it conflicts with | 62 // The field name "b" fails to compile in proto1 because it conflicts with |
65 // a local variable named "b" in one of the generated methods. Doh. | 63 // a local variable named "b" in one of the generated methods. Doh. |
66 // This file needs to compile in proto1 to test backwards-compatibility. | 64 // This file needs to compile in proto1 to test backwards-compatibility. |
67 optional int32 bb = 1; | 65 optional int32 bb = 1; |
68 } | 66 } |
69 | 67 |
70 enum NestedEnum { | 68 enum NestedEnum { |
71 FOO = 1; | 69 FOO = 1; |
72 BAR = 2; | 70 BAR = 2; |
73 BAZ = 3; | 71 BAZ = 3; |
74 NEG = -1; // Intentionally negative. | |
75 } | 72 } |
76 | 73 |
77 // Singular | 74 // Singular |
78 optional int32 optional_int32 = 1; | 75 optional int32 optional_int32 = 1; |
79 optional int64 optional_int64 = 2; | 76 optional int64 optional_int64 = 2; |
80 optional uint32 optional_uint32 = 3; | 77 optional uint32 optional_uint32 = 3; |
81 optional uint64 optional_uint64 = 4; | 78 optional uint64 optional_uint64 = 4; |
82 optional sint32 optional_sint32 = 5; | 79 optional sint32 optional_sint32 = 5; |
83 optional sint64 optional_sint64 = 6; | 80 optional sint64 optional_sint64 = 6; |
84 optional fixed32 optional_fixed32 = 7; | 81 optional fixed32 optional_fixed32 = 7; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 optional string default_string = 74 [default = "hello"]; | 160 optional string default_string = 74 [default = "hello"]; |
164 optional bytes default_bytes = 75 [default = "world"]; | 161 optional bytes default_bytes = 75 [default = "world"]; |
165 | 162 |
166 optional NestedEnum default_nested_enum = 81 [default = BAR ]; | 163 optional NestedEnum default_nested_enum = 81 [default = BAR ]; |
167 optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; | 164 optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; |
168 optional protobuf_unittest_import.ImportEnum | 165 optional protobuf_unittest_import.ImportEnum |
169 default_import_enum = 83 [default = IMPORT_BAR]; | 166 default_import_enum = 83 [default = IMPORT_BAR]; |
170 | 167 |
171 optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; | 168 optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; |
172 optional string default_cord = 85 [ctype=CORD,default="123"]; | 169 optional string default_cord = 85 [ctype=CORD,default="123"]; |
173 | |
174 // For oneof test | |
175 oneof oneof_field { | |
176 uint32 oneof_uint32 = 111; | |
177 NestedMessage oneof_nested_message = 112; | |
178 string oneof_string = 113; | |
179 bytes oneof_bytes = 114; | |
180 } | |
181 } | |
182 | |
183 // This proto includes a recusively nested message. | |
184 message NestedTestAllTypes { | |
185 optional NestedTestAllTypes child = 1; | |
186 optional TestAllTypes payload = 2; | |
187 repeated NestedTestAllTypes repeated_child = 3; | |
188 } | 170 } |
189 | 171 |
190 message TestDeprecatedFields { | 172 message TestDeprecatedFields { |
191 optional int32 deprecated_int32 = 1 [deprecated=true]; | 173 optional int32 deprecated_int32 = 1 [deprecated=true]; |
192 } | 174 } |
193 | 175 |
194 // Define these after TestAllTypes to make sure the compiler can handle | 176 // Define these after TestAllTypes to make sure the compiler can handle |
195 // that. | 177 // that. |
196 message ForeignMessage { | 178 message ForeignMessage { |
197 optional int32 c = 1; | 179 optional int32 c = 1; |
198 } | 180 } |
199 | 181 |
200 enum ForeignEnum { | 182 enum ForeignEnum { |
201 FOREIGN_FOO = 4; | 183 FOREIGN_FOO = 4; |
202 FOREIGN_BAR = 5; | 184 FOREIGN_BAR = 5; |
203 FOREIGN_BAZ = 6; | 185 FOREIGN_BAZ = 6; |
204 } | 186 } |
205 | 187 |
206 message TestReservedFields { | |
207 reserved 2, 15, 9 to 11; | |
208 reserved "bar", "baz"; | |
209 } | |
210 | |
211 message TestAllExtensions { | 188 message TestAllExtensions { |
212 extensions 1 to max; | 189 extensions 1 to max; |
213 } | 190 } |
214 | 191 |
215 extend TestAllExtensions { | 192 extend TestAllExtensions { |
216 // Singular | 193 // Singular |
217 optional int32 optional_int32_extension = 1; | 194 optional int32 optional_int32_extension = 1; |
218 optional int64 optional_int64_extension = 2; | 195 optional int64 optional_int64_extension = 2; |
219 optional uint32 optional_uint32_extension = 3; | 196 optional uint32 optional_uint32_extension = 3; |
220 optional uint64 optional_uint64_extension = 4; | 197 optional uint64 optional_uint64_extension = 4; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 optional TestAllTypes.NestedEnum | 287 optional TestAllTypes.NestedEnum |
311 default_nested_enum_extension = 81 [default = BAR]; | 288 default_nested_enum_extension = 81 [default = BAR]; |
312 optional ForeignEnum | 289 optional ForeignEnum |
313 default_foreign_enum_extension = 82 [default = FOREIGN_BAR]; | 290 default_foreign_enum_extension = 82 [default = FOREIGN_BAR]; |
314 optional protobuf_unittest_import.ImportEnum | 291 optional protobuf_unittest_import.ImportEnum |
315 default_import_enum_extension = 83 [default = IMPORT_BAR]; | 292 default_import_enum_extension = 83 [default = IMPORT_BAR]; |
316 | 293 |
317 optional string default_string_piece_extension = 84 [ctype=STRING_PIECE, | 294 optional string default_string_piece_extension = 84 [ctype=STRING_PIECE, |
318 default="abc"]; | 295 default="abc"]; |
319 optional string default_cord_extension = 85 [ctype=CORD, default="123"]; | 296 optional string default_cord_extension = 85 [ctype=CORD, default="123"]; |
320 | |
321 // For oneof test | |
322 optional uint32 oneof_uint32_extension = 111; | |
323 optional TestAllTypes.NestedMessage oneof_nested_message_extension = 112; | |
324 optional string oneof_string_extension = 113; | |
325 optional bytes oneof_bytes_extension = 114; | |
326 } | 297 } |
327 | 298 |
328 message TestNestedExtension { | 299 message TestNestedExtension { |
329 extend TestAllExtensions { | 300 extend TestAllExtensions { |
330 // Check for bug where string extensions declared in tested scope did not | 301 // Check for bug where string extensions declared in tested scope did not |
331 // compile. | 302 // compile. |
332 optional string test = 1002 [default="test"]; | 303 optional string test = 1002 [default="test"]; |
333 // Used to test if generated extension name is correct when there are | |
334 // underscores. | |
335 optional string nested_string_extension = 1003; | |
336 } | 304 } |
337 } | 305 } |
338 | 306 |
339 // We have separate messages for testing required fields because it's | 307 // We have separate messages for testing required fields because it's |
340 // annoying to have to fill in required fields in TestProto in order to | 308 // annoying to have to fill in required fields in TestProto in order to |
341 // do anything with it. Note that we don't need to test every type of | 309 // do anything with it. Note that we don't need to test every type of |
342 // required filed because the code output is basically identical to | 310 // required filed because the code output is basically identical to |
343 // optional fields for all types. | 311 // optional fields for all types. |
344 message TestRequired { | 312 message TestRequired { |
345 required int32 a = 1; | 313 required int32 a = 1; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 message TestMutualRecursionA { | 398 message TestMutualRecursionA { |
431 optional TestMutualRecursionB bb = 1; | 399 optional TestMutualRecursionB bb = 1; |
432 } | 400 } |
433 | 401 |
434 message TestMutualRecursionB { | 402 message TestMutualRecursionB { |
435 optional TestMutualRecursionA a = 1; | 403 optional TestMutualRecursionA a = 1; |
436 optional int32 optional_int32 = 2; | 404 optional int32 optional_int32 = 2; |
437 } | 405 } |
438 | 406 |
439 // Test that groups have disjoint field numbers from their siblings and | 407 // Test that groups have disjoint field numbers from their siblings and |
440 // parents. This is NOT possible in proto1; only google.protobuf. When attempt
ing | 408 // parents. This is NOT possible in proto1; only proto2. When attempting |
441 // to compile with proto1, this will emit an error; so we only include it | 409 // to compile with proto1, this will emit an error; so we only include it |
442 // in protobuf_unittest_proto. | 410 // in protobuf_unittest_proto. |
443 message TestDupFieldNumber { // NO_PROTO1 | 411 message TestDupFieldNumber { // NO_PROTO1 |
444 optional int32 a = 1; // NO_PROTO1 | 412 optional int32 a = 1; // NO_PROTO1 |
445 optional group Foo = 2 { optional int32 a = 1; } // NO_PROTO1 | 413 optional group Foo = 2 { optional int32 a = 1; } // NO_PROTO1 |
446 optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1 | 414 optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1 |
447 } // NO_PROTO1 | 415 } // NO_PROTO1 |
448 | 416 |
449 // Additional messages for testing lazy fields. | 417 // Additional messages for testing lazy fields. |
450 message TestEagerMessage { | 418 message TestEagerMessage { |
451 optional TestAllTypes sub_message = 1 [lazy=false]; | 419 optional TestAllTypes sub_message = 1 [lazy=false]; |
452 } | 420 } |
453 message TestLazyMessage { | 421 message TestLazyMessage { |
454 optional TestAllTypes sub_message = 1 [lazy=true]; | 422 optional TestAllTypes sub_message = 1 [lazy=true]; |
455 } | 423 } |
456 | 424 |
457 // Needed for a Python test. | 425 // Needed for a Python test. |
458 message TestNestedMessageHasBits { | 426 message TestNestedMessageHasBits { |
459 message NestedMessage { | 427 message NestedMessage { |
460 repeated int32 nestedmessage_repeated_int32 = 1; | 428 repeated int32 nestedmessage_repeated_int32 = 1; |
461 repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2; | 429 repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2; |
462 } | 430 } |
463 optional NestedMessage optional_nested_message = 1; | 431 optional NestedMessage optional_nested_message = 1; |
464 } | 432 } |
465 | 433 |
466 | 434 |
467 // Test an enum that has multiple values with the same number. | 435 // Test an enum that has multiple values with the same number. |
468 enum TestEnumWithDupValue { | 436 enum TestEnumWithDupValue { |
469 option allow_alias = true; | 437 option allow_alias = true; |
470 | |
471 FOO1 = 1; | 438 FOO1 = 1; |
472 BAR1 = 2; | 439 BAR1 = 2; |
473 BAZ = 3; | 440 BAZ = 3; |
474 FOO2 = 1; | 441 FOO2 = 1; |
475 BAR2 = 2; | 442 BAR2 = 2; |
476 } | 443 } |
477 | 444 |
478 // Test an enum with large, unordered values. | 445 // Test an enum with large, unordered values. |
479 enum TestSparseEnum { | 446 enum TestSparseEnum { |
480 SPARSE_A = 123; | 447 SPARSE_A = 123; |
(...skipping 25 matching lines...) Expand all Loading... |
506 | 473 |
507 | 474 |
508 // We list fields out of order, to ensure that we're using field number and not | 475 // We list fields out of order, to ensure that we're using field number and not |
509 // field index to determine serialization order. | 476 // field index to determine serialization order. |
510 message TestFieldOrderings { | 477 message TestFieldOrderings { |
511 optional string my_string = 11; | 478 optional string my_string = 11; |
512 extensions 2 to 10; | 479 extensions 2 to 10; |
513 optional int64 my_int = 1; | 480 optional int64 my_int = 1; |
514 extensions 12 to 100; | 481 extensions 12 to 100; |
515 optional float my_float = 101; | 482 optional float my_float = 101; |
516 message NestedMessage { | |
517 optional int64 oo = 2; | |
518 // The field name "b" fails to compile in proto1 because it conflicts with | |
519 // a local variable named "b" in one of the generated methods. Doh. | |
520 // This file needs to compile in proto1 to test backwards-compatibility. | |
521 optional int32 bb = 1; | |
522 } | |
523 | |
524 optional NestedMessage optional_nested_message = 200; | |
525 } | 483 } |
526 | 484 |
527 | 485 |
528 extend TestFieldOrderings { | 486 extend TestFieldOrderings { |
529 optional string my_extension_string = 50; | 487 optional string my_extension_string = 50; |
530 optional int32 my_extension_int = 5; | 488 optional int32 my_extension_int = 5; |
531 } | 489 } |
532 | 490 |
533 | 491 |
534 message TestExtremeDefaultValues { | 492 message TestExtremeDefaultValues { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 // literals. | 528 // literals. |
571 optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"]; | 529 optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"]; |
572 | 530 |
573 // String defaults containing the character '\000' | 531 // String defaults containing the character '\000' |
574 optional string string_with_zero = 23 [default = "hel\000lo"]; | 532 optional string string_with_zero = 23 [default = "hel\000lo"]; |
575 optional bytes bytes_with_zero = 24 [default = "wor\000ld"]; | 533 optional bytes bytes_with_zero = 24 [default = "wor\000ld"]; |
576 optional string string_piece_with_zero = 25 [ctype=STRING_PIECE, | 534 optional string string_piece_with_zero = 25 [ctype=STRING_PIECE, |
577 default="ab\000c"]; | 535 default="ab\000c"]; |
578 optional string cord_with_zero = 26 [ctype=CORD, | 536 optional string cord_with_zero = 26 [ctype=CORD, |
579 default="12\0003"]; | 537 default="12\0003"]; |
580 optional string replacement_string = 27 [default="${unknown}"]; | |
581 } | 538 } |
582 | 539 |
583 message SparseEnumMessage { | 540 message SparseEnumMessage { |
584 optional TestSparseEnum sparse_enum = 1; | 541 optional TestSparseEnum sparse_enum = 1; |
585 } | 542 } |
586 | 543 |
587 // Test String and Bytes: string is for valid UTF-8 strings | 544 // Test String and Bytes: string is for valid UTF-8 strings |
588 message OneString { | 545 message OneString { |
589 optional string data = 1; | 546 optional string data = 1; |
590 } | 547 } |
591 | 548 |
592 message MoreString { | 549 message MoreString { |
593 repeated string data = 1; | 550 repeated string data = 1; |
594 } | 551 } |
595 | 552 |
596 message OneBytes { | 553 message OneBytes { |
597 optional bytes data = 1; | 554 optional bytes data = 1; |
598 } | 555 } |
599 | 556 |
600 message MoreBytes { | 557 message MoreBytes { |
601 repeated bytes data = 1; | 558 repeated bytes data = 1; |
602 } | 559 } |
603 | 560 |
604 // Test int32, uint32, int64, uint64, and bool are all compatible | |
605 message Int32Message { | |
606 optional int32 data = 1; | |
607 } | |
608 | |
609 message Uint32Message { | |
610 optional uint32 data = 1; | |
611 } | |
612 | |
613 message Int64Message { | |
614 optional int64 data = 1; | |
615 } | |
616 | |
617 message Uint64Message { | |
618 optional uint64 data = 1; | |
619 } | |
620 | |
621 message BoolMessage { | |
622 optional bool data = 1; | |
623 } | |
624 | |
625 // Test oneofs. | |
626 message TestOneof { | |
627 oneof foo { | |
628 int32 foo_int = 1; | |
629 string foo_string = 2; | |
630 TestAllTypes foo_message = 3; | |
631 group FooGroup = 4 { | |
632 optional int32 a = 5; | |
633 optional string b = 6; | |
634 } | |
635 } | |
636 } | |
637 | |
638 message TestOneofBackwardsCompatible { | |
639 optional int32 foo_int = 1; | |
640 optional string foo_string = 2; | |
641 optional TestAllTypes foo_message = 3; | |
642 optional group FooGroup = 4 { | |
643 optional int32 a = 5; | |
644 optional string b = 6; | |
645 } | |
646 } | |
647 | |
648 message TestOneof2 { | |
649 oneof foo { | |
650 int32 foo_int = 1; | |
651 string foo_string = 2; | |
652 string foo_cord = 3 [ctype=CORD]; | |
653 string foo_string_piece = 4 [ctype=STRING_PIECE]; | |
654 bytes foo_bytes = 5; | |
655 NestedEnum foo_enum = 6; | |
656 NestedMessage foo_message = 7; | |
657 group FooGroup = 8 { | |
658 optional int32 a = 9; | |
659 optional string b = 10; | |
660 } | |
661 NestedMessage foo_lazy_message = 11 [lazy=true]; | |
662 } | |
663 | |
664 oneof bar { | |
665 int32 bar_int = 12 [default = 5]; | |
666 string bar_string = 13 [default = "STRING"]; | |
667 string bar_cord = 14 [ctype=CORD, default = "CORD"]; | |
668 string bar_string_piece = 15 [ctype=STRING_PIECE, default = "SPIECE"]; | |
669 bytes bar_bytes = 16 [default = "BYTES"]; | |
670 NestedEnum bar_enum = 17 [default = BAR]; | |
671 } | |
672 | |
673 optional int32 baz_int = 18; | |
674 optional string baz_string = 19 [default = "BAZ"]; | |
675 | |
676 message NestedMessage { | |
677 optional int64 qux_int = 1; | |
678 repeated int32 corge_int = 2; | |
679 } | |
680 | |
681 enum NestedEnum { | |
682 FOO = 1; | |
683 BAR = 2; | |
684 BAZ = 3; | |
685 } | |
686 } | |
687 | |
688 message TestRequiredOneof { | |
689 oneof foo { | |
690 int32 foo_int = 1; | |
691 string foo_string = 2; | |
692 NestedMessage foo_message = 3; | |
693 } | |
694 message NestedMessage { | |
695 required double required_double = 1; | |
696 } | |
697 } | |
698 | |
699 | 561 |
700 // Test messages for packed fields | 562 // Test messages for packed fields |
701 | 563 |
702 message TestPackedTypes { | 564 message TestPackedTypes { |
703 repeated int32 packed_int32 = 90 [packed = true]; | 565 repeated int32 packed_int32 = 90 [packed = true]; |
704 repeated int64 packed_int64 = 91 [packed = true]; | 566 repeated int64 packed_int64 = 91 [packed = true]; |
705 repeated uint32 packed_uint32 = 92 [packed = true]; | 567 repeated uint32 packed_uint32 = 92 [packed = true]; |
706 repeated uint64 packed_uint64 = 93 [packed = true]; | 568 repeated uint64 packed_uint64 = 93 [packed = true]; |
707 repeated sint32 packed_sint32 = 94 [packed = true]; | 569 repeated sint32 packed_sint32 = 94 [packed = true]; |
708 repeated sint64 packed_sint64 = 95 [packed = true]; | 570 repeated sint64 packed_sint64 = 95 [packed = true]; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 repeated fixed32 packed_fixed32_extension = 96 [packed = true]; | 611 repeated fixed32 packed_fixed32_extension = 96 [packed = true]; |
750 repeated fixed64 packed_fixed64_extension = 97 [packed = true]; | 612 repeated fixed64 packed_fixed64_extension = 97 [packed = true]; |
751 repeated sfixed32 packed_sfixed32_extension = 98 [packed = true]; | 613 repeated sfixed32 packed_sfixed32_extension = 98 [packed = true]; |
752 repeated sfixed64 packed_sfixed64_extension = 99 [packed = true]; | 614 repeated sfixed64 packed_sfixed64_extension = 99 [packed = true]; |
753 repeated float packed_float_extension = 100 [packed = true]; | 615 repeated float packed_float_extension = 100 [packed = true]; |
754 repeated double packed_double_extension = 101 [packed = true]; | 616 repeated double packed_double_extension = 101 [packed = true]; |
755 repeated bool packed_bool_extension = 102 [packed = true]; | 617 repeated bool packed_bool_extension = 102 [packed = true]; |
756 repeated ForeignEnum packed_enum_extension = 103 [packed = true]; | 618 repeated ForeignEnum packed_enum_extension = 103 [packed = true]; |
757 } | 619 } |
758 | 620 |
759 message TestUnpackedExtensions { | |
760 extensions 1 to max; | |
761 } | |
762 | |
763 extend TestUnpackedExtensions { | |
764 repeated int32 unpacked_int32_extension = 90 [packed = false]; | |
765 repeated int64 unpacked_int64_extension = 91 [packed = false]; | |
766 repeated uint32 unpacked_uint32_extension = 92 [packed = false]; | |
767 repeated uint64 unpacked_uint64_extension = 93 [packed = false]; | |
768 repeated sint32 unpacked_sint32_extension = 94 [packed = false]; | |
769 repeated sint64 unpacked_sint64_extension = 95 [packed = false]; | |
770 repeated fixed32 unpacked_fixed32_extension = 96 [packed = false]; | |
771 repeated fixed64 unpacked_fixed64_extension = 97 [packed = false]; | |
772 repeated sfixed32 unpacked_sfixed32_extension = 98 [packed = false]; | |
773 repeated sfixed64 unpacked_sfixed64_extension = 99 [packed = false]; | |
774 repeated float unpacked_float_extension = 100 [packed = false]; | |
775 repeated double unpacked_double_extension = 101 [packed = false]; | |
776 repeated bool unpacked_bool_extension = 102 [packed = false]; | |
777 repeated ForeignEnum unpacked_enum_extension = 103 [packed = false]; | |
778 } | |
779 | |
780 // Used by ExtensionSetTest/DynamicExtensions. The test actually builds | 621 // Used by ExtensionSetTest/DynamicExtensions. The test actually builds |
781 // a set of extensions to TestAllExtensions dynamically, based on the fields | 622 // a set of extensions to TestAllExtensions dynamically, based on the fields |
782 // of this message type. | 623 // of this message type. |
783 message TestDynamicExtensions { | 624 message TestDynamicExtensions { |
784 enum DynamicEnumType { | 625 enum DynamicEnumType { |
785 DYNAMIC_FOO = 2200; | 626 DYNAMIC_FOO = 2200; |
786 DYNAMIC_BAR = 2201; | 627 DYNAMIC_BAR = 2201; |
787 DYNAMIC_BAZ = 2202; | 628 DYNAMIC_BAZ = 2202; |
788 } | 629 } |
789 message DynamicMessageType { | 630 message DynamicMessageType { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 message FooServerMessage{} | 710 message FooServerMessage{} |
870 | 711 |
871 service TestService { | 712 service TestService { |
872 rpc Foo(FooRequest) returns (FooResponse); | 713 rpc Foo(FooRequest) returns (FooResponse); |
873 rpc Bar(BarRequest) returns (BarResponse); | 714 rpc Bar(BarRequest) returns (BarResponse); |
874 } | 715 } |
875 | 716 |
876 | 717 |
877 message BarRequest {} | 718 message BarRequest {} |
878 message BarResponse {} | 719 message BarResponse {} |
879 | |
OLD | NEW |