diff options
author | Stewart Miles <smiles@google.com> | 2017-10-13 17:33:12 -0700 |
---|---|---|
committer | Stewart Miles <smiles@google.com> | 2017-10-13 17:35:57 -0700 |
commit | 9234ddcf114e1299b0a255e2ac05f1a74809f78d (patch) | |
tree | fe1f060d65352e3df044a606d273e5be663df8a1 | |
parent | 6d9a226f75f61683c3bc33d8512f99b7809a975d (diff) | |
download | flatbuffers-9234ddcf114e1299b0a255e2ac05f1a74809f78d.tar.gz flatbuffers-9234ddcf114e1299b0a255e2ac05f1a74809f78d.tar.bz2 flatbuffers-9234ddcf114e1299b0a255e2ac05f1a74809f78d.zip |
Fixed Android build failure caused by use of C++11 limits.
f2b3705c2c62c40afdef96f73f0aeaf32b4c8e0e caused Android builds
to fail. This switches limit constants to use limits templates in
stl_emulation.h.
-rw-r--r-- | tests/test.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/tests/test.cpp b/tests/test.cpp index fb20d75e..e4145bd2 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -1754,21 +1754,29 @@ void TypeAliasesTest() { flatbuffers::FlatBufferBuilder builder; - builder.Finish(CreateTypeAliases(builder, - INT8_MIN, UINT8_MAX, INT16_MIN, UINT16_MAX, - INT32_MIN, UINT32_MAX, INT64_MIN, UINT64_MAX, 2.3f, 2.3)); + builder.Finish(CreateTypeAliases( + builder, + flatbuffers::numeric_limits<int8_t>::min(), + flatbuffers::numeric_limits<uint8_t>::max(), + flatbuffers::numeric_limits<int16_t>::min(), + flatbuffers::numeric_limits<uint16_t>::max(), + flatbuffers::numeric_limits<int32_t>::min(), + flatbuffers::numeric_limits<uint32_t>::max(), + flatbuffers::numeric_limits<int64_t>::min(), + flatbuffers::numeric_limits<uint64_t>::max(), + 2.3f, 2.3)); auto p = builder.GetBufferPointer(); auto ta = flatbuffers::GetRoot<TypeAliases>(p); - TEST_EQ(ta->i8(), INT8_MIN); - TEST_EQ(ta->u8(), UINT8_MAX); - TEST_EQ(ta->i16(), INT16_MIN); - TEST_EQ(ta->u16(), UINT16_MAX); - TEST_EQ(ta->i32(), INT32_MIN); - TEST_EQ(ta->u32(), UINT32_MAX); - TEST_EQ(ta->i64(), INT64_MIN); - TEST_EQ(ta->u64(), UINT64_MAX); + TEST_EQ(ta->i8(), flatbuffers::numeric_limits<int8_t>::min()); + TEST_EQ(ta->u8(), flatbuffers::numeric_limits<uint8_t>::max()); + TEST_EQ(ta->i16(), flatbuffers::numeric_limits<int16_t>::min()); + TEST_EQ(ta->u16(), flatbuffers::numeric_limits<uint16_t>::max()); + TEST_EQ(ta->i32(), flatbuffers::numeric_limits<int32_t>::min()); + TEST_EQ(ta->u32(), flatbuffers::numeric_limits<uint32_t>::max()); + TEST_EQ(ta->i64(), flatbuffers::numeric_limits<int64_t>::min()); + TEST_EQ(ta->u64(), flatbuffers::numeric_limits<uint64_t>::max()); TEST_EQ(ta->f32(), 2.3f); TEST_EQ(ta->f64(), 2.3); TEST_EQ(sizeof(ta->i8()), 1); |