summaryrefslogtreecommitdiff
path: root/tests/test.cpp
diff options
context:
space:
mode:
authorVladimir Glavnyy <31897320+vglavnyy@users.noreply.github.com>2019-11-26 03:56:47 +0700
committerWouter van Oortmerssen <aardappel@gmail.com>2019-11-25 12:56:47 -0800
commitc3c32ec9420bce55ef191ab47790ab742dd69b54 (patch)
tree8d0c6cec07bacde675361ff577c0a6a8eca1f35b /tests/test.cpp
parent075e8d676bbea12ca678409f413edbbe90276798 (diff)
downloadflatbuffers-c3c32ec9420bce55ef191ab47790ab742dd69b54.tar.gz
flatbuffers-c3c32ec9420bce55ef191ab47790ab742dd69b54.tar.bz2
flatbuffers-c3c32ec9420bce55ef191ab47790ab742dd69b54.zip
Fix ambiguity of a type deduction in TEST_EQ macro if arguments have `enum class` type. (#5630)
Diffstat (limited to 'tests/test.cpp')
-rw-r--r--tests/test.cpp40
1 files changed, 18 insertions, 22 deletions
diff --git a/tests/test.cpp b/tests/test.cpp
index 515e2c43..149831da 100644
--- a/tests/test.cpp
+++ b/tests/test.cpp
@@ -1394,7 +1394,7 @@ void FuzzTest2() {
break;
}
}
- TEST_NOTNULL(NULL);
+ TEST_NOTNULL(nullptr);
}
// clang-format off
@@ -2985,32 +2985,28 @@ void FixedLengthArrayTest() {
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_EQ(5, mArStruct->d()->Get(1)->a()->Get(1));
+ TEST_EQ(MyGame::Example::TestEnum::B, mArStruct->d()->Get(0)->b());
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,
- true);
- TEST_EQ(mArStruct->d()->Get(0)->d()->Get(0),
- flatbuffers::numeric_limits<int64_t>::max());
- 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_EQ(MyGame::Example::TestEnum::C, mArStruct->d()->Get(0)->c()->Get(0));
+ TEST_EQ(MyGame::Example::TestEnum::A, mArStruct->d()->Get(0)->c()->Get(1));
+ TEST_EQ(flatbuffers::numeric_limits<int64_t>::max(),
+ mArStruct->d()->Get(0)->d()->Get(0));
+ TEST_EQ(flatbuffers::numeric_limits<int64_t>::min(),
+ mArStruct->d()->Get(0)->d()->Get(1));
+ TEST_EQ(MyGame::Example::TestEnum::C, mArStruct->d()->Get(1)->b());
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,
- true);
- TEST_EQ(mArStruct->d()->Get(1)->d()->Get(0),
- flatbuffers::numeric_limits<int64_t>::min());
- TEST_EQ(mArStruct->d()->Get(1)->d()->Get(1),
- flatbuffers::numeric_limits<int64_t>::max());
+ TEST_EQ(MyGame::Example::TestEnum::C, mArStruct->d()->Get(1)->c()->Get(0));
+ TEST_EQ(MyGame::Example::TestEnum::A, mArStruct->d()->Get(1)->c()->Get(1));
+ TEST_EQ(flatbuffers::numeric_limits<int64_t>::min(),
+ mArStruct->d()->Get(1)->d()->Get(0));
+ TEST_EQ(flatbuffers::numeric_limits<int64_t>::max(),
+ mArStruct->d()->Get(1)->d()->Get(1));
for (int i = 0; i < mArStruct->b()->size() - 1; i++)
TEST_EQ(mArStruct->b()->Get(i), i + 1);
// Check alignment
- TEST_EQ(reinterpret_cast<uintptr_t>(mArStruct->d()) % 8, 0);
- TEST_EQ(reinterpret_cast<uintptr_t>(mArStruct->f()) % 8, 0);
+ TEST_EQ(0, reinterpret_cast<uintptr_t>(mArStruct->d()) % 8);
+ TEST_EQ(0, reinterpret_cast<uintptr_t>(mArStruct->f()) % 8);
#endif
}