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 30syntax = "proto3"; 31 32package protobuf_unittest; 33 34message Message3 { 35 enum Enum { 36 FOO = 0; 37 BAR = 1; 38 BAZ = 2; 39 EXTRA_3 = 30; 40 } 41 42 int32 optional_int32 = 1; 43 int64 optional_int64 = 2; 44 uint32 optional_uint32 = 3; 45 uint64 optional_uint64 = 4; 46 sint32 optional_sint32 = 5; 47 sint64 optional_sint64 = 6; 48 fixed32 optional_fixed32 = 7; 49 fixed64 optional_fixed64 = 8; 50 sfixed32 optional_sfixed32 = 9; 51 sfixed64 optional_sfixed64 = 10; 52 float optional_float = 11; 53 double optional_double = 12; 54 bool optional_bool = 13; 55 string optional_string = 14; 56 bytes optional_bytes = 15; 57 // No 'group' in proto3. 58 Message3 optional_message = 18; 59 Enum optional_enum = 19; 60 61 repeated int32 repeated_int32 = 31; 62 repeated int64 repeated_int64 = 32; 63 repeated uint32 repeated_uint32 = 33; 64 repeated uint64 repeated_uint64 = 34; 65 repeated sint32 repeated_sint32 = 35; 66 repeated sint64 repeated_sint64 = 36; 67 repeated fixed32 repeated_fixed32 = 37; 68 repeated fixed64 repeated_fixed64 = 38; 69 repeated sfixed32 repeated_sfixed32 = 39; 70 repeated sfixed64 repeated_sfixed64 = 40; 71 repeated float repeated_float = 41; 72 repeated double repeated_double = 42; 73 repeated bool repeated_bool = 43; 74 repeated string repeated_string = 44; 75 repeated bytes repeated_bytes = 45; 76 // No 'group' in proto3. 77 repeated Message3 repeated_message = 48; 78 repeated Enum repeated_enum = 49; 79 80 oneof o { 81 int32 oneof_int32 = 51; 82 int64 oneof_int64 = 52; 83 uint32 oneof_uint32 = 53; 84 uint64 oneof_uint64 = 54; 85 sint32 oneof_sint32 = 55; 86 sint64 oneof_sint64 = 56; 87 fixed32 oneof_fixed32 = 57; 88 fixed64 oneof_fixed64 = 58; 89 sfixed32 oneof_sfixed32 = 59; 90 sfixed64 oneof_sfixed64 = 60; 91 float oneof_float = 61; 92 double oneof_double = 62; 93 bool oneof_bool = 63; 94 string oneof_string = 64; 95 bytes oneof_bytes = 65; 96 // No 'group' in proto3. 97 Message3 oneof_message = 68; 98 Enum oneof_enum = 69; 99 } 100 101 // Some token map cases, too many combinations to list them all. 102 map<int32 , int32 > map_int32_int32 = 70; 103 map<int64 , int64 > map_int64_int64 = 71; 104 map<uint32 , uint32 > map_uint32_uint32 = 72; 105 map<uint64 , uint64 > map_uint64_uint64 = 73; 106 map<sint32 , sint32 > map_sint32_sint32 = 74; 107 map<sint64 , sint64 > map_sint64_sint64 = 75; 108 map<fixed32 , fixed32 > map_fixed32_fixed32 = 76; 109 map<fixed64 , fixed64 > map_fixed64_fixed64 = 77; 110 map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 78; 111 map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 79; 112 map<int32 , float > map_int32_float = 80; 113 map<int32 , double > map_int32_double = 81; 114 map<bool , bool > map_bool_bool = 82; 115 map<string , string > map_string_string = 83; 116 map<string , bytes > map_string_bytes = 84; 117 map<string , Message3> map_string_message = 85; 118 map<int32 , bytes > map_int32_bytes = 86; 119 map<int32 , Enum > map_int32_enum = 87; 120 map<int32 , Message3> map_int32_message = 88; 121} 122 123message Message3Optional { 124 enum Enum { 125 FOO = 0; 126 BAR = 1; 127 BAZ = 2; 128 EXTRA_3 = 30; 129 } 130 131 optional int32 optional_int32 = 1; 132 optional int64 optional_int64 = 2; 133 optional uint32 optional_uint32 = 3; 134 optional uint64 optional_uint64 = 4; 135 optional sint32 optional_sint32 = 5; 136 optional sint64 optional_sint64 = 6; 137 optional fixed32 optional_fixed32 = 7; 138 optional fixed64 optional_fixed64 = 8; 139 optional sfixed32 optional_sfixed32 = 9; 140 optional sfixed64 optional_sfixed64 = 10; 141 optional float optional_float = 11; 142 optional double optional_double = 12; 143 optional bool optional_bool = 13; 144 optional string optional_string = 14; 145 optional bytes optional_bytes = 15; 146 // No 'group' in proto3. 147 optional Message3 optional_message = 18; 148 optional Enum optional_enum = 19; 149} 150