1 // Copyright 2010, Google Inc.
2 // All rights reserved.
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
14 // * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 syntax = "proto2"; // for compatibility with internal Google compiler
32 package protobuf_unittest;
34 // dummy message to include in other messages.
36 optional int32 foo = 1;
48 // required vs. optional
49 required int64 o_a = 1;
50 optional int64 o_b = 2;
52 // all the types (non-repeated)
53 optional int32 u_int32 = 3;
54 optional int64 u_int64 = 4;
55 optional uint64 u_uint64 = 5;
56 optional fixed32 u_fixed32 = 6;
57 optional fixed64 u_fixed64 = 7;
58 optional bool u_bool = 8;
59 optional float u_float = 27;
60 optional double u_double = 28;
61 optional string u_string = 9;
62 optional string u_vardata = 10;
63 optional Test1Msg u_msg = 11;
65 // all the types (repeated)
66 repeated int32 r_int32 = 12;
67 repeated int64 r_int64 = 13;
68 repeated uint64 r_uint64 = 14;
69 repeated fixed32 r_fixed32 = 15;
70 repeated fixed64 r_fixed64 = 16;
71 repeated bool r_bool = 17;
72 repeated float r_float = 29;
73 repeated double r_double = 30;
74 repeated string r_string = 18;
75 repeated string r_vardata = 19;
76 repeated Test1Msg r_msg = 20;
79 repeated group TestGroup1 = 21 {
80 optional int32 a = 22;
84 repeated group TestGroup2 = 23 {
85 optional int32 b = 24;
89 optional int32 d_int32 = 25 [default=12];
90 optional string d_string = 26 [default="foo"];
91 optional bool d_bool = 31 [default=true];
92 optional int32 dd_int32 = 32 [ default = 12 ];
93 optional string dd_string = 33 [ default = " f oo " ];
94 optional bool dd_bool = 34 [ default = true ];