mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-05 13:08:58 +00:00
[vector] Allow to iterate with mutables (#7586)
Co-authored-by: ArnaudD-FR <arnaud.desmier@gmail.com> Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -439,6 +439,16 @@ void MutateFlatBuffersTest(uint8_t *flatbuf, std::size_t length) {
|
||||
TEST_EQ(first->hp(), 0);
|
||||
first->mutate_hp(1000);
|
||||
|
||||
// Test for each loop over mutable entries
|
||||
for (auto item: *tables)
|
||||
{
|
||||
TEST_EQ(item->hp(), 1000);
|
||||
item->mutate_hp(0);
|
||||
TEST_EQ(item->hp(), 0);
|
||||
item->mutate_hp(1000);
|
||||
break; // one iteration is enough, just testing compilation
|
||||
}
|
||||
|
||||
// Mutate via LookupByKey
|
||||
TEST_NOTNULL(tables->MutableLookupByKey("Barney"));
|
||||
TEST_EQ(static_cast<Monster *>(nullptr),
|
||||
|
||||
Reference in New Issue
Block a user