File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11#include < msgpack.hpp>
22#include < sstream>
33#include < iterator>
4+ #include < cmath>
5+
46#include < gtest/gtest.h>
57
68#ifdef HAVE_CONFIG_H
1113
1214#include < boost/fusion/adapted/struct/define_struct.hpp>
1315
16+ const double kEPS = 1e-10 ;
17+
1418BOOST_FUSION_DEFINE_STRUCT (
1519 BOOST_PP_EMPTY (),
1620 mystruct,
@@ -29,7 +33,7 @@ TEST(MSGPACK_BOOST, fusion_pack_unpack_convert)
2933 msgpack::unpack (ret, ss.str ().data (), ss.str ().size ());
3034 mystruct val2 = ret.get ().as <mystruct>();
3135 EXPECT_TRUE (val1.f1 == val2.f1 );
32- EXPECT_TRUE (val1 .f2 == val2 .f2 );
36+ EXPECT_TRUE (fabs (val2 .f2 - val1 .f2 ) <= kEPS );
3337}
3438
3539TEST (MSGPACK_BOOST, object_with_zone_convert)
@@ -41,7 +45,7 @@ TEST(MSGPACK_BOOST, object_with_zone_convert)
4145 msgpack::object obj (val1, z);
4246 mystruct val2 = obj.as <mystruct>();
4347 EXPECT_TRUE (val1.f1 == val2.f1 );
44- EXPECT_TRUE (val1 .f2 == val2 .f2 );
48+ EXPECT_TRUE (fabs (val2 .f2 - val1 .f2 ) <= kEPS );
4549}
4650
4751#endif // defined(MSGPACK_USE_BOOST)
You can’t perform that action at this time.
0 commit comments