map_lite_unittest.proto 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2008 Google Inc. All rights reserved.
  3. //
  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
  7. edition = "2023";
  8. package protobuf_unittest;
  9. import "google/protobuf/unittest_lite.proto";
  10. option features.enum_type = CLOSED;
  11. option features.utf8_validation = NONE;
  12. option cc_enable_arenas = true;
  13. option optimize_for = LITE_RUNTIME;
  14. message TestMapLite {
  15. map<int32, int32> map_int32_int32 = 1;
  16. map<int64, int64> map_int64_int64 = 2;
  17. map<uint32, uint32> map_uint32_uint32 = 3;
  18. map<uint64, uint64> map_uint64_uint64 = 4;
  19. map<sint32, sint32> map_sint32_sint32 = 5;
  20. map<sint64, sint64> map_sint64_sint64 = 6;
  21. map<fixed32, fixed32> map_fixed32_fixed32 = 7;
  22. map<fixed64, fixed64> map_fixed64_fixed64 = 8;
  23. map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
  24. map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
  25. map<int32, float> map_int32_float = 11;
  26. map<int32, double> map_int32_double = 12;
  27. map<bool, bool> map_bool_bool = 13;
  28. map<string, string> map_string_string = 14;
  29. map<int32, bytes> map_int32_bytes = 15;
  30. map<int32, MapEnumLite> map_int32_enum = 16;
  31. map<int32, ForeignMessageLite> map_int32_foreign_message = 17;
  32. map<int32, int32> teboring = 18;
  33. }
  34. message TestArenaMapLite {
  35. map<int32, int32> map_int32_int32 = 1;
  36. map<int64, int64> map_int64_int64 = 2;
  37. map<uint32, uint32> map_uint32_uint32 = 3;
  38. map<uint64, uint64> map_uint64_uint64 = 4;
  39. map<sint32, sint32> map_sint32_sint32 = 5;
  40. map<sint64, sint64> map_sint64_sint64 = 6;
  41. map<fixed32, fixed32> map_fixed32_fixed32 = 7;
  42. map<fixed64, fixed64> map_fixed64_fixed64 = 8;
  43. map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
  44. map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
  45. map<int32, float> map_int32_float = 11;
  46. map<int32, double> map_int32_double = 12;
  47. map<bool, bool> map_bool_bool = 13;
  48. map<string, string> map_string_string = 14;
  49. map<int32, bytes> map_int32_bytes = 15;
  50. map<int32, MapEnumLite> map_int32_enum = 16;
  51. map<int32, ForeignMessageArenaLite> map_int32_foreign_message = 17;
  52. }
  53. // Test embedded message with required fields
  54. message TestRequiredMessageMapLite {
  55. map<int32, TestRequiredLite> map_field = 1;
  56. }
  57. message TestEnumMapLite {
  58. map<int32, Proto2MapEnumLite> known_map_field = 101;
  59. map<int32, Proto2MapEnumLite> unknown_map_field = 102;
  60. }
  61. message TestEnumMapPlusExtraLite {
  62. map<int32, Proto2MapEnumPlusExtraLite> known_map_field = 101;
  63. map<int32, Proto2MapEnumPlusExtraLite> unknown_map_field = 102;
  64. }
  65. message TestMessageMapLite {
  66. map<int32, TestAllTypesLite> map_int32_message = 1;
  67. }
  68. enum Proto2MapEnumLite {
  69. PROTO2_MAP_ENUM_FOO_LITE = 0;
  70. PROTO2_MAP_ENUM_BAR_LITE = 1;
  71. PROTO2_MAP_ENUM_BAZ_LITE = 2;
  72. }
  73. enum Proto2MapEnumPlusExtraLite {
  74. E_PROTO2_MAP_ENUM_FOO_LITE = 0;
  75. E_PROTO2_MAP_ENUM_BAR_LITE = 1;
  76. E_PROTO2_MAP_ENUM_BAZ_LITE = 2;
  77. E_PROTO2_MAP_ENUM_EXTRA_LITE = 3;
  78. }
  79. enum MapEnumLite {
  80. MAP_ENUM_FOO_LITE = 0;
  81. MAP_ENUM_BAR_LITE = 1;
  82. MAP_ENUM_BAZ_LITE = 2;
  83. }
  84. message TestRequiredLite {
  85. int32 a = 1 [features.field_presence = LEGACY_REQUIRED];
  86. int32 b = 2 [features.field_presence = LEGACY_REQUIRED];
  87. int32 c = 3 [features.field_presence = LEGACY_REQUIRED];
  88. extend TestAllExtensionsLite {
  89. TestRequiredLite single = 1000;
  90. }
  91. }
  92. message ForeignMessageArenaLite {
  93. int32 c = 1;
  94. }