From c147744b7234541b33033ebd0052cd57c4ac1fb8 Mon Sep 17 00:00:00 2001 From: Krzysztof Gabis Date: Thu, 4 Jan 2018 18:41:43 +0100 Subject: [PATCH] Workaround for MSVC C2124 error. --- tests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests.c b/tests.c index 153f479..bd9ba36 100644 --- a/tests.c +++ b/tests.c @@ -316,6 +316,8 @@ void test_suite_4() { } void test_suite_5(void) { + double zero = 0.0; /* msvc is silly (workaround for error C2124) */ + JSON_Value *val_from_file = json_parse_file("tests/test_5.txt"); JSON_Value *val = NULL, *val_parent; @@ -438,8 +440,8 @@ void test_suite_5(void) { TEST(json_value_equals(remove_test_val, json_parse_string("[2, 4]"))); /* Testing nan and inf */ - TEST(json_object_set_number(obj, "num", 0.0 / 0.0) == JSONFailure); - TEST(json_object_set_number(obj, "num", 1.0 / 0.0) == JSONFailure); + TEST(json_object_set_number(obj, "num", 0.0 / zero) == JSONFailure); + TEST(json_object_set_number(obj, "num", 1.0 / zero) == JSONFailure); } void test_suite_6(void) {