diff options
author | Vladimir Glavnyy <31897320+vglavnyy@users.noreply.github.com> | 2019-09-23 23:31:51 +0700 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2019-09-23 09:31:51 -0700 |
commit | cbdf82e2fbd73db8402ba83a6635049f097d8e3b (patch) | |
tree | d2272ef5643949de356ad6aac589f830ce5eeef0 /tests | |
parent | e365c502ffc659752f9b7a8d60b0052a07e33659 (diff) | |
download | flatbuffers-cbdf82e2fbd73db8402ba83a6635049f097d8e3b.tar.gz flatbuffers-cbdf82e2fbd73db8402ba83a6635049f097d8e3b.tar.bz2 flatbuffers-cbdf82e2fbd73db8402ba83a6635049f097d8e3b.zip |
Fix Mutate() methods of Array<scalar/struct> (override 5508) (#5526)
* Draft with Array specialization (#5508)
* Array specialization + SFINAE to fold copy-paste (#5508)
* Add implicit specialization of Array<scalar> and Array<struct> (#5508)
- Tag dispatching is used for implicit specialization
- Array<scalar> and Array<struct> have different iterators and accessors
- Array<scalar> and Array<struct> have different Mutate() methods
* Add implicit specialization of Array<scalar> and Array<struct> (#5508)
- Tag dispatching is used for implicit specialization
- Array<scalar> and Array<struct> have different iterators and accessors
- Array<scalar> and Array<struct> have different Mutate() methods
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/tests/test.cpp b/tests/test.cpp index 939550db..7762f5fa 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -2895,35 +2895,37 @@ void FixedLengthArrayTest() { TEST_EQ(mArStruct->b()->size(), 15); TEST_EQ(mArStruct->b()->Get(aStruct.b()->size() - 1), -14); TEST_EQ(mArStruct->c(), 12); - TEST_NOTNULL(mArStruct->d()->Get(0).a()); - TEST_EQ(mArStruct->d()->Get(0).a()->Get(0), 1); - TEST_EQ(mArStruct->d()->Get(0).a()->Get(1), 2); - TEST_NOTNULL(mArStruct->d()->Get(1).a()); - TEST_EQ(mArStruct->d()->Get(1).a()->Get(0), 3); - TEST_EQ(mArStruct->d()->Get(1).a()->Get(1), 4); + TEST_NOTNULL(mArStruct->d()->Get(0)); + TEST_NOTNULL(mArStruct->d()->Get(0)->a()); + TEST_EQ(mArStruct->d()->Get(0)->a()->Get(0), 1); + TEST_EQ(mArStruct->d()->Get(0)->a()->Get(1), 2); + TEST_NOTNULL(mArStruct->d()->Get(1)); + TEST_NOTNULL(mArStruct->d()->Get(1)->a()); + TEST_EQ(mArStruct->d()->Get(1)->a()->Get(0), 3); + TEST_EQ(mArStruct->d()->Get(1)->a()->Get(1), 4); TEST_NOTNULL(mArStruct->mutable_d()->GetMutablePointer(1)); TEST_NOTNULL(mArStruct->mutable_d()->GetMutablePointer(1)->mutable_a()); mArStruct->mutable_d()->GetMutablePointer(1)->mutable_a()->Mutate(1, 5); - TEST_EQ(mArStruct->d()->Get(1).a()->Get(1), 5); - TEST_EQ(mArStruct->d()->Get(0).b() == MyGame::Example::TestEnum::B, true); - TEST_NOTNULL(mArStruct->d()->Get(0).c()); - TEST_EQ(mArStruct->d()->Get(0).c()->Get(0) == MyGame::Example::TestEnum::C, + TEST_EQ(mArStruct->d()->Get(1)->a()->Get(1), 5); + TEST_EQ(mArStruct->d()->Get(0)->b() == MyGame::Example::TestEnum::B, true); + TEST_NOTNULL(mArStruct->d()->Get(0)->c()); + TEST_EQ(mArStruct->d()->Get(0)->c()->Get(0) == MyGame::Example::TestEnum::C, true); - TEST_EQ(mArStruct->d()->Get(0).c()->Get(1) == MyGame::Example::TestEnum::A, + TEST_EQ(mArStruct->d()->Get(0)->c()->Get(1) == MyGame::Example::TestEnum::A, true); - TEST_EQ(mArStruct->d()->Get(0).d()->Get(0), + TEST_EQ(mArStruct->d()->Get(0)->d()->Get(0), flatbuffers::numeric_limits<int64_t>::max()); - TEST_EQ(mArStruct->d()->Get(0).d()->Get(1), + TEST_EQ(mArStruct->d()->Get(0)->d()->Get(1), flatbuffers::numeric_limits<int64_t>::min()); - TEST_EQ(mArStruct->d()->Get(1).b() == MyGame::Example::TestEnum::C, true); - TEST_NOTNULL(mArStruct->d()->Get(1).c()); - TEST_EQ(mArStruct->d()->Get(1).c()->Get(0) == MyGame::Example::TestEnum::C, + TEST_EQ(mArStruct->d()->Get(1)->b() == MyGame::Example::TestEnum::C, true); + TEST_NOTNULL(mArStruct->d()->Get(1)->c()); + TEST_EQ(mArStruct->d()->Get(1)->c()->Get(0) == MyGame::Example::TestEnum::C, true); - TEST_EQ(mArStruct->d()->Get(1).c()->Get(1) == MyGame::Example::TestEnum::A, + TEST_EQ(mArStruct->d()->Get(1)->c()->Get(1) == MyGame::Example::TestEnum::A, true); - TEST_EQ(mArStruct->d()->Get(1).d()->Get(0), + TEST_EQ(mArStruct->d()->Get(1)->d()->Get(0), flatbuffers::numeric_limits<int64_t>::min()); - TEST_EQ(mArStruct->d()->Get(1).d()->Get(1), + TEST_EQ(mArStruct->d()->Get(1)->d()->Get(1), flatbuffers::numeric_limits<int64_t>::max()); for (int i = 0; i < mArStruct->b()->size() - 1; i++) TEST_EQ(mArStruct->b()->Get(i), i + 1); |