blob: a4b7fe92d594c0d4d4553b007e8d7706f46c230a [file] [log] [blame]
Thomas Van Lenten3e0d3992022-08-23 13:26:25 -04001// Protocol Buffers - Google's data interchange format
2// Copyright 2008 Google Inc. All rights reserved.
Thomas Van Lenten3e0d3992022-08-23 13:26:25 -04003//
Joshua Haberman200c9582023-09-08 17:42:37 -07004// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file or at
6// https://developers.google.com/open-source/licenses/bsd
Thomas Van Lenten3e0d3992022-08-23 13:26:25 -04007
8syntax = "proto2";
Thomas Van Lenten3e0d3992022-08-23 13:26:25 -04009
Thomas Van Lenten28bc3ba2022-08-23 17:23:28 -040010import "objectivec/Tests/unittest_import.proto";
Thomas Van Lenten3e0d3992022-08-23 13:26:25 -040011
Thomas Van Lentenbc9880b2022-08-23 14:05:47 -040012package objc.protobuf.tests;
Thomas Van Lenten3e0d3992022-08-23 13:26:25 -040013
Thomas Van Lenten5cf61b72022-08-29 16:37:36 -040014// Explicit empty prefix, tests some validations code paths also.
15option objc_class_prefix = "";
16
Thomas Van Lenten3e0d3992022-08-23 13:26:25 -040017enum Proto2MapEnum {
18 PROTO2_MAP_ENUM_FOO = 0;
19 PROTO2_MAP_ENUM_BAR = 1;
20 PROTO2_MAP_ENUM_BAZ = 2;
21}
22
23enum Proto2MapEnumPlusExtra {
24 E_PROTO2_MAP_ENUM_FOO = 0;
25 E_PROTO2_MAP_ENUM_BAR = 1;
26 E_PROTO2_MAP_ENUM_BAZ = 2;
27 E_PROTO2_MAP_ENUM_EXTRA = 3;
28}
29
30message TestEnumMap {
31 map<int32, Proto2MapEnum> known_map_field = 101;
32 map<int32, Proto2MapEnum> unknown_map_field = 102;
33}
34
35message TestEnumMapPlusExtra {
36 map<int32, Proto2MapEnumPlusExtra> known_map_field = 101;
37 map<int32, Proto2MapEnumPlusExtra> unknown_map_field = 102;
38}
39
40message TestImportEnumMap {
Thomas Van Lenten5cf61b72022-08-29 16:37:36 -040041 map<int32, objc.protobuf.tests.import.EnumForMap> import_enum_amp = 1;
Thomas Van Lenten3e0d3992022-08-23 13:26:25 -040042}
43
44message TestIntIntMap {
45 map<int32, int32> m = 1;
46}
47
48// Test all key types: string, plus the non-floating-point scalars.
49message TestMaps {
50 map<int32, TestIntIntMap> m_int32 = 1;
51 map<int64, TestIntIntMap> m_int64 = 2;
52 map<uint32, TestIntIntMap> m_uint32 = 3;
53 map<uint64, TestIntIntMap> m_uint64 = 4;
54 map<sint32, TestIntIntMap> m_sint32 = 5;
55 map<sint64, TestIntIntMap> m_sint64 = 6;
56 map<fixed32, TestIntIntMap> m_fixed32 = 7;
57 map<fixed64, TestIntIntMap> m_fixed64 = 8;
58 map<sfixed32, TestIntIntMap> m_sfixed32 = 9;
59 map<sfixed64, TestIntIntMap> m_sfixed64 = 10;
60 map<bool, TestIntIntMap> m_bool = 11;
61 map<string, TestIntIntMap> m_string = 12;
62}
63
64// Test maps in submessages.
65message TestSubmessageMaps {
66 optional TestMaps m = 1;
67}