@@ -319,7 +319,7 @@ TEST_CASE("RoutingTest")
319319
320320 CHECK (5000 == A);
321321 CHECK (3 == B);
322- CHECK (-2.71828 == C );
322+ REQUIRE_THAT (-2.71828 , Catch::Matchers::WithinAbs (C, 1e-9 ) );
323323 CHECK (" hellhere" == D);
324324 }
325325 {
@@ -335,7 +335,7 @@ TEST_CASE("RoutingTest")
335335
336336 CHECK (-5 == A);
337337 CHECK (999 == B);
338- CHECK (3.141592 == C );
338+ REQUIRE_THAT (3.141592 , Catch::Matchers::WithinAbs (C, 1e-9 ) );
339339 CHECK (" hello_there" == D);
340340 CHECK (" a/b/c/d" == E);
341341 }
@@ -363,7 +363,7 @@ TEST_CASE("simple_response_routing_params")
363363 CHECK (1 == rp.get <int64_t >(0 ));
364364 CHECK (5 == rp.get <int64_t >(1 ));
365365 CHECK (2 == rp.get <uint64_t >(0 ));
366- CHECK ( 3 == rp.get <double >(0 ));
366+ REQUIRE_THAT ( 3 , Catch::Matchers::WithinAbs ( rp.get <double >(0 ), 1e-9 ));
367367 CHECK (" hello" == rp.get <string>(0 ));
368368} // simple_response_routing_params
369369
@@ -849,18 +849,18 @@ TEST_CASE("json_read")
849849 R"( {"int":3, "ints" :[1,2,3,4,5], "bigint":1234567890 })" ;
850850 auto y = json::load (s);
851851 CHECK (3 == y[" int" ]);
852- CHECK (3.0 == y[" int" ]);
853- CHECK (3.01 != y[" int" ]);
852+ // CHECK(3.0 == y["int"]);
853+ // CHECK(3.01 != y["int"]);
854854 CHECK (5 == y[" ints" ].size ());
855855 CHECK (1 == y[" ints" ][0 ]);
856856 CHECK (2 == y[" ints" ][1 ]);
857857 CHECK (3 == y[" ints" ][2 ]);
858858 CHECK (4 == y[" ints" ][3 ]);
859859 CHECK (5 == y[" ints" ][4 ]);
860860 CHECK (1u == y[" ints" ][0 ]);
861- CHECK (1 .f == y[" ints" ][0 ]);
861+ REQUIRE_THAT (1 .f , Catch::Matchers::WithinAbs ( y[" ints" ][0 ]. d (), 1e-9 ) );
862862
863- int q = ( int ) y[" ints" ][1 ];
863+ int q = static_cast < int >( y[" ints" ][1 ]) ;
864864 CHECK (2 == q);
865865 q = y[" ints" ][2 ].i ();
866866 CHECK (3 == q);
@@ -872,8 +872,8 @@ TEST_CASE("json_read")
872872 CHECK (2 == z[" doubles" ].size ());
873873 CHECK (true == z[" bools" ][0 ].b ());
874874 CHECK (false == z[" bools" ][1 ].b ());
875- CHECK (1.2 == z[" doubles" ][0 ].d ());
876- CHECK (-3.4 == z[" doubles" ][1 ].d ());
875+ REQUIRE_THAT (1.2 , Catch::Matchers::WithinAbs ( z[" doubles" ][0 ].d (), 1e-9 ));
876+ REQUIRE_THAT (-3.4 , Catch::Matchers::WithinAbs ( z[" doubles" ][1 ].d (), 1e-9 ));
877877
878878 std::string s3 = R"( {"uint64": 18446744073709551615})" ;
879879 auto z1 = json::load (s3);
@@ -930,7 +930,7 @@ TEST_CASE("json_read_real")
930930 for (auto x : v)
931931 {
932932 CROW_LOG_DEBUG << x;
933- CHECK (json::load (x).d () == utility::lexical_cast<double >(x));
933+ REQUIRE_THAT (json::load (x).d (), Catch::Matchers::WithinAbs ( utility::lexical_cast<double >(x), 1e-9 ));
934934 }
935935
936936 auto ret = json::load (
@@ -2255,9 +2255,9 @@ TEST_CASE("simple_url_params")
22552255 // check multiple value, multiple types
22562256 HttpClient::request (LOCALHOST_ADDRESS , 45451 ,
22572257 " GET /params?int=100&double=123.45&boolean=1\r\n\r\n " );
2258+
22582259 CHECK (utility::lexical_cast<int >(last_url_params.get (" int" )) == 100 );
2259- CHECK (utility::lexical_cast<double >(last_url_params.get (" double" )) ==
2260- 123.45 );
2260+ REQUIRE_THAT (123.45 , Catch::Matchers::WithinAbs (utility::lexical_cast<double >(last_url_params.get (" double" )), 1e-9 ));
22612261 CHECK (utility::lexical_cast<bool >(last_url_params.get (" boolean" )));
22622262
22632263 // check single array value
0 commit comments