mirror of
https://github.com/oatpp/oatpp.git
synced 2024-11-21 03:14:51 +08:00
Fix Clang compiler warnings (-Wno-float-equal)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
This commit is contained in:
parent
cc929ed690
commit
46fd1a6078
@ -293,7 +293,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compiler_flags(10 "-Wno-documentation")
|
||||
add_compiler_flags(10 "-Wno-documentation-unknown-command")
|
||||
add_compiler_flags(10 "-Wno-exit-time-destructors")
|
||||
add_compiler_flags(10 "-Wno-float-equal")
|
||||
add_compiler_flags(10 "-Wno-format-nonliteral")
|
||||
add_compiler_flags(10 "-Wno-global-constructors")
|
||||
add_compiler_flags(10 "-Wno-gnu-zero-variadic-macro-arguments")
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include "DTOMapperTest.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "oatpp/parser/json/mapping/ObjectMapper.hpp"
|
||||
|
||||
#include "oatpp/core/data/mapping/type/Object.hpp"
|
||||
@ -234,10 +236,10 @@ void DTOMapperTest::onRun(){
|
||||
OATPP_ASSERT(obj1->field_int64 == test1->field_int64)
|
||||
|
||||
OATPP_ASSERT(obj1->field_float32)
|
||||
OATPP_ASSERT(obj1->field_float32 == test1->field_float32)
|
||||
OATPP_ASSERT(fabsf(obj1->field_float32 - test1->field_float32) < std::numeric_limits<float>::epsilon())
|
||||
|
||||
OATPP_ASSERT(obj1->field_float64)
|
||||
OATPP_ASSERT(obj1->field_float64 == test1->field_float64)
|
||||
OATPP_ASSERT(fabs(obj1->field_float64 - test1->field_float64) < std::numeric_limits<double>::epsilon())
|
||||
|
||||
OATPP_ASSERT(obj1->field_boolean)
|
||||
OATPP_ASSERT(obj1->field_boolean == test1->field_boolean)
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include "DeserializerTest.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "oatpp/parser/json/mapping/ObjectMapper.hpp"
|
||||
#include "oatpp/core/macro/codegen.hpp"
|
||||
|
||||
@ -133,7 +135,7 @@ void DeserializerTest::onRun(){
|
||||
obj3 = mapper->readFromString<oatpp::Object<Test3>>("{\"float32F\": 32}");
|
||||
|
||||
OATPP_ASSERT(obj3)
|
||||
OATPP_ASSERT(obj3->float32F == 32)
|
||||
OATPP_ASSERT(fabsf(obj3->float32F - 32) < std::numeric_limits<float>::epsilon())
|
||||
|
||||
obj3 = mapper->readFromString<oatpp::Object<Test3>>("{\"float32F\": 1.32e1}");
|
||||
|
||||
@ -202,28 +204,28 @@ void DeserializerTest::onRun(){
|
||||
auto dto = mapper->readFromString<oatpp::Object<AnyDto>>(R"({"any":-1.23456789,"another":1.1})");
|
||||
OATPP_ASSERT(dto)
|
||||
OATPP_ASSERT(dto->any.getStoredType() == Float64::Class::getType())
|
||||
OATPP_ASSERT(dto->any.retrieve<Float64>() == -1.23456789)
|
||||
OATPP_ASSERT(fabs(dto->any.retrieve<Float64>() - -1.23456789) < std::numeric_limits<double>::epsilon())
|
||||
}
|
||||
OATPP_LOGD(TAG, "Any: Positive Float")
|
||||
{
|
||||
auto dto = mapper->readFromString<oatpp::Object<AnyDto>>(R"({"any":1.23456789,"another":1.1})");
|
||||
OATPP_ASSERT(dto)
|
||||
OATPP_ASSERT(dto->any.getStoredType() == Float64::Class::getType())
|
||||
OATPP_ASSERT(dto->any.retrieve<Float64>() == 1.23456789)
|
||||
OATPP_ASSERT(fabs(dto->any.retrieve<Float64>() - 1.23456789) < std::numeric_limits<double>::epsilon())
|
||||
}
|
||||
OATPP_LOGD(TAG, "Any: Negative exponential Float")
|
||||
{
|
||||
auto dto = mapper->readFromString<oatpp::Object<AnyDto>>(R"({"any":-1.2345e30,"another":1.1})");
|
||||
OATPP_ASSERT(dto)
|
||||
OATPP_ASSERT(dto->any.getStoredType() == Float64::Class::getType())
|
||||
OATPP_ASSERT(dto->any.retrieve<Float64>() == -1.2345e30)
|
||||
OATPP_ASSERT(fabs(dto->any.retrieve<Float64>() - -1.2345e30) < std::numeric_limits<double>::epsilon())
|
||||
}
|
||||
OATPP_LOGD(TAG, "Any: Positive exponential Float")
|
||||
{
|
||||
auto dto = mapper->readFromString<oatpp::Object<AnyDto>>(R"({"any":1.2345e30,"another":1.1})");
|
||||
OATPP_ASSERT(dto)
|
||||
OATPP_ASSERT(dto->any.getStoredType() == Float64::Class::getType())
|
||||
OATPP_ASSERT(dto->any.retrieve<Float64>() == 1.2345e30)
|
||||
OATPP_ASSERT(fabs(dto->any.retrieve<Float64>() - 1.2345e30) < std::numeric_limits<double>::epsilon())
|
||||
}
|
||||
OATPP_LOGD(TAG, "Any: Unsigned Integer")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user