1*1b3f573fSAndroid Build Coastguard Worker// Protocol Buffers - Google's data interchange format 2*1b3f573fSAndroid Build Coastguard Worker// Copyright 2008 Google Inc. All rights reserved. 3*1b3f573fSAndroid Build Coastguard Worker// https://developers.google.com/protocol-buffers/ 4*1b3f573fSAndroid Build Coastguard Worker// 5*1b3f573fSAndroid Build Coastguard Worker// Redistribution and use in source and binary forms, with or without 6*1b3f573fSAndroid Build Coastguard Worker// modification, are permitted provided that the following conditions are 7*1b3f573fSAndroid Build Coastguard Worker// met: 8*1b3f573fSAndroid Build Coastguard Worker// 9*1b3f573fSAndroid Build Coastguard Worker// * Redistributions of source code must retain the above copyright 10*1b3f573fSAndroid Build Coastguard Worker// notice, this list of conditions and the following disclaimer. 11*1b3f573fSAndroid Build Coastguard Worker// * Redistributions in binary form must reproduce the above 12*1b3f573fSAndroid Build Coastguard Worker// copyright notice, this list of conditions and the following disclaimer 13*1b3f573fSAndroid Build Coastguard Worker// in the documentation and/or other materials provided with the 14*1b3f573fSAndroid Build Coastguard Worker// distribution. 15*1b3f573fSAndroid Build Coastguard Worker// * Neither the name of Google Inc. nor the names of its 16*1b3f573fSAndroid Build Coastguard Worker// contributors may be used to endorse or promote products derived from 17*1b3f573fSAndroid Build Coastguard Worker// this software without specific prior written permission. 18*1b3f573fSAndroid Build Coastguard Worker// 19*1b3f573fSAndroid Build Coastguard Worker// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20*1b3f573fSAndroid Build Coastguard Worker// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21*1b3f573fSAndroid Build Coastguard Worker// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22*1b3f573fSAndroid Build Coastguard Worker// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23*1b3f573fSAndroid Build Coastguard Worker// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24*1b3f573fSAndroid Build Coastguard Worker// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25*1b3f573fSAndroid Build Coastguard Worker// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26*1b3f573fSAndroid Build Coastguard Worker// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27*1b3f573fSAndroid Build Coastguard Worker// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28*1b3f573fSAndroid Build Coastguard Worker// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29*1b3f573fSAndroid Build Coastguard Worker// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30*1b3f573fSAndroid Build Coastguard Worker 31*1b3f573fSAndroid Build Coastguard Worker// This file is mostly equivalent to map_unittest.proto, but imports 32*1b3f573fSAndroid Build Coastguard Worker// unittest_proto3.proto instead of unittest.proto, so that it only 33*1b3f573fSAndroid Build Coastguard Worker// uses proto3 messages. This makes it suitable for testing 34*1b3f573fSAndroid Build Coastguard Worker// implementations which only support proto3. 35*1b3f573fSAndroid Build Coastguard Worker// The TestRequiredMessageMap message has been removed as there are no 36*1b3f573fSAndroid Build Coastguard Worker// required fields in proto3. 37*1b3f573fSAndroid Build Coastguard Workersyntax = "proto3"; 38*1b3f573fSAndroid Build Coastguard Worker 39*1b3f573fSAndroid Build Coastguard Workeroption csharp_namespace = "Google.Protobuf.TestProtos"; 40*1b3f573fSAndroid Build Coastguard Worker 41*1b3f573fSAndroid Build Coastguard Workerimport "unittest_proto3.proto"; 42*1b3f573fSAndroid Build Coastguard Worker 43*1b3f573fSAndroid Build Coastguard Workerpackage protobuf_unittest3; 44*1b3f573fSAndroid Build Coastguard Worker 45*1b3f573fSAndroid Build Coastguard Worker// Tests maps. 46*1b3f573fSAndroid Build Coastguard Workermessage TestMap { 47*1b3f573fSAndroid Build Coastguard Worker map<int32 , int32 > map_int32_int32 = 1; 48*1b3f573fSAndroid Build Coastguard Worker map<int64 , int64 > map_int64_int64 = 2; 49*1b3f573fSAndroid Build Coastguard Worker map<uint32 , uint32 > map_uint32_uint32 = 3; 50*1b3f573fSAndroid Build Coastguard Worker map<uint64 , uint64 > map_uint64_uint64 = 4; 51*1b3f573fSAndroid Build Coastguard Worker map<sint32 , sint32 > map_sint32_sint32 = 5; 52*1b3f573fSAndroid Build Coastguard Worker map<sint64 , sint64 > map_sint64_sint64 = 6; 53*1b3f573fSAndroid Build Coastguard Worker map<fixed32 , fixed32 > map_fixed32_fixed32 = 7; 54*1b3f573fSAndroid Build Coastguard Worker map<fixed64 , fixed64 > map_fixed64_fixed64 = 8; 55*1b3f573fSAndroid Build Coastguard Worker map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9; 56*1b3f573fSAndroid Build Coastguard Worker map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10; 57*1b3f573fSAndroid Build Coastguard Worker map<int32 , float > map_int32_float = 11; 58*1b3f573fSAndroid Build Coastguard Worker map<int32 , double > map_int32_double = 12; 59*1b3f573fSAndroid Build Coastguard Worker map<bool , bool > map_bool_bool = 13; 60*1b3f573fSAndroid Build Coastguard Worker map<string , string > map_string_string = 14; 61*1b3f573fSAndroid Build Coastguard Worker map<int32 , bytes > map_int32_bytes = 15; 62*1b3f573fSAndroid Build Coastguard Worker map<int32 , MapEnum > map_int32_enum = 16; 63*1b3f573fSAndroid Build Coastguard Worker map<int32 , ForeignMessage> map_int32_foreign_message = 17; 64*1b3f573fSAndroid Build Coastguard Worker} 65*1b3f573fSAndroid Build Coastguard Worker 66*1b3f573fSAndroid Build Coastguard Workermessage TestMapSubmessage { 67*1b3f573fSAndroid Build Coastguard Worker TestMap test_map = 1; 68*1b3f573fSAndroid Build Coastguard Worker} 69*1b3f573fSAndroid Build Coastguard Worker 70*1b3f573fSAndroid Build Coastguard Workermessage TestMessageMap { 71*1b3f573fSAndroid Build Coastguard Worker map<int32, TestAllTypes> map_int32_message = 1; 72*1b3f573fSAndroid Build Coastguard Worker} 73*1b3f573fSAndroid Build Coastguard Worker 74*1b3f573fSAndroid Build Coastguard Worker// Two map fields share the same entry default instance. 75*1b3f573fSAndroid Build Coastguard Workermessage TestSameTypeMap { 76*1b3f573fSAndroid Build Coastguard Worker map<int32, int32> map1 = 1; 77*1b3f573fSAndroid Build Coastguard Worker map<int32, int32> map2 = 2; 78*1b3f573fSAndroid Build Coastguard Worker} 79*1b3f573fSAndroid Build Coastguard Worker 80*1b3f573fSAndroid Build Coastguard Workerenum MapEnum { 81*1b3f573fSAndroid Build Coastguard Worker MAP_ENUM_FOO = 0; 82*1b3f573fSAndroid Build Coastguard Worker MAP_ENUM_BAR = 1; 83*1b3f573fSAndroid Build Coastguard Worker MAP_ENUM_BAZ = 2; 84*1b3f573fSAndroid Build Coastguard Worker} 85*1b3f573fSAndroid Build Coastguard Worker 86*1b3f573fSAndroid Build Coastguard Workermessage TestArenaMap { 87*1b3f573fSAndroid Build Coastguard Worker map<int32 , int32 > map_int32_int32 = 1; 88*1b3f573fSAndroid Build Coastguard Worker map<int64 , int64 > map_int64_int64 = 2; 89*1b3f573fSAndroid Build Coastguard Worker map<uint32 , uint32 > map_uint32_uint32 = 3; 90*1b3f573fSAndroid Build Coastguard Worker map<uint64 , uint64 > map_uint64_uint64 = 4; 91*1b3f573fSAndroid Build Coastguard Worker map<sint32 , sint32 > map_sint32_sint32 = 5; 92*1b3f573fSAndroid Build Coastguard Worker map<sint64 , sint64 > map_sint64_sint64 = 6; 93*1b3f573fSAndroid Build Coastguard Worker map<fixed32 , fixed32 > map_fixed32_fixed32 = 7; 94*1b3f573fSAndroid Build Coastguard Worker map<fixed64 , fixed64 > map_fixed64_fixed64 = 8; 95*1b3f573fSAndroid Build Coastguard Worker map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9; 96*1b3f573fSAndroid Build Coastguard Worker map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10; 97*1b3f573fSAndroid Build Coastguard Worker map<int32 , float > map_int32_float = 11; 98*1b3f573fSAndroid Build Coastguard Worker map<int32 , double > map_int32_double = 12; 99*1b3f573fSAndroid Build Coastguard Worker map<bool , bool > map_bool_bool = 13; 100*1b3f573fSAndroid Build Coastguard Worker map<int32 , MapEnum > map_int32_enum = 14; 101*1b3f573fSAndroid Build Coastguard Worker map<int32 , ForeignMessage> map_int32_foreign_message = 15; 102*1b3f573fSAndroid Build Coastguard Worker} 103*1b3f573fSAndroid Build Coastguard Worker 104*1b3f573fSAndroid Build Coastguard Worker// Previously, message containing enum called Type cannot be used as value of 105*1b3f573fSAndroid Build Coastguard Worker// map field. 106*1b3f573fSAndroid Build Coastguard Workermessage MessageContainingEnumCalledType { 107*1b3f573fSAndroid Build Coastguard Worker enum Type { 108*1b3f573fSAndroid Build Coastguard Worker TYPE_FOO = 0; 109*1b3f573fSAndroid Build Coastguard Worker } 110*1b3f573fSAndroid Build Coastguard Worker map<int32, MessageContainingEnumCalledType> type = 1; 111*1b3f573fSAndroid Build Coastguard Worker} 112*1b3f573fSAndroid Build Coastguard Worker 113*1b3f573fSAndroid Build Coastguard Worker// Previously, message cannot contain map field called "entry". 114*1b3f573fSAndroid Build Coastguard Workermessage MessageContainingMapCalledEntry { 115*1b3f573fSAndroid Build Coastguard Worker map<int32, int32> entry = 1; 116*1b3f573fSAndroid Build Coastguard Worker} 117