map_field_test.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #include <map>
32 #include <memory>
33 #include <unordered_map>
34 
39 #include <google/protobuf/map_unittest.pb.h>
40 #include <google/protobuf/unittest.pb.h>
41 #include <google/protobuf/arena.h>
42 #include <google/protobuf/map.h>
46 #include <gtest/gtest.h>
47 
48 namespace google {
49 namespace protobuf {
50 
51 namespace internal {
52 
53 using unittest::TestAllTypes;
54 
56  public:
58  typedef void DestructorSkippable_;
60  explicit MapFieldBaseStub(Arena* arena) : MapFieldBase(arena) {}
61  // Get underlined repeated field without synchronizing map.
63  bool IsMapClean() {
64  return state_.load(std::memory_order_relaxed) != STATE_MODIFIED_MAP;
65  }
66  bool IsRepeatedClean() {
67  return state_.load(std::memory_order_relaxed) != STATE_MODIFIED_REPEATED;
68  }
69  void SetMapDirty() {
70  state_.store(STATE_MODIFIED_MAP, std::memory_order_relaxed);
71  }
73  state_.store(STATE_MODIFIED_REPEATED, std::memory_order_relaxed);
74  }
75  bool ContainsMapKey(const MapKey& map_key) const override { return false; }
76  bool InsertOrLookupMapValue(const MapKey& map_key,
77  MapValueRef* val) override {
78  return false;
79  }
80  bool DeleteMapValue(const MapKey& map_key) override { return false; }
82  const MapIterator& b) const override {
83  return false;
84  }
85  int size() const override { return 0; }
86  void Clear() override {}
87  void MapBegin(MapIterator* map_iter) const override {}
88  void MapEnd(MapIterator* map_iter) const override {}
89  void MergeFrom(const MapFieldBase& other) override {}
90  void Swap(MapFieldBase* other) override {}
91  void InitializeIterator(MapIterator* map_iter) const override {}
92  void DeleteIterator(MapIterator* map_iter) const override {}
93  void CopyIterator(MapIterator* this_iterator,
94  const MapIterator& other_iterator) const override {}
95  void IncreaseIterator(MapIterator* map_iter) const override {}
96 };
97 
99  protected:
100  typedef unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType;
104 
106  // Get descriptors
108  ->FindFieldByName("map_int32_int32")
109  ->message_type();
112 
113  // Build map field
114  map_field_.reset(new MapFieldType);
115  map_field_base_ = map_field_.get();
116  map_ = map_field_->MutableMap();
117  initial_value_map_[0] = 100;
118  initial_value_map_[1] = 101;
120  EXPECT_EQ(2, map_->size());
121  }
122 
123  std::unique_ptr<MapFieldType> map_field_;
129  std::map<int32, int32> initial_value_map_; // copy of initial values inserted
130 };
131 
132 TEST_F(MapFieldBasePrimitiveTest, SpaceUsedExcludingSelf) {
133  EXPECT_LT(0, map_field_base_->SpaceUsedExcludingSelf());
134 }
135 
136 TEST_F(MapFieldBasePrimitiveTest, GetRepeatedField) {
137  const RepeatedPtrField<Message>& repeated =
138  reinterpret_cast<const RepeatedPtrField<Message>&>(
139  map_field_base_->GetRepeatedField());
140  EXPECT_EQ(2, repeated.size());
141  for (int i = 0; i < repeated.size(); i++) {
142  const Message& message = repeated.Get(i);
143  int key = message.GetReflection()->GetInt32(message, key_descriptor_);
144  int value = message.GetReflection()->GetInt32(message, value_descriptor_);
145  EXPECT_EQ(value, initial_value_map_[key]);
146  }
147 }
148 
149 TEST_F(MapFieldBasePrimitiveTest, MutableRepeatedField) {
150  RepeatedPtrField<Message>* repeated =
151  reinterpret_cast<RepeatedPtrField<Message>*>(
152  map_field_base_->MutableRepeatedField());
153  EXPECT_EQ(2, repeated->size());
154  for (int i = 0; i < repeated->size(); i++) {
155  const Message& message = repeated->Get(i);
156  int key = message.GetReflection()->GetInt32(message, key_descriptor_);
157  int value = message.GetReflection()->GetInt32(message, value_descriptor_);
158  EXPECT_EQ(value, initial_value_map_[key]);
159  }
160 }
161 
163  // Allocate a large initial block to avoid mallocs during hooked test.
164  std::vector<char> arena_block(128 * 1024);
166  options.initial_block = &arena_block[0];
167  options.initial_block_size = arena_block.size();
168  Arena arena(options);
169 
170  {
171  // TODO(liujisi): Re-write the test to ensure the memory for the map and
172  // repeated fields are allocated from arenas.
173  // NoHeapChecker no_heap;
174 
175  MapFieldType* map_field = Arena::CreateMessage<MapFieldType>(&arena);
176 
177  // Set content in map
178  (*map_field->MutableMap())[100] = 101;
179 
180  // Trigger conversion to repeated field.
181  map_field->GetRepeatedField();
182  }
183 
184  {
185  // TODO(liujisi): Re-write the test to ensure the memory for the map and
186  // repeated fields are allocated from arenas.
187  // NoHeapChecker no_heap;
188 
189  MapFieldBaseStub* map_field =
190  Arena::CreateMessage<MapFieldBaseStub>(&arena);
191 
192  // Trigger conversion to repeated field.
193  EXPECT_TRUE(map_field->MutableRepeatedField() != NULL);
194  }
195 }
196 
197 namespace {
198 enum State { CLEAN, MAP_DIRTY, REPEATED_DIRTY };
199 } // anonymous namespace
200 
202  public:
203  protected:
204  typedef unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType;
209  // Build map field
210  map_field_.reset(new MapFieldType());
211  map_field_base_ = map_field_.get();
212 
213  Expect(map_field_.get(), MAP_DIRTY, 0, 0, true);
214  switch (state_) {
215  case CLEAN:
217  break;
218  case MAP_DIRTY:
219  MakeMapDirty(map_field_.get());
220  break;
221  case REPEATED_DIRTY:
223  break;
224  default:
225  break;
226  }
227  }
228 
229  void AddOneStillClean(MapFieldType* map_field) {
230  MapFieldBase* map_field_base = map_field;
231  Map<int32, int32>* map = map_field->MutableMap();
232  (*map)[0] = 0;
233  map_field_base->GetRepeatedField();
234  Expect(map_field, CLEAN, 1, 1, false);
235  }
236 
237  void MakeMapDirty(MapFieldType* map_field) {
238  Map<int32, int32>* map = map_field->MutableMap();
239  (*map)[0] = 0;
240  Expect(map_field, MAP_DIRTY, 1, 0, true);
241  }
242 
243  void MakeRepeatedDirty(MapFieldType* map_field) {
244  MakeMapDirty(map_field);
245  MapFieldBase* map_field_base = map_field;
246  map_field_base->MutableRepeatedField();
247  // We use MutableMap on impl_ because we don't want to disturb the syncing
248  Map<int32, int32>* map = map_field->impl_.MutableMap();
249  map->clear();
250 
251  Expect(map_field, REPEATED_DIRTY, 0, 1, false);
252  }
253 
254  void Expect(MapFieldType* map_field, State state, int map_size,
255  int repeated_size, bool is_repeated_null) {
256  MapFieldBase* map_field_base = map_field;
258  reinterpret_cast<MapFieldBaseStub*>(map_field_base);
259 
260  // We use MutableMap on impl_ because we don't want to disturb the syncing
261  Map<int32, int32>* map = map_field->impl_.MutableMap();
262  RepeatedPtrField<Message>* repeated_field = stub->InternalRepeatedField();
263 
264  switch (state) {
265  case MAP_DIRTY:
266  EXPECT_FALSE(stub->IsMapClean());
267  EXPECT_TRUE(stub->IsRepeatedClean());
268  break;
269  case REPEATED_DIRTY:
270  EXPECT_TRUE(stub->IsMapClean());
271  EXPECT_FALSE(stub->IsRepeatedClean());
272  break;
273  case CLEAN:
274  EXPECT_TRUE(stub->IsMapClean());
275  EXPECT_TRUE(stub->IsRepeatedClean());
276  break;
277  default:
278  FAIL();
279  }
280 
281  EXPECT_EQ(map_size, map->size());
282  if (is_repeated_null) {
284  } else {
285  if (repeated_field == nullptr) {
286  EXPECT_EQ(repeated_size, 0);
287  } else {
288  EXPECT_EQ(repeated_size, repeated_field->size());
289  }
290  }
291  }
292 
293  std::unique_ptr<MapFieldType> map_field_;
296 };
297 
298 INSTANTIATE_TEST_SUITE_P(MapFieldStateTestInstance, MapFieldStateTest,
299  ::testing::Values(CLEAN, MAP_DIRTY, REPEATED_DIRTY));
300 
302  map_field_->GetMap();
303  if (state_ != MAP_DIRTY) {
304  Expect(map_field_.get(), CLEAN, 1, 1, false);
305  } else {
306  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
307  }
308 }
309 
310 TEST_P(MapFieldStateTest, MutableMap) {
311  map_field_->MutableMap();
312  if (state_ != MAP_DIRTY) {
313  Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
314  } else {
315  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
316  }
317 }
318 
319 TEST_P(MapFieldStateTest, MergeFromClean) {
320  MapFieldType other;
321  AddOneStillClean(&other);
322 
323  map_field_->MergeFrom(other);
324 
325  if (state_ != MAP_DIRTY) {
326  Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
327  } else {
328  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
329  }
330 
331  Expect(&other, CLEAN, 1, 1, false);
332 }
333 
334 TEST_P(MapFieldStateTest, MergeFromMapDirty) {
335  MapFieldType other;
336  MakeMapDirty(&other);
337 
338  map_field_->MergeFrom(other);
339 
340  if (state_ != MAP_DIRTY) {
341  Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
342  } else {
343  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
344  }
345 
346  Expect(&other, MAP_DIRTY, 1, 0, true);
347 }
348 
349 TEST_P(MapFieldStateTest, MergeFromRepeatedDirty) {
350  MapFieldType other;
351  MakeRepeatedDirty(&other);
352 
353  map_field_->MergeFrom(other);
354 
355  if (state_ != MAP_DIRTY) {
356  Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
357  } else {
358  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
359  }
360 
361  Expect(&other, CLEAN, 1, 1, false);
362 }
363 
365  MapFieldType other;
366  AddOneStillClean(&other);
367 
368  map_field_->Swap(&other);
369 
370  Expect(map_field_.get(), CLEAN, 1, 1, false);
371 
372  switch (state_) {
373  case CLEAN:
374  Expect(&other, CLEAN, 1, 1, false);
375  break;
376  case MAP_DIRTY:
377  Expect(&other, MAP_DIRTY, 1, 0, true);
378  break;
379  case REPEATED_DIRTY:
380  Expect(&other, REPEATED_DIRTY, 0, 1, false);
381  break;
382  default:
383  break;
384  }
385 }
386 
387 TEST_P(MapFieldStateTest, SwapMapDirty) {
388  MapFieldType other;
389  MakeMapDirty(&other);
390 
391  map_field_->Swap(&other);
392 
393  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
394 
395  switch (state_) {
396  case CLEAN:
397  Expect(&other, CLEAN, 1, 1, false);
398  break;
399  case MAP_DIRTY:
400  Expect(&other, MAP_DIRTY, 1, 0, true);
401  break;
402  case REPEATED_DIRTY:
403  Expect(&other, REPEATED_DIRTY, 0, 1, false);
404  break;
405  default:
406  break;
407  }
408 }
409 
410 TEST_P(MapFieldStateTest, SwapRepeatedDirty) {
411  MapFieldType other;
412  MakeRepeatedDirty(&other);
413 
414  map_field_->Swap(&other);
415 
416  Expect(map_field_.get(), REPEATED_DIRTY, 0, 1, false);
417 
418  switch (state_) {
419  case CLEAN:
420  Expect(&other, CLEAN, 1, 1, false);
421  break;
422  case MAP_DIRTY:
423  Expect(&other, MAP_DIRTY, 1, 0, true);
424  break;
425  case REPEATED_DIRTY:
426  Expect(&other, REPEATED_DIRTY, 0, 1, false);
427  break;
428  default:
429  break;
430  }
431 }
432 
434  map_field_->Clear();
435 
436  Expect(map_field_.get(), MAP_DIRTY, 0, 0, false);
437 }
438 
439 TEST_P(MapFieldStateTest, SpaceUsedExcludingSelf) {
440  map_field_base_->SpaceUsedExcludingSelf();
441 
442  switch (state_) {
443  case CLEAN:
444  Expect(map_field_.get(), CLEAN, 1, 1, false);
445  break;
446  case MAP_DIRTY:
447  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
448  break;
449  case REPEATED_DIRTY:
450  Expect(map_field_.get(), REPEATED_DIRTY, 0, 1, false);
451  break;
452  default:
453  break;
454  }
455 }
456 
457 TEST_P(MapFieldStateTest, GetMapField) {
458  map_field_base_->GetRepeatedField();
459 
460  if (state_ != REPEATED_DIRTY) {
461  Expect(map_field_.get(), CLEAN, 1, 1, false);
462  } else {
463  Expect(map_field_.get(), REPEATED_DIRTY, 0, 1, false);
464  }
465 }
466 
467 TEST_P(MapFieldStateTest, MutableMapField) {
468  map_field_base_->MutableRepeatedField();
469 
470  if (state_ != REPEATED_DIRTY) {
471  Expect(map_field_.get(), REPEATED_DIRTY, 1, 1, false);
472  } else {
473  Expect(map_field_.get(), REPEATED_DIRTY, 0, 1, false);
474  }
475 }
476 
477 
478 } // namespace internal
479 } // namespace protobuf
480 } // namespace google
google::protobuf.internal::MapFieldLite::MutableMap
Map< Key, T > * MutableMap()
Definition: map_field_lite.h:74
google::protobuf.internal::MapFieldBaseStub
Definition: map_field_test.cc:55
google::protobuf.internal::MapFieldBase::STATE_MODIFIED_MAP
@ STATE_MODIFIED_MAP
Definition: map_field.h:140
google::protobuf::RepeatedPtrField
Definition: command_line_interface.h:62
google::protobuf::FieldDescriptor
Definition: src/google/protobuf/descriptor.h:515
google::protobuf.internal::MapFieldBasePrimitiveTest::map_field_
std::unique_ptr< MapFieldType > map_field_
Definition: map_field_test.cc:123
google::protobuf.internal::MapFieldBaseStub::EqualIterator
bool EqualIterator(const MapIterator &a, const MapIterator &b) const override
Definition: map_field_test.cc:81
arena_test_util.h
google::protobuf.internal::MapFieldStateTest::Expect
void Expect(MapFieldType *map_field, State state, int map_size, int repeated_size, bool is_repeated_null)
Definition: map_field_test.cc:254
FAIL
#define FAIL()
Definition: gtest.h:1952
NULL
NULL
Definition: test_security_zap.cpp:405
google::protobuf.internal::WireFormatLite::TYPE_INT32
@ TYPE_INT32
Definition: wire_format_lite.h:116
map_field_inl.h
google::protobuf.internal::MapField
Definition: map.h:78
google::protobuf.internal::MapFieldBaseStub::SetRepeatedDirty
void SetRepeatedDirty()
Definition: map_field_test.cc:72
options
Message * options
Definition: src/google/protobuf/descriptor.cc:3119
gtest.h
google::protobuf.internal::MapFieldStateTest::AddOneStillClean
void AddOneStillClean(MapFieldType *map_field)
Definition: map_field_test.cc:229
google::protobuf.internal::MapFieldBasePrimitiveTest::map_descriptor_
const Descriptor * map_descriptor_
Definition: map_field_test.cc:126
google::protobuf.internal::MapFieldBaseStub::MergeFrom
void MergeFrom(const MapFieldBase &other) override
Definition: map_field_test.cc:89
google::protobuf.internal::INSTANTIATE_TEST_SUITE_P
INSTANTIATE_TEST_SUITE_P(MapFieldStateTestInstance, MapFieldStateTest, ::testing::Values(CLEAN, MAP_DIRTY, REPEATED_DIRTY))
google::protobuf.internal::MapFieldBase::GetRepeatedField
const RepeatedPtrFieldBase & GetRepeatedField() const
Definition: map_field.cc:46
google::protobuf.internal::MapFieldBaseStub::InternalRepeatedField
RepeatedPtrField< Message > * InternalRepeatedField()
Definition: map_field_test.cc:62
EXPECT_EQ
#define EXPECT_EQ(val1, val2)
Definition: glog/src/googletest.h:155
google::protobuf::RepeatedPtrField::Get
const Element & Get(int index) const
Definition: repeated_field.h:2014
map_field_
std::string map_field_
Definition: message_differencer_unittest.cc:2420
google::protobuf::Map::insert
std::pair< iterator, bool > insert(const value_type &value)
Definition: map.h:1101
google::protobuf.internal::MapFieldBaseStub::MapFieldBaseStub
MapFieldBaseStub(Arena *arena)
Definition: map_field_test.cc:60
google::protobuf.internal::MapFieldBaseStub::DeleteIterator
void DeleteIterator(MapIterator *map_iter) const override
Definition: map_field_test.cc:92
google::protobuf.internal::MapFieldBasePrimitiveTest::map_
Map< int32, int32 > * map_
Definition: map_field_test.cc:125
google::protobuf.internal::MapFieldBaseStub::Swap
void Swap(MapFieldBase *other) override
Definition: map_field_test.cc:90
descriptor
Descriptor * descriptor
Definition: php/ext/google/protobuf/protobuf.h:936
map
zval * map
Definition: php/ext/google/protobuf/encode_decode.c:473
testing::Test
Definition: gtest.h:415
google::protobuf.internal::MapFieldBaseStub::size
int size() const override
Definition: map_field_test.cc:85
testing::TestWithParam
Definition: gtest.h:1910
google::protobuf.internal::MapFieldStateTest::map_field_
std::unique_ptr< MapFieldType > map_field_
Definition: map_field_test.cc:293
google::protobuf.internal::MapFieldBaseStub::CopyIterator
void CopyIterator(MapIterator *this_iterator, const MapIterator &other_iterator) const override
Definition: map_field_test.cc:93
google::protobuf.internal::MapFieldBasePrimitiveTest
Definition: map_field_test.cc:98
b
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:3228
google::protobuf.internal::MapFieldBaseStub::ContainsMapKey
bool ContainsMapKey(const MapKey &map_key) const override
Definition: map_field_test.cc:75
google::protobuf.internal::MapFieldBaseStub::SetMapDirty
void SetMapDirty()
Definition: map_field_test.cc:69
google::protobuf::int32
int32_t int32
Definition: protobuf/src/google/protobuf/stubs/port.h:150
google::protobuf.internal::MapFieldBaseStub::IsMapClean
bool IsMapClean()
Definition: map_field_test.cc:63
google::protobuf.internal::MapFieldStateTest::MapFieldStateTest
MapFieldStateTest()
Definition: map_field_test.cc:208
repeated_field
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern repeated_field
Definition: array.c:486
google::protobuf::python::GetMap
static MapContainer * GetMap(PyObject *obj)
Definition: map_container.cc:307
google::protobuf.internal::MapFieldBaseStub::IsRepeatedClean
bool IsRepeatedClean()
Definition: map_field_test.cc:66
google::protobuf.internal::MapFieldStateTest::state_
State state_
Definition: map_field_test.cc:295
google::protobuf.internal::MapFieldBaseStub::DeleteMapValue
bool DeleteMapValue(const MapKey &map_key) override
Definition: map_field_test.cc:80
google::protobuf.internal::MapFieldBase::repeated_field_
RepeatedPtrField< Message > * repeated_field_
Definition: map_field.h:148
google::protobuf.internal::MapFieldBaseStub::Clear
void Clear() override
Definition: map_field_test.cc:86
google::protobuf.internal::MapFieldBaseStub::DestructorSkippable_
void DestructorSkippable_
Definition: map_field_test.cc:58
message.h
google::protobuf.internal::MapFieldBasePrimitiveTest::key_descriptor_
const FieldDescriptor * key_descriptor_
Definition: map_field_test.cc:127
repeated_field.h
google::protobuf.internal::MapFieldBaseStub::InitializeIterator
void InitializeIterator(MapIterator *map_iter) const override
Definition: map_field_test.cc:91
EXPECT_TRUE
#define EXPECT_TRUE(cond)
Definition: glog/src/googletest.h:137
google::protobuf.internal::MapFieldStateTest::map_field_base_
MapFieldBase * map_field_base_
Definition: map_field_test.cc:294
map_test_util.h
map.h
key
const SETUP_TEARDOWN_TESTCONTEXT char * key
Definition: test_wss_transport.cpp:10
google::protobuf.internal::MapFieldBasePrimitiveTest::initial_value_map_
std::map< int32, int32 > initial_value_map_
Definition: map_field_test.cc:129
google::protobuf.internal::MapFieldStateTest::MapFieldType
MapField< EntryType, int32, int32, WireFormatLite::TYPE_INT32, WireFormatLite::TYPE_INT32, false > MapFieldType
Definition: map_field_test.cc:207
google::protobuf.internal::MapFieldBase::STATE_MODIFIED_REPEATED
@ STATE_MODIFIED_REPEATED
Definition: map_field.h:142
i
int i
Definition: gmock-matchers_test.cc:764
google::protobuf::RepeatedPtrField::size
int size() const
Definition: repeated_field.h:2009
stub
static void stub(zmq::mtrie_t::prefix_t data_, size_t size_, void *arg_)
Definition: xpub.cpp:246
google::protobuf.internal::MapFieldStateTest::MakeRepeatedDirty
void MakeRepeatedDirty(MapFieldType *map_field)
Definition: map_field_test.cc:243
google::protobuf::ArenaOptions
Definition: arena.h:115
google::protobuf::Message
Definition: src/google/protobuf/message.h:205
State
Definition: demangle.cc:151
google::protobuf.internal::TEST_P
TEST_P(MapFieldStateTest, GetMap)
Definition: map_field_test.cc:301
google::protobuf.internal.python_message.Clear
Clear
Definition: python_message.py:1431
google::protobuf.internal::MapField::impl_
MapFieldLiteType impl_
Definition: map_field.h:297
google::protobuf.internal::MapFieldBasePrimitiveTest::value_descriptor_
const FieldDescriptor * value_descriptor_
Definition: map_field_test.cc:128
common.h
google::protobuf::Descriptor::FindFieldByName
const FieldDescriptor * FindFieldByName(const std::string &name) const
Definition: src/google/protobuf/descriptor.cc:1615
EXPECT_LT
#define EXPECT_LT(val1, val2)
Definition: glog/src/googletest.h:158
google::protobuf::MapKey
Definition: map_field.h:371
google::protobuf.internal::MapFieldBaseStub::MapBegin
void MapBegin(MapIterator *map_iter) const override
Definition: map_field_test.cc:87
google::protobuf.internal::TEST_F
TEST_F(MapFieldBasePrimitiveTest, SpaceUsedExcludingSelf)
Definition: map_field_test.cc:132
EXPECT_FALSE
#define EXPECT_FALSE(cond)
Definition: glog/src/googletest.h:145
arena.h
google::protobuf.internal::MapFieldBase::MutableRepeatedField
RepeatedPtrFieldBase * MutableRepeatedField()
Definition: map_field.cc:51
logging.h
google::protobuf.internal::MapFieldBaseStub::InsertOrLookupMapValue
bool InsertOrLookupMapValue(const MapKey &map_key, MapValueRef *val) override
Definition: map_field_test.cc:76
testing::WithParamInterface< State >::GetParam
static const ParamType & GetParam()
Definition: gtest.h:1882
google::protobuf::Descriptor
Definition: src/google/protobuf/descriptor.h:231
google::protobuf.internal::MapFieldStateTest
Definition: map_field_test.cc:201
google::protobuf::Map::size
size_type size() const
Definition: map.h:1045
google::protobuf.internal::MapField::MutableMap
Map< Key, T > * MutableMap() override
Definition: map_field.h:259
google::protobuf.internal::MapFieldBaseStub::IncreaseIterator
void IncreaseIterator(MapIterator *map_iter) const override
Definition: map_field_test.cc:95
google::protobuf.internal::MapFieldBasePrimitiveTest::map_field_base_
MapFieldBase * map_field_base_
Definition: map_field_test.cc:124
google::protobuf.internal::MapFieldBasePrimitiveTest::MapFieldBasePrimitiveTest
MapFieldBasePrimitiveTest()
Definition: map_field_test.cc:105
google::protobuf::Map< int32, int32 >
internal
Definition: any.pb.h:40
google::protobuf.internal::MapFieldBase
Definition: map_field.h:69
google::protobuf.internal::MapFieldStateTest::MakeMapDirty
void MakeMapDirty(MapFieldType *map_field)
Definition: map_field_test.cc:237
val
GLuint GLfloat * val
Definition: glcorearb.h:3604
google::protobuf.internal::MapFieldBasePrimitiveTest::MapFieldType
MapField< EntryType, int32, int32, WireFormatLite::TYPE_INT32, WireFormatLite::TYPE_INT32, false > MapFieldType
Definition: map_field_test.cc:103
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
google::protobuf.internal::MapFieldStateTest::EntryType
unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType
Definition: map_field_test.cc:204
google::protobuf.internal::MapFieldBaseStub::MapFieldBaseStub
MapFieldBaseStub()
Definition: map_field_test.cc:59
google::protobuf::MapIterator
Definition: map_field.h:712
google::protobuf.internal::MapFieldBaseStub::InternalArenaConstructable_
void InternalArenaConstructable_
Definition: map_field_test.cc:57
google::protobuf.internal::MapFieldBasePrimitiveTest::EntryType
unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType
Definition: map_field_test.cc:100
google::protobuf.internal::MapFieldBase::state_
std::atomic< State > state_
Definition: map_field.h:153
a
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:3228
testing::Values
internal::ValueArray< T... > Values(T... v)
Definition: gtest-param-test.h:340
google::protobuf.internal::MapFieldBaseStub::MapEnd
void MapEnd(MapIterator *map_iter) const override
Definition: map_field_test.cc:88
google
Definition: data_proto2_to_proto3_util.h:11
message
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glcorearb.h:2695
testing::internal::Expect
void Expect(bool condition, const char *file, int line, const std::string &msg)
Definition: gmock-internal-utils.h:298
google::protobuf::MapValueRef
Definition: map_field.h:565


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:56