Thomas Van Lenten | 3e0d399 | 2022-08-23 13:26:25 -0400 | [diff] [blame] | 1 | // Protocol Buffers - Google's data interchange format |
| 2 | // Copyright 2008 Google Inc. All rights reserved. |
Thomas Van Lenten | 3e0d399 | 2022-08-23 13:26:25 -0400 | [diff] [blame] | 3 | // |
Joshua Haberman | 200c958 | 2023-09-08 17:42:37 -0700 | [diff] [blame] | 4 | // 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 Lenten | 3e0d399 | 2022-08-23 13:26:25 -0400 | [diff] [blame] | 7 | |
| 8 | syntax = "proto2"; |
Thomas Van Lenten | 3e0d399 | 2022-08-23 13:26:25 -0400 | [diff] [blame] | 9 | |
Thomas Van Lenten | 28bc3ba | 2022-08-23 17:23:28 -0400 | [diff] [blame] | 10 | import "objectivec/Tests/unittest_import.proto"; |
Thomas Van Lenten | 3e0d399 | 2022-08-23 13:26:25 -0400 | [diff] [blame] | 11 | |
Thomas Van Lenten | bc9880b | 2022-08-23 14:05:47 -0400 | [diff] [blame] | 12 | package objc.protobuf.tests; |
Thomas Van Lenten | 3e0d399 | 2022-08-23 13:26:25 -0400 | [diff] [blame] | 13 | |
Thomas Van Lenten | 5cf61b7 | 2022-08-29 16:37:36 -0400 | [diff] [blame] | 14 | // Explicit empty prefix, tests some validations code paths also. |
| 15 | option objc_class_prefix = ""; |
| 16 | |
Thomas Van Lenten | 3e0d399 | 2022-08-23 13:26:25 -0400 | [diff] [blame] | 17 | enum Proto2MapEnum { |
| 18 | PROTO2_MAP_ENUM_FOO = 0; |
| 19 | PROTO2_MAP_ENUM_BAR = 1; |
| 20 | PROTO2_MAP_ENUM_BAZ = 2; |
| 21 | } |
| 22 | |
| 23 | enum 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 | |
| 30 | message TestEnumMap { |
| 31 | map<int32, Proto2MapEnum> known_map_field = 101; |
| 32 | map<int32, Proto2MapEnum> unknown_map_field = 102; |
| 33 | } |
| 34 | |
| 35 | message TestEnumMapPlusExtra { |
| 36 | map<int32, Proto2MapEnumPlusExtra> known_map_field = 101; |
| 37 | map<int32, Proto2MapEnumPlusExtra> unknown_map_field = 102; |
| 38 | } |
| 39 | |
| 40 | message TestImportEnumMap { |
Thomas Van Lenten | 5cf61b7 | 2022-08-29 16:37:36 -0400 | [diff] [blame] | 41 | map<int32, objc.protobuf.tests.import.EnumForMap> import_enum_amp = 1; |
Thomas Van Lenten | 3e0d399 | 2022-08-23 13:26:25 -0400 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | message TestIntIntMap { |
| 45 | map<int32, int32> m = 1; |
| 46 | } |
| 47 | |
| 48 | // Test all key types: string, plus the non-floating-point scalars. |
| 49 | message 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. |
| 65 | message TestSubmessageMaps { |
| 66 | optional TestMaps m = 1; |
| 67 | } |