From 886a36ad5c39d6b6985e30002e2b3230996b7f38 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 27 Feb 2013 15:17:33 +1100 Subject: [PATCH] Fix floating comparison warnings in json test --- test/json.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/json.cpp b/test/json.cpp index e8ee6b70..e02716aa 100644 --- a/test/json.cpp +++ b/test/json.cpp @@ -1,6 +1,7 @@ #include "../debug.hpp" #include "../json.hpp" +#include "../maths.hpp" #include #include @@ -42,7 +43,12 @@ main (int, char**) { CHECK_HARD (!ref["integer"].is_null ()); CHECK_HARD (!ref["integer"].is_object ()); CHECK_HARD (!ref["integer"].is_string ()); - CHECK_EQ ( ref["integer"].as_number (), 1u); + CHECK ( + exactly_equal ( + (unsigned)ref["integer"].as_number ().native (), + 1u + ) + ); CHECK_HARD ( ref["null"].is_null ()); CHECK_HARD (!ref["null"].is_array ()); @@ -73,7 +79,12 @@ main (int, char**) { CHECK_HARD (!ref["double"].is_null ()); CHECK_HARD (!ref["double"].is_object ()); CHECK_HARD (!ref["double"].is_string ()); - CHECK_EQ ( ref["double"].as_number (), 3.14); + CHECK ( + exactly_equal ( + ref["double"].as_number ().native (), + 3.14 + ) + ); CHECK_HARD ( ref["object"].is_object ()); CHECK_HARD (!ref["object"].is_array ());