Fixed Android build failure caused by use of C++11 limits.

f2b3705c2c caused Android builds
to fail.  This switches limit constants to use limits templates in
stl_emulation.h.
This commit is contained in:
Stewart Miles 2017-10-13 17:33:12 -07:00
parent 6d9a226f75
commit 9234ddcf11
1 changed files with 19 additions and 11 deletions

View File

@ -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);