1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2015 Google Inc. All rights reserved. 3 // 4 // Redistribution and use in source and binary forms, with or without 5 // modification, are permitted provided that the following conditions are 6 // met: 7 // 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 13 // distribution. 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. 17 // 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. 29 30 syntax = "proto2"; 31 32 package protobuf_unittest; 33 34 message Message2 { 35 enum Enum { 36 FOO = 0; 37 BAR = 1; 38 BAZ = 2; 39 EXTRA_2 = 20; 40 } 41 42 optional int32 optional_int32 = 1; 43 optional int64 optional_int64 = 2; 44 optional uint32 optional_uint32 = 3; 45 optional uint64 optional_uint64 = 4; 46 optional sint32 optional_sint32 = 5; 47 optional sint64 optional_sint64 = 6; 48 optional fixed32 optional_fixed32 = 7; 49 optional fixed64 optional_fixed64 = 8; 50 optional sfixed32 optional_sfixed32 = 9; 51 optional sfixed64 optional_sfixed64 = 10; 52 optional float optional_float = 11; 53 optional double optional_double = 12; 54 optional bool optional_bool = 13; 55 optional string optional_string = 14; 56 optional bytes optional_bytes = 15; 57 optional group OptionalGroup = 16 { 58 optional int32 a = 17; 59 } 60 optional Message2 optional_message = 18; 61 optional Enum optional_enum = 19; 62 63 repeated int32 repeated_int32 = 31; 64 repeated int64 repeated_int64 = 32; 65 repeated uint32 repeated_uint32 = 33; 66 repeated uint64 repeated_uint64 = 34; 67 repeated sint32 repeated_sint32 = 35; 68 repeated sint64 repeated_sint64 = 36; 69 repeated fixed32 repeated_fixed32 = 37; 70 repeated fixed64 repeated_fixed64 = 38; 71 repeated sfixed32 repeated_sfixed32 = 39; 72 repeated sfixed64 repeated_sfixed64 = 40; 73 repeated float repeated_float = 41; 74 repeated double repeated_double = 42; 75 repeated bool repeated_bool = 43; 76 repeated string repeated_string = 44; 77 repeated bytes repeated_bytes = 45; 78 repeated group RepeatedGroup = 46 { 79 optional int32 a = 47; 80 } 81 repeated Message2 repeated_message = 48; 82 repeated Enum repeated_enum = 49; 83 84 oneof o { 85 int32 oneof_int32 = 51 [default = 100]; 86 int64 oneof_int64 = 52 [default = 101]; 87 uint32 oneof_uint32 = 53 [default = 102]; 88 uint64 oneof_uint64 = 54 [default = 103]; 89 sint32 oneof_sint32 = 55 [default = 104]; 90 sint64 oneof_sint64 = 56 [default = 105]; 91 fixed32 oneof_fixed32 = 57 [default = 106]; 92 fixed64 oneof_fixed64 = 58 [default = 107]; 93 sfixed32 oneof_sfixed32 = 59 [default = 108]; 94 sfixed64 oneof_sfixed64 = 60 [default = 109]; 95 float oneof_float = 61 [default = 110]; 96 double oneof_double = 62 [default = 111]; 97 bool oneof_bool = 63 [default = true]; 98 string oneof_string = 64 [default = "string"]; 99 bytes oneof_bytes = 65 [default = "data"]; 100 group OneofGroup = 66 { 101 optional int32 a = 67; 102 optional int32 b = 167; 103 } 104 Message2 oneof_message = 68; 105 Enum oneof_enum = 69 [default = BAZ]; 106 } 107 108 // Some token map cases, too many combinations to list them all. 109 map<int32 , int32 > map_int32_int32 = 70; 110 map<int64 , int64 > map_int64_int64 = 71; 111 map<uint32 , uint32 > map_uint32_uint32 = 72; 112 map<uint64 , uint64 > map_uint64_uint64 = 73; 113 map<sint32 , sint32 > map_sint32_sint32 = 74; 114 map<sint64 , sint64 > map_sint64_sint64 = 75; 115 map<fixed32 , fixed32 > map_fixed32_fixed32 = 76; 116 map<fixed64 , fixed64 > map_fixed64_fixed64 = 77; 117 map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 78; 118 map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 79; 119 map<int32 , float > map_int32_float = 80; 120 map<int32 , double > map_int32_double = 81; 121 map<bool , bool > map_bool_bool = 82; 122 map<string , string > map_string_string = 83; 123 map<string , bytes > map_string_bytes = 84; 124 map<string , Message2> map_string_message = 85; 125 map<int32 , bytes > map_int32_bytes = 86; 126 map<int32 , Enum > map_int32_enum = 87; 127 map<int32 , Message2> map_int32_message = 88; 128 } 129