From be6b417c8765ee9587770d57fb6992ad5f4f2f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DELRIEU?= Date: Sun, 8 Jan 2017 18:17:33 +0100 Subject: [PATCH] tweak SFINAE checks for internal types (see commit body) only check for public types (iterators, json_pointer) for private ones (m_array.iterator, primitive_iterator) simply double parentheses on relevant Catch checks --- src/json.hpp | 26 +++--- src/json.hpp.re2c | 26 +++--- test/src/unit-class_const_iterator.cpp | 124 ++++++++++++------------- test/src/unit-class_iterator.cpp | 124 ++++++++++++------------- 4 files changed, 146 insertions(+), 154 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 721a6c48..93e996f6 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -469,14 +469,13 @@ struct is_compatible_float_type std::is_floating_point::value; }; -template -struct is_basic_json_nested_class +template +struct is_basic_json_nested_type { static auto constexpr value = std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value or - std::is_same::value or std::is_same::value; }; @@ -1844,19 +1843,16 @@ class basic_json // constructor chosen when: // - JSONSerializer::to_json exists for type T // - T is not a istream, nor convertible to basic_json (float, vectors, etc) - template < - typename T, - enable_if_t>::value and - not detail::is_basic_json_nested_class, basic_json_t, primitive_iterator_t>::value and - not std::is_same, basic_json_t>::value and - not std::is_same, typename basic_json_t::array_t::iterator>::value and - not std::is_same, typename basic_json_t::object_t::iterator>::value and - detail::has_to_json>::value, - int> = 0 > - basic_json(T && val) + template , + enable_if_t< + not std::is_base_of::value and + not std::is_same::value and + not detail::is_basic_json_nested_type::value and + detail::has_to_json::value, + int> = 0> + basic_json(T &&val) { - JSONSerializer>::to_json(*this, std::forward(val)); + JSONSerializer>::to_json(*this, std::forward(val)); } /*! diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index cc89accf..e6921132 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -469,14 +469,13 @@ struct is_compatible_float_type std::is_floating_point::value; }; -template -struct is_basic_json_nested_class +template +struct is_basic_json_nested_type { static auto constexpr value = std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value or - std::is_same::value or std::is_same::value; }; @@ -1844,19 +1843,16 @@ class basic_json // constructor chosen when: // - JSONSerializer::to_json exists for type T // - T is not a istream, nor convertible to basic_json (float, vectors, etc) - template < - typename T, - enable_if_t>::value and - not detail::is_basic_json_nested_class, basic_json_t, primitive_iterator_t>::value and - not std::is_same, basic_json_t>::value and - not std::is_same, typename basic_json_t::array_t::iterator>::value and - not std::is_same, typename basic_json_t::object_t::iterator>::value and - detail::has_to_json>::value, - int> = 0 > - basic_json(T && val) + template , + enable_if_t< + not std::is_base_of::value and + not std::is_same::value and + not detail::is_basic_json_nested_type::value and + detail::has_to_json::value, + int> = 0> + basic_json(T &&val) { - JSONSerializer>::to_json(*this, std::forward(val)); + JSONSerializer>::to_json(*this, std::forward(val)); } /*! diff --git a/test/src/unit-class_const_iterator.cpp b/test/src/unit-class_const_iterator.cpp index a1f6b827..dba96e1f 100644 --- a/test/src/unit-class_const_iterator.cpp +++ b/test/src/unit-class_const_iterator.cpp @@ -91,7 +91,7 @@ TEST_CASE("const_iterator class") json j(json::value_t::null); json::const_iterator it(&j); it.set_begin(); - CHECK(it == j.cbegin()); + CHECK((it == j.cbegin())); } SECTION("object") @@ -99,7 +99,7 @@ TEST_CASE("const_iterator class") json j(json::value_t::object); json::const_iterator it(&j); it.set_begin(); - CHECK(it == j.cbegin()); + CHECK((it == j.cbegin())); } SECTION("array") @@ -107,7 +107,7 @@ TEST_CASE("const_iterator class") json j(json::value_t::array); json::const_iterator it(&j); it.set_begin(); - CHECK(it == j.cbegin()); + CHECK((it == j.cbegin())); } } @@ -118,7 +118,7 @@ TEST_CASE("const_iterator class") json j(json::value_t::null); json::const_iterator it(&j); it.set_end(); - CHECK(it == j.cend()); + CHECK((it == j.cend())); } SECTION("object") @@ -126,7 +126,7 @@ TEST_CASE("const_iterator class") json j(json::value_t::object); json::const_iterator it(&j); it.set_end(); - CHECK(it == j.cend()); + CHECK((it == j.cend())); } SECTION("array") @@ -134,7 +134,7 @@ TEST_CASE("const_iterator class") json j(json::value_t::array); json::const_iterator it(&j); it.set_end(); - CHECK(it == j.cend()); + CHECK((it == j.cend())); } } } @@ -220,7 +220,7 @@ TEST_CASE("const_iterator class") { json j(json::value_t::null); json::const_iterator it = j.cbegin(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); it++; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -229,9 +229,9 @@ TEST_CASE("const_iterator class") { json j(17); json::const_iterator it = j.cbegin(); - CHECK(it.m_it.primitive_iterator.m_it == 0); + CHECK((it.m_it.primitive_iterator.m_it == 0)); it++; - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); it++; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -240,28 +240,28 @@ TEST_CASE("const_iterator class") { json j({{"foo", "bar"}}); json::const_iterator it = j.cbegin(); - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->begin()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->begin())); it++; - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->end()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->end())); } SECTION("array") { json j({1, 2, 3, 4}); json::const_iterator it = j.cbegin(); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->begin()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->begin())); it++; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it++; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it++; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it++; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->end())); } } @@ -271,7 +271,7 @@ TEST_CASE("const_iterator class") { json j(json::value_t::null); json::const_iterator it = j.cbegin(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); ++it; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -280,9 +280,9 @@ TEST_CASE("const_iterator class") { json j(17); json::const_iterator it = j.cbegin(); - CHECK(it.m_it.primitive_iterator.m_it == 0); + CHECK((it.m_it.primitive_iterator.m_it == 0)); ++it; - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); ++it; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -291,28 +291,28 @@ TEST_CASE("const_iterator class") { json j({{"foo", "bar"}}); json::const_iterator it = j.cbegin(); - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->begin()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->begin())); ++it; - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->end()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->end())); } SECTION("array") { json j({1, 2, 3, 4}); json::const_iterator it = j.cbegin(); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->begin()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->begin())); ++it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); ++it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); ++it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); ++it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->end())); } } @@ -322,16 +322,16 @@ TEST_CASE("const_iterator class") { json j(json::value_t::null); json::const_iterator it = j.cend(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); } SECTION("number") { json j(17); json::const_iterator it = j.cend(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); it--; - CHECK(it.m_it.primitive_iterator.m_it == 0); + CHECK((it.m_it.primitive_iterator.m_it == 0)); it--; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -340,28 +340,28 @@ TEST_CASE("const_iterator class") { json j({{"foo", "bar"}}); json::const_iterator it = j.cend(); - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->end()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->end())); it--; - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->begin()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->begin())); } SECTION("array") { json j({1, 2, 3, 4}); json::const_iterator it = j.cend(); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->end())); it--; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it--; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it--; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it--; - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); } } @@ -371,16 +371,16 @@ TEST_CASE("const_iterator class") { json j(json::value_t::null); json::const_iterator it = j.cend(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); } SECTION("number") { json j(17); json::const_iterator it = j.cend(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); --it; - CHECK(it.m_it.primitive_iterator.m_it == 0); + CHECK((it.m_it.primitive_iterator.m_it == 0)); --it; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -389,28 +389,28 @@ TEST_CASE("const_iterator class") { json j({{"foo", "bar"}}); json::const_iterator it = j.cend(); - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->end()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->end())); --it; - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->begin()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->begin())); } SECTION("array") { json j({1, 2, 3, 4}); json::const_iterator it = j.cend(); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->end())); --it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); --it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); --it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); --it; - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); } } } diff --git a/test/src/unit-class_iterator.cpp b/test/src/unit-class_iterator.cpp index 1e8a3cec..16833cd9 100644 --- a/test/src/unit-class_iterator.cpp +++ b/test/src/unit-class_iterator.cpp @@ -75,7 +75,7 @@ TEST_CASE("iterator class") json j(json::value_t::null); json::iterator it(&j); it.set_begin(); - CHECK(it == j.begin()); + CHECK((it == j.begin())); } SECTION("object") @@ -83,7 +83,7 @@ TEST_CASE("iterator class") json j(json::value_t::object); json::iterator it(&j); it.set_begin(); - CHECK(it == j.begin()); + CHECK((it == j.begin())); } SECTION("array") @@ -91,7 +91,7 @@ TEST_CASE("iterator class") json j(json::value_t::array); json::iterator it(&j); it.set_begin(); - CHECK(it == j.begin()); + CHECK((it == j.begin())); } } @@ -102,7 +102,7 @@ TEST_CASE("iterator class") json j(json::value_t::null); json::iterator it(&j); it.set_end(); - CHECK(it == j.end()); + CHECK((it == j.end())); } SECTION("object") @@ -110,7 +110,7 @@ TEST_CASE("iterator class") json j(json::value_t::object); json::iterator it(&j); it.set_end(); - CHECK(it == j.end()); + CHECK((it == j.end())); } SECTION("array") @@ -118,7 +118,7 @@ TEST_CASE("iterator class") json j(json::value_t::array); json::iterator it(&j); it.set_end(); - CHECK(it == j.end()); + CHECK((it == j.end())); } } } @@ -204,7 +204,7 @@ TEST_CASE("iterator class") { json j(json::value_t::null); json::iterator it = j.begin(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); it++; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -213,9 +213,9 @@ TEST_CASE("iterator class") { json j(17); json::iterator it = j.begin(); - CHECK(it.m_it.primitive_iterator.m_it == 0); + CHECK((it.m_it.primitive_iterator.m_it == 0)); it++; - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); it++; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -224,28 +224,28 @@ TEST_CASE("iterator class") { json j({{"foo", "bar"}}); json::iterator it = j.begin(); - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->begin()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->begin())); it++; - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->end()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->end())); } SECTION("array") { json j({1, 2, 3, 4}); json::iterator it = j.begin(); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->begin()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->begin())); it++; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it++; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it++; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it++; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->end())); } } @@ -255,7 +255,7 @@ TEST_CASE("iterator class") { json j(json::value_t::null); json::iterator it = j.begin(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); ++it; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -264,9 +264,9 @@ TEST_CASE("iterator class") { json j(17); json::iterator it = j.begin(); - CHECK(it.m_it.primitive_iterator.m_it == 0); + CHECK((it.m_it.primitive_iterator.m_it == 0)); ++it; - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); ++it; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -275,28 +275,28 @@ TEST_CASE("iterator class") { json j({{"foo", "bar"}}); json::iterator it = j.begin(); - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->begin()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->begin())); ++it; - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->end()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->end())); } SECTION("array") { json j({1, 2, 3, 4}); json::iterator it = j.begin(); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->begin()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->begin())); ++it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); ++it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); ++it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); ++it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->end())); } } @@ -306,16 +306,16 @@ TEST_CASE("iterator class") { json j(json::value_t::null); json::iterator it = j.end(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); } SECTION("number") { json j(17); json::iterator it = j.end(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); it--; - CHECK(it.m_it.primitive_iterator.m_it == 0); + CHECK((it.m_it.primitive_iterator.m_it == 0)); it--; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -324,28 +324,28 @@ TEST_CASE("iterator class") { json j({{"foo", "bar"}}); json::iterator it = j.end(); - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->end()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->end())); it--; - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->begin()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->begin())); } SECTION("array") { json j({1, 2, 3, 4}); json::iterator it = j.end(); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->end())); it--; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it--; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it--; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); it--; - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); } } @@ -355,16 +355,16 @@ TEST_CASE("iterator class") { json j(json::value_t::null); json::iterator it = j.end(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); } SECTION("number") { json j(17); json::iterator it = j.end(); - CHECK(it.m_it.primitive_iterator.m_it == 1); + CHECK((it.m_it.primitive_iterator.m_it == 1)); --it; - CHECK(it.m_it.primitive_iterator.m_it == 0); + CHECK((it.m_it.primitive_iterator.m_it == 0)); --it; CHECK((it.m_it.primitive_iterator.m_it != 0 and it.m_it.primitive_iterator.m_it != 1)); } @@ -373,28 +373,28 @@ TEST_CASE("iterator class") { json j({{"foo", "bar"}}); json::iterator it = j.end(); - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->end()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->end())); --it; - CHECK(it.m_it.object_iterator == it.m_object->m_value.object->begin()); + CHECK((it.m_it.object_iterator == it.m_object->m_value.object->begin())); } SECTION("array") { json j({1, 2, 3, 4}); json::iterator it = j.end(); - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->end())); --it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); --it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); --it; - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); --it; - CHECK(it.m_it.array_iterator == it.m_object->m_value.array->begin()); - CHECK(it.m_it.array_iterator != it.m_object->m_value.array->end()); + CHECK((it.m_it.array_iterator == it.m_object->m_value.array->begin())); + CHECK((it.m_it.array_iterator != it.m_object->m_value.array->end())); } } }