diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test.cpp | 16 | ||||
-rw-r--r-- | tests/union_vector/union_vector_generated.h | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/tests/test.cpp b/tests/test.cpp index e860e09d..5bbac56b 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -46,7 +46,7 @@ void FlatBufferBuilderTest(); // http://en.wikipedia.org/wiki/Park%E2%80%93Miller_random_number_generator uint32_t lcg_seed = 48271; uint32_t lcg_rand() { - return lcg_seed = ((uint64_t)lcg_seed * 279470273UL) % 4294967291UL; + return lcg_seed = (static_cast<uint64_t>(lcg_seed) * 279470273UL) % 4294967291UL; } void lcg_reset() { lcg_seed = 48271; } @@ -1279,12 +1279,12 @@ bool FloatCompare(float a, float b) { return fabs(a - b) < 0.001; } void ValueTest() { // Test scientific notation numbers. TEST_EQ(FloatCompare(TestValue<float>("{ Y:0.0314159e+2 }", "float"), - (float)3.14159), + 3.14159f), true); // number in string TEST_EQ(FloatCompare(TestValue<float>("{ Y:\"0.0314159e+2\" }", "float"), - (float)3.14159), - true); + 3.14159f), + true); // Test conversion functions. TEST_EQ(FloatCompare(TestValue<float>("{ Y:cos(rad(180)) }", "float"), -1), @@ -1454,12 +1454,12 @@ void ValidFloatTest() { TEST_EQ(TestValue<double>("{ Y:+1.7977e+308 }", "double"), +infinityd); TEST_EQ(TestValue<double>("{ Y:-1.7977e+308 }", "double"), -infinityd); - TEST_EQ(FloatCompare(TestValue<float>("{ Y:0.0314159e+2 }", "float"), - (float)3.14159), - true); + TEST_EQ( + FloatCompare(TestValue<float>("{ Y:0.0314159e+2 }", "float"), 3.14159f), + true); // float in string TEST_EQ(FloatCompare(TestValue<float>("{ Y:\" 0.0314159e+2 \" }", "float"), - (float)3.14159), + 3.14159f), true); TEST_EQ(TestValue<float>("{ Y:1 }", "float"), 1.0f); diff --git a/tests/union_vector/union_vector_generated.h b/tests/union_vector/union_vector_generated.h index 4c6ee090..76d2f672 100644 --- a/tests/union_vector/union_vector_generated.h +++ b/tests/union_vector/union_vector_generated.h @@ -477,7 +477,7 @@ inline void Movie::UnPackTo(MovieT *_o, const flatbuffers::resolver_function_t * (void)_resolver; { auto _e = main_character_type(); _o->main_character.type = _e; }; { auto _e = main_character(); if (_e) _o->main_character.value = CharacterUnion::UnPack(_e, main_character_type(), _resolver); }; - { auto _e = characters_type(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].type = (Character)_e->Get(_i); } } }; + { auto _e = characters_type(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].type = static_cast<Character>(_e->Get(_i)); } } }; { auto _e = characters(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].value = CharacterUnion::UnPack(_e->Get(_i), characters_type()->GetEnum<Character>(_i), _resolver); } } }; } |