Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/protobuf/conformance/conformance.proto

Issue 1322483002: Revert https://codereview.chromium.org/1291903002 (protobuf roll). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
30
31 syntax = "proto3";
32 package conformance;
33 option java_package = "com.google.protobuf.conformance";
34
35 // This defines the conformance testing protocol. This protocol exists between
36 // the conformance test suite itself and the code being tested. For each test,
37 // the suite will send a ConformanceRequest message and expect a
38 // ConformanceResponse message.
39 //
40 // You can either run the tests in two different ways:
41 //
42 // 1. in-process (using the interface in conformance_test.h).
43 //
44 // 2. as a sub-process communicating over a pipe. Information about how to
45 // do this is in conformance_test_runner.cc.
46 //
47 // Pros/cons of the two approaches:
48 //
49 // - running as a sub-process is much simpler for languages other than C/C++.
50 //
51 // - running as a sub-process may be more tricky in unusual environments like
52 // iOS apps, where fork/stdin/stdout are not available.
53
54 enum WireFormat {
55 UNSPECIFIED = 0;
56 PROTOBUF = 1;
57 JSON = 2;
58 }
59
60 // Represents a single test case's input. The testee should:
61 //
62 // 1. parse this proto (which should always succeed)
63 // 2. parse the protobuf or JSON payload in "payload" (which may fail)
64 // 3. if the parse succeeded, serialize the message in the requested format.
65 message ConformanceRequest {
66 // The payload (whether protobuf of JSON) is always for a TestAllTypes proto
67 // (see below).
68 oneof payload {
69 bytes protobuf_payload = 1;
70 string json_payload = 2;
71 }
72
73 // Which format should the testee serialize its message to?
74 WireFormat requested_output_format = 3;
75 }
76
77 // Represents a single test case's output.
78 message ConformanceResponse {
79 oneof result {
80 // This string should be set to indicate parsing failed. The string can
81 // provide more information about the parse error if it is available.
82 //
83 // Setting this string does not necessarily mean the testee failed the
84 // test. Some of the test cases are intentionally invalid input.
85 string parse_error = 1;
86
87 // This should be set if some other error occurred. This will always
88 // indicate that the test failed. The string can provide more information
89 // about the failure.
90 string runtime_error = 2;
91
92 // If the input was successfully parsed and the requested output was
93 // protobuf, serialize it to protobuf and set it in this field.
94 bytes protobuf_payload = 3;
95
96 // If the input was successfully parsed and the requested output was JSON,
97 // serialize to JSON and set it in this field.
98 string json_payload = 4;
99
100 // For when the testee skipped the test, likely because a certain feature
101 // wasn't supported, like JSON input/output.
102 string skipped = 5;
103 }
104 }
105
106 // This proto includes every type of field in both singular and repeated
107 // forms.
108 message TestAllTypes {
109 message NestedMessage {
110 int32 a = 1;
111 TestAllTypes corecursive = 2;
112 }
113
114 enum NestedEnum {
115 FOO = 0;
116 BAR = 1;
117 BAZ = 2;
118 NEG = -1; // Intentionally negative.
119 }
120
121 // Singular
122 int32 optional_int32 = 1;
123 int64 optional_int64 = 2;
124 uint32 optional_uint32 = 3;
125 uint64 optional_uint64 = 4;
126 sint32 optional_sint32 = 5;
127 sint64 optional_sint64 = 6;
128 fixed32 optional_fixed32 = 7;
129 fixed64 optional_fixed64 = 8;
130 sfixed32 optional_sfixed32 = 9;
131 sfixed64 optional_sfixed64 = 10;
132 float optional_float = 11;
133 double optional_double = 12;
134 bool optional_bool = 13;
135 string optional_string = 14;
136 bytes optional_bytes = 15;
137
138 NestedMessage optional_nested_message = 18;
139 ForeignMessage optional_foreign_message = 19;
140
141 NestedEnum optional_nested_enum = 21;
142 ForeignEnum optional_foreign_enum = 22;
143
144 string optional_string_piece = 24 [ctype=STRING_PIECE];
145 string optional_cord = 25 [ctype=CORD];
146
147 TestAllTypes recursive_message = 27;
148
149 // Repeated
150 repeated int32 repeated_int32 = 31;
151 repeated int64 repeated_int64 = 32;
152 repeated uint32 repeated_uint32 = 33;
153 repeated uint64 repeated_uint64 = 34;
154 repeated sint32 repeated_sint32 = 35;
155 repeated sint64 repeated_sint64 = 36;
156 repeated fixed32 repeated_fixed32 = 37;
157 repeated fixed64 repeated_fixed64 = 38;
158 repeated sfixed32 repeated_sfixed32 = 39;
159 repeated sfixed64 repeated_sfixed64 = 40;
160 repeated float repeated_float = 41;
161 repeated double repeated_double = 42;
162 repeated bool repeated_bool = 43;
163 repeated string repeated_string = 44;
164 repeated bytes repeated_bytes = 45;
165
166 repeated NestedMessage repeated_nested_message = 48;
167 repeated ForeignMessage repeated_foreign_message = 49;
168
169 repeated NestedEnum repeated_nested_enum = 51;
170 repeated ForeignEnum repeated_foreign_enum = 52;
171
172 repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
173 repeated string repeated_cord = 55 [ctype=CORD];
174
175 // Map
176 map < int32, int32> map_int32_int32 = 56;
177 map < int64, int64> map_int64_int64 = 57;
178 map < uint32, uint32> map_uint32_uint32 = 58;
179 map < uint64, uint64> map_uint64_uint64 = 59;
180 map < sint32, sint32> map_sint32_sint32 = 60;
181 map < sint64, sint64> map_sint64_sint64 = 61;
182 map < fixed32, fixed32> map_fixed32_fixed32 = 62;
183 map < fixed64, fixed64> map_fixed64_fixed64 = 63;
184 map <sfixed32, sfixed32> map_sfixed32_sfixed32 = 64;
185 map <sfixed64, sfixed64> map_sfixed64_sfixed64 = 65;
186 map < int32, float> map_int32_float = 66;
187 map < int32, double> map_int32_double = 67;
188 map < bool, bool> map_bool_bool = 68;
189 map < string, string> map_string_string = 69;
190 map < string, bytes> map_string_bytes = 70;
191 map < string, NestedMessage> map_string_nested_message = 71;
192 map < string, ForeignMessage> map_string_foreign_message = 72;
193 map < string, NestedEnum> map_string_nested_enum = 73;
194 map < string, ForeignEnum> map_string_foreign_enum = 74;
195
196 oneof oneof_field {
197 uint32 oneof_uint32 = 111;
198 NestedMessage oneof_nested_message = 112;
199 string oneof_string = 113;
200 bytes oneof_bytes = 114;
201 }
202 }
203
204 message ForeignMessage {
205 int32 c = 1;
206 }
207
208 enum ForeignEnum {
209 FOREIGN_FOO = 0;
210 FOREIGN_BAR = 1;
211 FOREIGN_BAZ = 2;
212 }
OLDNEW
« no previous file with comments | « third_party/protobuf/conformance/README.md ('k') | third_party/protobuf/conformance/conformance_cpp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698