summaryrefslogtreecommitdiffstats
path: root/src/google/protobuf/unittest.proto
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/unittest.proto')
-rw-r--r--src/google/protobuf/unittest.proto251
1 files changed, 1 insertions, 250 deletions
diff --git a/src/google/protobuf/unittest.proto b/src/google/protobuf/unittest.proto
index c48cc92..d51fa1e 100644
--- a/src/google/protobuf/unittest.proto
+++ b/src/google/protobuf/unittest.proto
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -35,12 +35,6 @@
// A proto file we will use for unit testing.
-// Some generic_services option(s) added automatically.
-// See: http://go/proto2-generic-services-default
-option cc_generic_services = true; // auto-added
-option java_generic_services = true; // auto-added
-option py_generic_services = true; // auto-added
-
import "google/protobuf/unittest_import.proto";
// We don't put this in a package within proto2 because we need to make sure
@@ -69,7 +63,6 @@ message TestAllTypes {
FOO = 1;
BAR = 2;
BAZ = 3;
- NEG = -1; // Intentionally negative.
}
// Singular
@@ -104,12 +97,6 @@ message TestAllTypes {
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.PublicImportMessage
- optional_public_import_message = 26;
-
- optional NestedMessage optional_lazy_message = 27 [lazy=true];
-
// Repeated
repeated int32 repeated_int32 = 31;
repeated int64 repeated_int64 = 32;
@@ -142,8 +129,6 @@ message TestAllTypes {
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 ];
@@ -168,20 +153,6 @@ message TestAllTypes {
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;
- }
-}
-
-// This proto includes a recusively nested message.
-message NestedTestAllTypes {
- optional NestedTestAllTypes child = 1;
- optional TestAllTypes payload = 2;
}
message TestDeprecatedFields {
@@ -239,12 +210,6 @@ extend TestAllExtensions {
optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE];
optional string optional_cord_extension = 25 [ctype=CORD];
- optional protobuf_unittest_import.PublicImportMessage
- optional_public_import_message_extension = 26;
-
- optional TestAllTypes.NestedMessage
- optional_lazy_message_extension = 27 [lazy=true];
-
// Repeated
repeated int32 repeated_int32_extension = 31;
repeated int64 repeated_int64_extension = 32;
@@ -279,9 +244,6 @@ extend TestAllExtensions {
repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE];
repeated string repeated_cord_extension = 55 [ctype=CORD];
- repeated TestAllTypes.NestedMessage
- repeated_lazy_message_extension = 57 [lazy=true];
-
// Singular with defaults
optional int32 default_int32_extension = 61 [default = 41 ];
optional int64 default_int64_extension = 62 [default = 42 ];
@@ -309,12 +271,6 @@ extend TestAllExtensions {
optional string default_string_piece_extension = 84 [ctype=STRING_PIECE,
default="abc"];
optional string default_cord_extension = 85 [ctype=CORD, default="123"];
-
- // For oneof test
- optional uint32 oneof_uint32_extension = 111;
- optional TestAllTypes.NestedMessage oneof_nested_message_extension = 112;
- optional string oneof_string_extension = 113;
- optional bytes oneof_bytes_extension = 114;
}
message TestNestedExtension {
@@ -322,9 +278,6 @@ message TestNestedExtension {
// Check for bug where string extensions declared in tested scope did not
// compile.
optional string test = 1002 [default="test"];
- // Used to test if generated extension name is correct when there are
- // underscores.
- optional string nested_string_extension = 1003;
}
}
@@ -438,13 +391,6 @@ message TestDupFieldNumber { // NO_PROTO1
optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1
} // NO_PROTO1
-// Additional messages for testing lazy fields.
-message TestEagerMessage {
- optional TestAllTypes sub_message = 1 [lazy=false];
-}
-message TestLazyMessage {
- optional TestAllTypes sub_message = 1 [lazy=true];
-}
// Needed for a Python test.
message TestNestedMessageHasBits {
@@ -458,8 +404,6 @@ message TestNestedMessageHasBits {
// Test an enum that has multiple values with the same number.
enum TestEnumWithDupValue {
- option allow_alias = true;
-
FOO1 = 1;
BAR1 = 2;
BAZ = 3;
@@ -520,8 +464,6 @@ message TestExtremeDefaultValues {
optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF];
optional int32 small_int32 = 4 [default = -0x7FFFFFFF];
optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF];
- optional int32 really_small_int32 = 21 [default = -0x80000000];
- optional int64 really_small_int64 = 22 [default = -0x8000000000000000];
// The default value here is UTF-8 for "\u1234". (We could also just type
// the UTF-8 text directly into this text file rather than escape it, but
@@ -545,26 +487,6 @@ message TestExtremeDefaultValues {
optional float inf_float = 17 [default = inf];
optional float neg_inf_float = 18 [default = -inf];
optional float nan_float = 19 [default = nan];
-
- // Tests for C++ trigraphs.
- // Trigraphs should be escaped in C++ generated files, but they should not be
- // escaped for other languages.
- // Note that in .proto file, "\?" is a valid way to escape ? in string
- // literals.
- optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"];
-
- // String defaults containing the character '\000'
- optional string string_with_zero = 23 [default = "hel\000lo"];
- optional bytes bytes_with_zero = 24 [default = "wor\000ld"];
- optional string string_piece_with_zero = 25 [ctype=STRING_PIECE,
- default="ab\000c"];
- optional string cord_with_zero = 26 [ctype=CORD,
- default="12\0003"];
- optional string replacement_string = 27 [default="${unknown}"];
-}
-
-message SparseEnumMessage {
- optional TestSparseEnum sparse_enum = 1;
}
// Test String and Bytes: string is for valid UTF-8 strings
@@ -572,113 +494,10 @@ message OneString {
optional string data = 1;
}
-message MoreString {
- repeated string data = 1;
-}
-
message OneBytes {
optional bytes data = 1;
}
-message MoreBytes {
- repeated bytes data = 1;
-}
-
-// Test int32, uint32, int64, uint64, and bool are all compatible
-message Int32Message {
- optional int32 data = 1;
-}
-
-message Uint32Message {
- optional uint32 data = 1;
-}
-
-message Int64Message {
- optional int64 data = 1;
-}
-
-message Uint64Message {
- optional uint64 data = 1;
-}
-
-message BoolMessage {
- optional bool data = 1;
-}
-
-// Test oneofs.
-message TestOneof {
- oneof foo {
- int32 foo_int = 1;
- string foo_string = 2;
- TestAllTypes foo_message = 3;
- group FooGroup = 4 {
- optional int32 a = 5;
- optional string b = 6;
- }
- }
-}
-
-message TestOneofBackwardsCompatible {
- optional int32 foo_int = 1;
- optional string foo_string = 2;
- optional TestAllTypes foo_message = 3;
- optional group FooGroup = 4 {
- optional int32 a = 5;
- optional string b = 6;
- }
-}
-
-message TestOneof2 {
- oneof foo {
- int32 foo_int = 1;
- string foo_string = 2;
- string foo_cord = 3 [ctype=CORD];
- string foo_string_piece = 4 [ctype=STRING_PIECE];
- bytes foo_bytes = 5;
- NestedEnum foo_enum = 6;
- NestedMessage foo_message = 7;
- group FooGroup = 8 {
- optional int32 a = 9;
- optional string b = 10;
- }
- NestedMessage foo_lazy_message = 11 [lazy=true];
- }
-
- oneof bar {
- int32 bar_int = 12 [default = 5];
- string bar_string = 13 [default = "STRING"];
- string bar_cord = 14 [ctype=CORD, default = "CORD"];
- string bar_string_piece = 15 [ctype=STRING_PIECE, default = "SPIECE"];
- bytes bar_bytes = 16 [default = "BYTES"];
- NestedEnum bar_enum = 17 [default = BAR];
- }
-
- optional int32 baz_int = 18;
- optional string baz_string = 19 [default = "BAZ"];
-
- message NestedMessage {
- optional int64 qux_int = 1;
- repeated int32 corge_int = 2;
- }
-
- enum NestedEnum {
- FOO = 1;
- BAR = 2;
- BAZ = 3;
- }
-}
-
-message TestRequiredOneof {
- oneof foo {
- int32 foo_int = 1;
- string foo_string = 2;
- NestedMessage foo_message = 3;
- }
- message NestedMessage {
- required double required_double = 1;
- }
-}
-
// Test messages for packed fields
message TestPackedTypes {
@@ -738,27 +557,6 @@ extend TestPackedExtensions {
repeated ForeignEnum packed_enum_extension = 103 [packed = true];
}
-message TestUnpackedExtensions {
- extensions 1 to max;
-}
-
-extend TestUnpackedExtensions {
- repeated int32 unpacked_int32_extension = 90 [packed = false];
- repeated int64 unpacked_int64_extension = 91 [packed = false];
- repeated uint32 unpacked_uint32_extension = 92 [packed = false];
- repeated uint64 unpacked_uint64_extension = 93 [packed = false];
- repeated sint32 unpacked_sint32_extension = 94 [packed = false];
- repeated sint64 unpacked_sint64_extension = 95 [packed = false];
- repeated fixed32 unpacked_fixed32_extension = 96 [packed = false];
- repeated fixed64 unpacked_fixed64_extension = 97 [packed = false];
- repeated sfixed32 unpacked_sfixed32_extension = 98 [packed = false];
- repeated sfixed64 unpacked_sfixed64_extension = 99 [packed = false];
- repeated float unpacked_float_extension = 100 [packed = false];
- repeated double unpacked_double_extension = 101 [packed = false];
- repeated bool unpacked_bool_extension = 102 [packed = false];
- repeated ForeignEnum unpacked_enum_extension = 103 [packed = false];
-}
-
// Used by ExtensionSetTest/DynamicExtensions. The test actually builds
// a set of extensions to TestAllExtensions dynamically, based on the fields
// of this message type.
@@ -800,56 +598,10 @@ message TestRepeatedScalarDifferentTagSizes {
repeated uint64 repeated_uint64 = 262143;
}
-// Test that if an optional or required message/group field appears multiple
-// times in the input, they need to be merged.
-message TestParsingMerge {
- // RepeatedFieldsGenerator defines matching field types as TestParsingMerge,
- // except that all fields are repeated. In the tests, we will serialize the
- // RepeatedFieldsGenerator to bytes, and parse the bytes to TestParsingMerge.
- // Repeated fields in RepeatedFieldsGenerator are expected to be merged into
- // the corresponding required/optional fields in TestParsingMerge.
- message RepeatedFieldsGenerator {
- repeated TestAllTypes field1 = 1;
- repeated TestAllTypes field2 = 2;
- repeated TestAllTypes field3 = 3;
- repeated group Group1 = 10 {
- optional TestAllTypes field1 = 11;
- }
- repeated group Group2 = 20 {
- optional TestAllTypes field1 = 21;
- }
- repeated TestAllTypes ext1 = 1000;
- repeated TestAllTypes ext2 = 1001;
- }
- required TestAllTypes required_all_types = 1;
- optional TestAllTypes optional_all_types = 2;
- repeated TestAllTypes repeated_all_types = 3;
- optional group OptionalGroup = 10 {
- optional TestAllTypes optional_group_all_types = 11;
- }
- repeated group RepeatedGroup = 20 {
- optional TestAllTypes repeated_group_all_types = 21;
- }
- extensions 1000 to max;
- extend TestParsingMerge {
- optional TestAllTypes optional_ext = 1000;
- repeated TestAllTypes repeated_ext = 1001;
- }
-}
-
-message TestCommentInjectionMessage {
- // */ <- This should not close the generated doc comment
- optional string a = 1 [default="*/ <- Neither should this."];
-}
-
-
// Test that RPC services work.
message FooRequest {}
message FooResponse {}
-message FooClientMessage {}
-message FooServerMessage{}
-
service TestService {
rpc Foo(FooRequest) returns (FooResponse);
rpc Bar(BarRequest) returns (BarResponse);
@@ -858,4 +610,3 @@ service TestService {
message BarRequest {}
message BarResponse {}
-