From 65c4b074514a724013f8aaa54d6d2618669dd908 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 3 Jun 2020 21:22:07 +0200 Subject: [PATCH] :art: replace alternative operators (and, not, or) --- test/src/unit-algorithms.cpp | 8 +- test/src/unit-bson.cpp | 14 +- test/src/unit-cbor.cpp | 14 +- test/src/unit-class_const_iterator.cpp | 12 +- test/src/unit-class_iterator.cpp | 12 +- test/src/unit-class_parser.cpp | 14 +- test/src/unit-comparison.cpp | 10 +- test/src/unit-constructor1.cpp | 2 +- test/src/unit-conversions.cpp | 2 +- test/src/unit-deserialization.cpp | 94 +++++------ test/src/unit-element_access2.cpp | 2 +- test/src/unit-inspection.cpp | 214 ++++++++++++------------- test/src/unit-iterators1.cpp | 6 +- test/src/unit-iterators2.cpp | 128 +++++++-------- test/src/unit-json_pointer.cpp | 46 +++--- test/src/unit-modifiers.cpp | 4 +- test/src/unit-msgpack.cpp | 6 +- test/src/unit-noexcept.cpp | 4 +- test/src/unit-regression.cpp | 28 ++-- test/src/unit-testsuites.cpp | 6 +- test/src/unit-ubjson.cpp | 14 +- test/src/unit-udt.cpp | 20 +-- test/src/unit-unicode.cpp | 44 ++--- 23 files changed, 352 insertions(+), 352 deletions(-) diff --git a/test/src/unit-algorithms.cpp b/test/src/unit-algorithms.cpp index 4b78700d..07facdc3 100644 --- a/test/src/unit-algorithms.cpp +++ b/test/src/unit-algorithms.cpp @@ -55,7 +55,7 @@ TEST_CASE("algorithms") { CHECK(std::any_of(j_array.begin(), j_array.end(), [](const json & value) { - return value.is_string() and value.get() == "foo"; + return value.is_string() && value.get() == "foo"; })); CHECK(std::any_of(j_object.begin(), j_object.end(), [](const json & value) { @@ -139,14 +139,14 @@ TEST_CASE("algorithms") { CHECK(std::equal(j_array.begin(), j_array.end(), j_array.begin())); CHECK(std::equal(j_object.begin(), j_object.end(), j_object.begin())); - CHECK(not std::equal(j_array.begin(), j_array.end(), j_object.begin())); + CHECK(!std::equal(j_array.begin(), j_array.end(), j_object.begin())); } SECTION("using user-defined comparison") { // compare objects only by size of its elements json j_array2 = {13, 29, 3, {"Hello", "World"}, true, false, {{"one", 1}, {"two", 2}, {"three", 3}}, "foo", "baz"}; - CHECK(not std::equal(j_array.begin(), j_array.end(), j_array2.begin())); + CHECK(!std::equal(j_array.begin(), j_array.end(), j_array2.begin())); CHECK(std::equal(j_array.begin(), j_array.end(), j_array2.begin(), [](const json & a, const json & b) { @@ -213,7 +213,7 @@ TEST_CASE("algorithms") return v.is_string(); }); CHECK(std::distance(j_array.begin(), it) == 2); - CHECK(not it[2].is_string()); + CHECK(!it[2].is_string()); } } diff --git a/test/src/unit-bson.cpp b/test/src/unit-bson.cpp index 3f3dbd10..1f51f881 100644 --- a/test/src/unit-bson.cpp +++ b/test/src/unit-bson.cpp @@ -766,7 +766,7 @@ TEST_CASE("Incomplete BSON Input") CHECK(json::from_bson(incomplete_bson, true, false).is_discarded()); SaxCountdown scp(0); - CHECK(not json::sax_parse(incomplete_bson, &scp, json::input_format_t::bson)); + CHECK(!json::sax_parse(incomplete_bson, &scp, json::input_format_t::bson)); } SECTION("Incomplete BSON Input 2") @@ -784,7 +784,7 @@ TEST_CASE("Incomplete BSON Input") CHECK(json::from_bson(incomplete_bson, true, false).is_discarded()); SaxCountdown scp(0); - CHECK(not json::sax_parse(incomplete_bson, &scp, json::input_format_t::bson)); + CHECK(!json::sax_parse(incomplete_bson, &scp, json::input_format_t::bson)); } SECTION("Incomplete BSON Input 3") @@ -808,7 +808,7 @@ TEST_CASE("Incomplete BSON Input") CHECK(json::from_bson(incomplete_bson, true, false).is_discarded()); SaxCountdown scp(1); - CHECK(not json::sax_parse(incomplete_bson, &scp, json::input_format_t::bson)); + CHECK(!json::sax_parse(incomplete_bson, &scp, json::input_format_t::bson)); } SECTION("Incomplete BSON Input 4") @@ -825,7 +825,7 @@ TEST_CASE("Incomplete BSON Input") CHECK(json::from_bson(incomplete_bson, true, false).is_discarded()); SaxCountdown scp(0); - CHECK(not json::sax_parse(incomplete_bson, &scp, json::input_format_t::bson)); + CHECK(!json::sax_parse(incomplete_bson, &scp, json::input_format_t::bson)); } SECTION("Improve coverage") @@ -835,7 +835,7 @@ TEST_CASE("Incomplete BSON Input") json j = {{"key", "value"}}; auto bson_vec = json::to_bson(j); SaxCountdown scp(2); - CHECK(not json::sax_parse(bson_vec, &scp, json::input_format_t::bson)); + CHECK(!json::sax_parse(bson_vec, &scp, json::input_format_t::bson)); } SECTION("array") @@ -846,7 +846,7 @@ TEST_CASE("Incomplete BSON Input") }; auto bson_vec = json::to_bson(j); SaxCountdown scp(2); - CHECK(not json::sax_parse(bson_vec, &scp, json::input_format_t::bson)); + CHECK(!json::sax_parse(bson_vec, &scp, json::input_format_t::bson)); } } } @@ -887,7 +887,7 @@ TEST_CASE("Unsupported BSON input") CHECK(json::from_bson(bson, true, false).is_discarded()); SaxCountdown scp(0); - CHECK(not json::sax_parse(bson, &scp, json::input_format_t::bson)); + CHECK(!json::sax_parse(bson, &scp, json::input_format_t::bson)); } TEST_CASE("BSON numerical data") diff --git a/test/src/unit-cbor.cpp b/test/src/unit-cbor.cpp index a29e8dcd..c31bcf0b 100644 --- a/test/src/unit-cbor.cpp +++ b/test/src/unit-cbor.cpp @@ -1077,7 +1077,7 @@ TEST_CASE("CBOR") { json j = json::from_cbor(std::vector({0xf9, 0x7c, 0x00})); json::number_float_t d = j; - CHECK(not std::isfinite(d)); + CHECK(!std::isfinite(d)); CHECK(j.dump() == "null"); } @@ -1869,7 +1869,7 @@ TEST_CASE("CBOR") { const auto result = json::from_cbor(vec, false); CHECK(result == json()); - CHECK(not json::from_cbor(vec, false, false).is_discarded()); + CHECK(!json::from_cbor(vec, false, false).is_discarded()); } SECTION("strict mode") @@ -1889,21 +1889,21 @@ TEST_CASE("CBOR") { std::vector v = {0x83, 0x01, 0x02, 0x03}; SaxCountdown scp(0); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::cbor)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::cbor)); } SECTION("start_object(len)") { std::vector v = {0xA1, 0x63, 0x66, 0x6F, 0x6F, 0xF4}; SaxCountdown scp(0); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::cbor)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::cbor)); } SECTION("key()") { std::vector v = {0xA1, 0x63, 0x66, 0x6F, 0x6F, 0xF4}; SaxCountdown scp(1); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::cbor)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::cbor)); } } } @@ -1954,7 +1954,7 @@ TEST_CASE("single CBOR roundtrip") } } -#if not defined(JSON_NOEXCEPTION) +#if !defined(JSON_NOEXCEPTION) TEST_CASE("CBOR regressions") { SECTION("fuzz test results") @@ -2274,7 +2274,7 @@ TEST_CASE("CBOR roundtrips" * doctest::skip()) } } -#if not defined(JSON_NOEXCEPTION) +#if !defined(JSON_NOEXCEPTION) TEST_CASE("all CBOR first bytes") { // these bytes will fail immediately with exception parse_error.112 diff --git a/test/src/unit-class_const_iterator.cpp b/test/src/unit-class_const_iterator.cpp index fc8e40c6..d232299c 100644 --- a/test/src/unit-class_const_iterator.cpp +++ b/test/src/unit-class_const_iterator.cpp @@ -224,7 +224,7 @@ TEST_CASE("const_iterator class") json::const_iterator it = j.cbegin(); 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("number") @@ -235,7 +235,7 @@ TEST_CASE("const_iterator class") it++; 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("object") @@ -275,7 +275,7 @@ TEST_CASE("const_iterator class") json::const_iterator it = j.cbegin(); 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("number") @@ -286,7 +286,7 @@ TEST_CASE("const_iterator class") ++it; 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("object") @@ -335,7 +335,7 @@ TEST_CASE("const_iterator class") it--; 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("object") @@ -384,7 +384,7 @@ TEST_CASE("const_iterator class") --it; 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("object") diff --git a/test/src/unit-class_iterator.cpp b/test/src/unit-class_iterator.cpp index 7c572a34..40f61c5d 100644 --- a/test/src/unit-class_iterator.cpp +++ b/test/src/unit-class_iterator.cpp @@ -208,7 +208,7 @@ TEST_CASE("iterator class") json::iterator it = j.begin(); 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("number") @@ -219,7 +219,7 @@ TEST_CASE("iterator class") it++; 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("object") @@ -259,7 +259,7 @@ TEST_CASE("iterator class") json::iterator it = j.begin(); 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("number") @@ -270,7 +270,7 @@ TEST_CASE("iterator class") ++it; 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("object") @@ -319,7 +319,7 @@ TEST_CASE("iterator class") it--; 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("object") @@ -368,7 +368,7 @@ TEST_CASE("iterator class") --it; 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)); + CHECK((it.m_it.primitive_iterator.m_it != 0 && it.m_it.primitive_iterator.m_it != 1)); } SECTION("object") diff --git a/test/src/unit-class_parser.cpp b/test/src/unit-class_parser.cpp index eb2fc9ff..012d18aa 100644 --- a/test/src/unit-class_parser.cpp +++ b/test/src/unit-class_parser.cpp @@ -251,7 +251,7 @@ bool accept_helper(const std::string& s) // 1. parse s without exceptions json j; CHECK_NOTHROW(json::parser(nlohmann::detail::input_adapter(s), nullptr, false).parse(true, j)); - const bool ok_noexcept = not j.is_discarded(); + const bool ok_noexcept = !j.is_discarded(); // 2. accept s const bool ok_accept = json::parser(nlohmann::detail::input_adapter(s)).accept(true); @@ -262,7 +262,7 @@ bool accept_helper(const std::string& s) // 4. parse with SAX (compare with relaxed accept result) SaxEventLogger el; CHECK_NOTHROW(json::sax_parse(s, &el, json::input_format_t::json, false)); - CHECK(json::parser(nlohmann::detail::input_adapter(s)).accept(false) == not el.errored); + CHECK(json::parser(nlohmann::detail::input_adapter(s)).accept(false) == !el.errored); // 5. parse with simple callback json::parser_callback_t cb = [](int, json::parse_event_t, json&) @@ -270,7 +270,7 @@ bool accept_helper(const std::string& s) return true; }; json j_cb = json::parse(s, cb, false); - const bool ok_noexcept_cb = not j_cb.is_discarded(); + const bool ok_noexcept_cb = !j_cb.is_discarded(); // 6. check if this approach came to the same result CHECK(ok_noexcept == ok_noexcept_cb); @@ -898,7 +898,7 @@ TEST_CASE("parser class") SECTION("overflow") { // overflows during parsing - CHECK(not accept_helper("1.18973e+4932")); + CHECK(!accept_helper("1.18973e+4932")); } SECTION("invalid numbers") @@ -1573,7 +1573,7 @@ TEST_CASE("parser class") { json j_filtered1 = json::parse(structured_array, [](int, json::parse_event_t e, const json & parsed) { - if (e == json::parse_event_t::object_end and parsed.contains("foo")) + if (e == json::parse_event_t::object_end && parsed.contains("foo")) { return false; } @@ -1612,7 +1612,7 @@ TEST_CASE("parser class") json j_object = json::parse(s_object, [](int, json::parse_event_t e, const json&) { static bool first = true; - if (e == json::parse_event_t::object_end and first) + if (e == json::parse_event_t::object_end && first) { first = false; return false; @@ -1631,7 +1631,7 @@ TEST_CASE("parser class") json j_array = json::parse(s_array, [](int, json::parse_event_t e, const json&) { static bool first = true; - if (e == json::parse_event_t::array_end and first) + if (e == json::parse_event_t::array_end && first) { first = false; return false; diff --git a/test/src/unit-comparison.cpp b/test/src/unit-comparison.cpp index db46507c..7b9d4c87 100644 --- a/test/src/unit-comparison.cpp +++ b/test/src/unit-comparison.cpp @@ -165,7 +165,7 @@ TEST_CASE("lexicographical comparison operators") CAPTURE(i) CAPTURE(j) // check definition - CHECK( (j_values[i] != j_values[j]) == not(j_values[i] == j_values[j]) ); + CHECK( (j_values[i] != j_values[j]) == !(j_values[i] == j_values[j]) ); } } @@ -173,8 +173,8 @@ TEST_CASE("lexicographical comparison operators") json j_null; CHECK( (j_null != nullptr) == false); CHECK( (nullptr != j_null) == false); - CHECK( (j_null != nullptr) == not(j_null == nullptr)); - CHECK( (nullptr != j_null) == not(nullptr == j_null)); + CHECK( (j_null != nullptr) == !(j_null == nullptr)); + CHECK( (nullptr != j_null) == !(nullptr == j_null)); } SECTION("comparison: less") @@ -234,7 +234,7 @@ TEST_CASE("lexicographical comparison operators") CAPTURE(i) CAPTURE(j) // check definition - CHECK( (j_values[i] <= j_values[j]) == not(j_values[j] < j_values[i]) ); + CHECK( (j_values[i] <= j_values[j]) == !(j_values[j] < j_values[i]) ); } } } @@ -262,7 +262,7 @@ TEST_CASE("lexicographical comparison operators") CAPTURE(i) CAPTURE(j) // check definition - CHECK( (j_values[i] >= j_values[j]) == not(j_values[i] < j_values[j]) ); + CHECK( (j_values[i] >= j_values[j]) == !(j_values[i] < j_values[j]) ); } } } diff --git a/test/src/unit-constructor1.cpp b/test/src/unit-constructor1.cpp index 0240feef..bacf04ee 100644 --- a/test/src/unit-constructor1.cpp +++ b/test/src/unit-constructor1.cpp @@ -847,7 +847,7 @@ TEST_CASE("constructors") // check round trip of NaN json::number_float_t d = j; - CHECK((std::isnan(d) and std::isnan(n)) == true); + CHECK((std::isnan(d) && std::isnan(n)) == true); // check that NaN is serialized to null CHECK(j.dump() == "null"); diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp index d37e8e9b..459ec0b1 100644 --- a/test/src/unit-conversions.cpp +++ b/test/src/unit-conversions.cpp @@ -272,7 +272,7 @@ TEST_CASE("value conversion") json(json::value_t::null).get>(), "[json.exception.type_error.302] type must be array, but is null"); -#if not defined(JSON_NOEXCEPTION) +#if !defined(JSON_NOEXCEPTION) SECTION("reserve is called on containers that supports it") { // make sure all values are properly copied diff --git a/test/src/unit-deserialization.cpp b/test/src/unit-deserialization.cpp index 15744b9e..8c06d543 100644 --- a/test/src/unit-deserialization.cpp +++ b/test/src/unit-deserialization.cpp @@ -289,14 +289,14 @@ TEST_CASE("deserialization") CHECK_THROWS_AS(_ = json::parse(ss1), json::parse_error&); CHECK_THROWS_WITH(_ = json::parse(ss2), "[json.exception.parse_error.101] parse error at line 1, column 29: syntax error while parsing array - unexpected end of input; expected ']'"); - CHECK(not json::accept(ss3)); + CHECK(!json::accept(ss3)); json j_error; CHECK_NOTHROW(j_error = json::parse(ss4, nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(ss5, &l)); + CHECK(!json::sax_parse(ss5, &l)); CHECK(l.events.size() == 11); CHECK(l.events == std::vector( { @@ -314,14 +314,14 @@ TEST_CASE("deserialization") CHECK_THROWS_AS(_ = json::parse(s), json::parse_error&); CHECK_THROWS_WITH(_ = json::parse(s), "[json.exception.parse_error.101] parse error at line 1, column 29: syntax error while parsing array - unexpected end of input; expected ']'"); - CHECK(not json::accept(s)); + CHECK(!json::accept(s)); json j_error; CHECK_NOTHROW(j_error = json::parse(s, nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(s, &l)); + CHECK(!json::sax_parse(s, &l)); CHECK(l.events.size() == 11); CHECK(l.events == std::vector( { @@ -450,10 +450,10 @@ TEST_CASE("deserialization") std::vector v; json _; CHECK_THROWS_AS(_ = json::parse(v), json::parse_error&); - CHECK(not json::accept(v)); + CHECK(!json::accept(v)); SaxEventLogger l; - CHECK(not json::sax_parse(v, &l)); + CHECK(!json::sax_parse(v, &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(1)"})); } @@ -538,10 +538,10 @@ TEST_CASE("deserialization") { std::vector v; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(1)"})); } @@ -554,14 +554,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 'a', 'a', 'a', 'a', 'a', 'a', '\\', 'u'}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(10)"})); } @@ -570,14 +570,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 'a', 'a', 'a', 'a', 'a', 'a', '\\', 'u', '1'}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(11)"})); } @@ -586,14 +586,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 'a', 'a', 'a', 'a', 'a', 'a', '\\', 'u', '1', '1', '1', '1', '1', '1', '1', '1'}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(18)"})); } @@ -602,14 +602,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 'a', 'a', 'a', 'a', 'a', 'a', 'u', '1', '1', '1', '1', '1', '1', '1', '1', '\\'}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(18)"})); } @@ -618,14 +618,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 0x7F, 0xC1}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(3)"})); } @@ -637,14 +637,14 @@ TEST_CASE("deserialization") CHECK_THROWS_AS(_ = json::parse(std::begin(v), std::end(v)), json::parse_error&); CHECK_THROWS_WITH(_ = json::parse(std::begin(v), std::end(v)), "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid string: ill-formed UTF-8 byte; last read: '\"\x7f\xdf\x7f'"); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(4)"})); } @@ -653,14 +653,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 0x7F, 0xDF, 0xC0}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(4)"})); } @@ -669,14 +669,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 0x7F, 0xE0, 0x9F}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(4)"})); } @@ -685,14 +685,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 0x7F, 0xEF, 0xC0}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(4)"})); } @@ -701,14 +701,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 0x7F, 0xED, 0x7F}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(4)"})); } @@ -717,14 +717,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 0x7F, 0xF0, 0x8F}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(4)"})); } @@ -733,14 +733,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 0x7F, 0xF0, 0xC0}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(4)"})); } @@ -749,14 +749,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 0x7F, 0xF3, 0x7F}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(4)"})); } @@ -765,14 +765,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 0x7F, 0xF3, 0xC0}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(4)"})); } @@ -781,14 +781,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'\"', 0x7F, 0xF4, 0x7F}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector({"parse_error(4)"})); } @@ -797,14 +797,14 @@ TEST_CASE("deserialization") { uint8_t v[] = {'{', '\"', '\"', ':', '1', '1'}; CHECK_THROWS_AS(json::parse(std::begin(v), std::end(v)), json::parse_error&); - CHECK(not json::accept(std::begin(v), std::end(v))); + CHECK(!json::accept(std::begin(v), std::end(v))); json j_error; CHECK_NOTHROW(j_error = json::parse(std::begin(v), std::end(v), nullptr, false)); CHECK(j_error.is_discarded()); SaxEventLogger l; - CHECK(not json::sax_parse(std::begin(v), std::end(v), &l)); + CHECK(!json::sax_parse(std::begin(v), std::end(v), &l)); CHECK(l.events.size() == 4); CHECK(l.events == std::vector( { @@ -831,7 +831,7 @@ TEST_CASE("deserialization") "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal"); SaxEventLogger l; - CHECK(not json::sax_parse(bom, &l)); + CHECK(!json::sax_parse(bom, &l)); CHECK(l.events.size() == 1); CHECK(l.events == std::vector( { @@ -871,8 +871,8 @@ TEST_CASE("deserialization") "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid BOM; must be 0xEF 0xBB 0xBF if given; last read: '\xEF\xBB'"); SaxEventLogger l1, l2; - CHECK(not json::sax_parse(std::istringstream(bom.substr(0, 2)), &l1)); - CHECK(not json::sax_parse(bom.substr(0, 2), &l2)); + CHECK(!json::sax_parse(std::istringstream(bom.substr(0, 2)), &l1)); + CHECK(!json::sax_parse(bom.substr(0, 2), &l2)); CHECK(l1.events.size() == 1); CHECK(l1.events == std::vector( { @@ -897,8 +897,8 @@ TEST_CASE("deserialization") "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid BOM; must be 0xEF 0xBB 0xBF if given; last read: '\xEF'"); SaxEventLogger l1, l2; - CHECK(not json::sax_parse(std::istringstream(bom.substr(0, 1)), &l1)); - CHECK(not json::sax_parse(bom.substr(0, 1), &l2)); + CHECK(!json::sax_parse(std::istringstream(bom.substr(0, 1)), &l1)); + CHECK(!json::sax_parse(bom.substr(0, 1), &l2)); CHECK(l1.events.size() == 1); CHECK(l1.events == std::vector( { @@ -931,7 +931,7 @@ TEST_CASE("deserialization") s.push_back(static_cast(bom[1] + i1)); s.push_back(static_cast(bom[2] + i2)); - if (i0 == 0 and i1 == 0 and i2 == 0) + if (i0 == 0 && i1 == 0 && i2 == 0) { // without any variation, we skip the BOM CHECK(json::parse(s + "null") == json()); @@ -953,7 +953,7 @@ TEST_CASE("deserialization") CHECK_THROWS_AS(_ = json::parse(std::istringstream(s + "null")), json::parse_error&); SaxEventLogger l; - CHECK(not json::sax_parse(s + "null", &l)); + CHECK(!json::sax_parse(s + "null", &l)); CHECK(l.events.size() == 1); if (i0 != 0) diff --git a/test/src/unit-element_access2.cpp b/test/src/unit-element_access2.cpp index e881a947..7c811b4c 100644 --- a/test/src/unit-element_access2.cpp +++ b/test/src/unit-element_access2.cpp @@ -1072,7 +1072,7 @@ TEST_CASE("element access 2") } } -#if not defined(JSON_NOEXCEPTION) +#if !defined(JSON_NOEXCEPTION) TEST_CASE("element access 2 (throwing tests)") { SECTION("object") diff --git a/test/src/unit-inspection.cpp b/test/src/unit-inspection.cpp index a5f4519b..10037327 100644 --- a/test/src/unit-inspection.cpp +++ b/test/src/unit-inspection.cpp @@ -43,36 +43,36 @@ TEST_CASE("object inspection") SECTION("object") { json j {{"foo", 1}, {"bar", false}}; - CHECK(not j.is_null()); - CHECK(not j.is_boolean()); - CHECK(not j.is_number()); - CHECK(not j.is_number_integer()); - CHECK(not j.is_number_unsigned()); - CHECK(not j.is_number_float()); - CHECK(not j.is_binary()); + CHECK(!j.is_null()); + CHECK(!j.is_boolean()); + CHECK(!j.is_number()); + CHECK(!j.is_number_integer()); + CHECK(!j.is_number_unsigned()); + CHECK(!j.is_number_float()); + CHECK(!j.is_binary()); CHECK(j.is_object()); - CHECK(not j.is_array()); - CHECK(not j.is_string()); - CHECK(not j.is_discarded()); - CHECK(not j.is_primitive()); + CHECK(!j.is_array()); + CHECK(!j.is_string()); + CHECK(!j.is_discarded()); + CHECK(!j.is_primitive()); CHECK(j.is_structured()); } SECTION("array") { json j {"foo", 1, 1u, 42.23, false}; - CHECK(not j.is_null()); - CHECK(not j.is_boolean()); - CHECK(not j.is_number()); - CHECK(not j.is_number_integer()); - CHECK(not j.is_number_unsigned()); - CHECK(not j.is_number_float()); - CHECK(not j.is_binary()); - CHECK(not j.is_object()); + CHECK(!j.is_null()); + CHECK(!j.is_boolean()); + CHECK(!j.is_number()); + CHECK(!j.is_number_integer()); + CHECK(!j.is_number_unsigned()); + CHECK(!j.is_number_float()); + CHECK(!j.is_binary()); + CHECK(!j.is_object()); CHECK(j.is_array()); - CHECK(not j.is_string()); - CHECK(not j.is_discarded()); - CHECK(not j.is_primitive()); + CHECK(!j.is_string()); + CHECK(!j.is_discarded()); + CHECK(!j.is_primitive()); CHECK(j.is_structured()); } @@ -80,144 +80,144 @@ TEST_CASE("object inspection") { json j(nullptr); CHECK(j.is_null()); - CHECK(not j.is_boolean()); - CHECK(not j.is_number()); - CHECK(not j.is_number_integer()); - CHECK(not j.is_number_unsigned()); - CHECK(not j.is_number_float()); - CHECK(not j.is_binary()); - CHECK(not j.is_object()); - CHECK(not j.is_array()); - CHECK(not j.is_string()); - CHECK(not j.is_discarded()); + CHECK(!j.is_boolean()); + CHECK(!j.is_number()); + CHECK(!j.is_number_integer()); + CHECK(!j.is_number_unsigned()); + CHECK(!j.is_number_float()); + CHECK(!j.is_binary()); + CHECK(!j.is_object()); + CHECK(!j.is_array()); + CHECK(!j.is_string()); + CHECK(!j.is_discarded()); CHECK(j.is_primitive()); - CHECK(not j.is_structured()); + CHECK(!j.is_structured()); } SECTION("boolean") { json j(true); - CHECK(not j.is_null()); + CHECK(!j.is_null()); CHECK(j.is_boolean()); - CHECK(not j.is_number()); - CHECK(not j.is_number_integer()); - CHECK(not j.is_number_unsigned()); - CHECK(not j.is_number_float()); - CHECK(not j.is_binary()); - CHECK(not j.is_object()); - CHECK(not j.is_array()); - CHECK(not j.is_string()); - CHECK(not j.is_discarded()); + CHECK(!j.is_number()); + CHECK(!j.is_number_integer()); + CHECK(!j.is_number_unsigned()); + CHECK(!j.is_number_float()); + CHECK(!j.is_binary()); + CHECK(!j.is_object()); + CHECK(!j.is_array()); + CHECK(!j.is_string()); + CHECK(!j.is_discarded()); CHECK(j.is_primitive()); - CHECK(not j.is_structured()); + CHECK(!j.is_structured()); } SECTION("string") { json j("Hello world"); - CHECK(not j.is_null()); - CHECK(not j.is_boolean()); - CHECK(not j.is_number()); - CHECK(not j.is_number_integer()); - CHECK(not j.is_number_unsigned()); - CHECK(not j.is_number_float()); - CHECK(not j.is_binary()); - CHECK(not j.is_object()); - CHECK(not j.is_array()); + CHECK(!j.is_null()); + CHECK(!j.is_boolean()); + CHECK(!j.is_number()); + CHECK(!j.is_number_integer()); + CHECK(!j.is_number_unsigned()); + CHECK(!j.is_number_float()); + CHECK(!j.is_binary()); + CHECK(!j.is_object()); + CHECK(!j.is_array()); CHECK(j.is_string()); - CHECK(not j.is_discarded()); + CHECK(!j.is_discarded()); CHECK(j.is_primitive()); - CHECK(not j.is_structured()); + CHECK(!j.is_structured()); } SECTION("number (integer)") { json j(42); - CHECK(not j.is_null()); - CHECK(not j.is_boolean()); + CHECK(!j.is_null()); + CHECK(!j.is_boolean()); CHECK(j.is_number()); CHECK(j.is_number_integer()); - CHECK(not j.is_number_unsigned()); - CHECK(not j.is_number_float()); - CHECK(not j.is_binary()); - CHECK(not j.is_object()); - CHECK(not j.is_array()); - CHECK(not j.is_string()); - CHECK(not j.is_discarded()); + CHECK(!j.is_number_unsigned()); + CHECK(!j.is_number_float()); + CHECK(!j.is_binary()); + CHECK(!j.is_object()); + CHECK(!j.is_array()); + CHECK(!j.is_string()); + CHECK(!j.is_discarded()); CHECK(j.is_primitive()); - CHECK(not j.is_structured()); + CHECK(!j.is_structured()); } SECTION("number (unsigned)") { json j(42u); - CHECK(not j.is_null()); - CHECK(not j.is_boolean()); + CHECK(!j.is_null()); + CHECK(!j.is_boolean()); CHECK(j.is_number()); CHECK(j.is_number_integer()); CHECK(j.is_number_unsigned()); - CHECK(not j.is_number_float()); - CHECK(not j.is_binary()); - CHECK(not j.is_object()); - CHECK(not j.is_array()); - CHECK(not j.is_string()); - CHECK(not j.is_discarded()); + CHECK(!j.is_number_float()); + CHECK(!j.is_binary()); + CHECK(!j.is_object()); + CHECK(!j.is_array()); + CHECK(!j.is_string()); + CHECK(!j.is_discarded()); CHECK(j.is_primitive()); - CHECK(not j.is_structured()); + CHECK(!j.is_structured()); } SECTION("number (floating-point)") { json j(42.23); - CHECK(not j.is_null()); - CHECK(not j.is_boolean()); + CHECK(!j.is_null()); + CHECK(!j.is_boolean()); CHECK(j.is_number()); - CHECK(not j.is_number_integer()); - CHECK(not j.is_number_unsigned()); + CHECK(!j.is_number_integer()); + CHECK(!j.is_number_unsigned()); CHECK(j.is_number_float()); - CHECK(not j.is_binary()); - CHECK(not j.is_object()); - CHECK(not j.is_array()); - CHECK(not j.is_string()); - CHECK(not j.is_discarded()); + CHECK(!j.is_binary()); + CHECK(!j.is_object()); + CHECK(!j.is_array()); + CHECK(!j.is_string()); + CHECK(!j.is_discarded()); CHECK(j.is_primitive()); - CHECK(not j.is_structured()); + CHECK(!j.is_structured()); } SECTION("binary") { json j(json::value_t::binary); - CHECK(not j.is_null()); - CHECK(not j.is_boolean()); - CHECK(not j.is_number()); - CHECK(not j.is_number_integer()); - CHECK(not j.is_number_unsigned()); - CHECK(not j.is_number_float()); + CHECK(!j.is_null()); + CHECK(!j.is_boolean()); + CHECK(!j.is_number()); + CHECK(!j.is_number_integer()); + CHECK(!j.is_number_unsigned()); + CHECK(!j.is_number_float()); CHECK(j.is_binary()); - CHECK(not j.is_object()); - CHECK(not j.is_array()); - CHECK(not j.is_string()); - CHECK(not j.is_discarded()); + CHECK(!j.is_object()); + CHECK(!j.is_array()); + CHECK(!j.is_string()); + CHECK(!j.is_discarded()); CHECK(j.is_primitive()); - CHECK(not j.is_structured()); + CHECK(!j.is_structured()); } SECTION("discarded") { json j(json::value_t::discarded); - CHECK(not j.is_null()); - CHECK(not j.is_boolean()); - CHECK(not j.is_number()); - CHECK(not j.is_number_integer()); - CHECK(not j.is_number_unsigned()); - CHECK(not j.is_number_float()); - CHECK(not j.is_binary()); - CHECK(not j.is_object()); - CHECK(not j.is_array()); - CHECK(not j.is_string()); + CHECK(!j.is_null()); + CHECK(!j.is_boolean()); + CHECK(!j.is_number()); + CHECK(!j.is_number_integer()); + CHECK(!j.is_number_unsigned()); + CHECK(!j.is_number_float()); + CHECK(!j.is_binary()); + CHECK(!j.is_object()); + CHECK(!j.is_array()); + CHECK(!j.is_string()); CHECK(j.is_discarded()); - CHECK(not j.is_primitive()); - CHECK(not j.is_structured()); + CHECK(!j.is_primitive()); + CHECK(!j.is_structured()); } } diff --git a/test/src/unit-iterators1.cpp b/test/src/unit-iterators1.cpp index cbdc0d45..7d5c9bf9 100644 --- a/test/src/unit-iterators1.cpp +++ b/test/src/unit-iterators1.cpp @@ -231,12 +231,12 @@ TEST_CASE("iterators 1") { SECTION("!(begin != begin)") { - CHECK(not(j.begin() != j.begin())); + CHECK(!(j.begin() != j.begin())); } SECTION("!(end != end)") { - CHECK(not(j.end() != j.end())); + CHECK(!(j.end() != j.end())); } SECTION("begin < end") @@ -286,7 +286,7 @@ TEST_CASE("iterators 1") SECTION("!(begin == end)") { - CHECK(not(j.begin() == j.end())); + CHECK(!(j.begin() == j.end())); } SECTION("begin != end") diff --git a/test/src/unit-iterators2.cpp b/test/src/unit-iterators2.cpp index 0e3902b8..4759b5d2 100644 --- a/test/src/unit-iterators2.cpp +++ b/test/src/unit-iterators2.cpp @@ -56,26 +56,26 @@ TEST_CASE("iterators 2") // comparison: equal { CHECK(it1 == it1); - CHECK(not (it1 == it2)); - CHECK(not (it1 == it3)); - CHECK(not (it2 == it3)); + CHECK(!(it1 == it2)); + CHECK(!(it1 == it3)); + CHECK(!(it2 == it3)); CHECK(it1_c == it1_c); - CHECK(not (it1_c == it2_c)); - CHECK(not (it1_c == it3_c)); - CHECK(not (it2_c == it3_c)); + CHECK(!(it1_c == it2_c)); + CHECK(!(it1_c == it3_c)); + CHECK(!(it2_c == it3_c)); } // comparison: not equal { // check definition - CHECK( (it1 != it1) == not(it1 == it1) ); - CHECK( (it1 != it2) == not(it1 == it2) ); - CHECK( (it1 != it3) == not(it1 == it3) ); - CHECK( (it2 != it3) == not(it2 == it3) ); - CHECK( (it1_c != it1_c) == not(it1_c == it1_c) ); - CHECK( (it1_c != it2_c) == not(it1_c == it2_c) ); - CHECK( (it1_c != it3_c) == not(it1_c == it3_c) ); - CHECK( (it2_c != it3_c) == not(it2_c == it3_c) ); + CHECK( (it1 != it1) == !(it1 == it1) ); + CHECK( (it1 != it2) == !(it1 == it2) ); + CHECK( (it1 != it3) == !(it1 == it3) ); + CHECK( (it2 != it3) == !(it2 == it3) ); + CHECK( (it1_c != it1_c) == !(it1_c == it1_c) ); + CHECK( (it1_c != it2_c) == !(it1_c == it2_c) ); + CHECK( (it1_c != it3_c) == !(it1_c == it3_c) ); + CHECK( (it2_c != it3_c) == !(it2_c == it3_c) ); } // comparison: smaller @@ -101,11 +101,11 @@ TEST_CASE("iterators 2") } else { - CHECK(not (it1 < it1)); + CHECK(!(it1 < it1)); CHECK(it1 < it2); CHECK(it1 < it3); CHECK(it2 < it3); - CHECK(not (it1_c < it1_c)); + CHECK(!(it1_c < it1_c)); CHECK(it1_c < it2_c); CHECK(it1_c < it3_c); CHECK(it2_c < it3_c); @@ -136,14 +136,14 @@ TEST_CASE("iterators 2") else { // check definition - CHECK( (it1 <= it1) == not(it1 < it1) ); - CHECK( (it1 <= it2) == not(it2 < it1) ); - CHECK( (it1 <= it3) == not(it3 < it1) ); - CHECK( (it2 <= it3) == not(it3 < it2) ); - CHECK( (it1_c <= it1_c) == not(it1_c < it1_c) ); - CHECK( (it1_c <= it2_c) == not(it2_c < it1_c) ); - CHECK( (it1_c <= it3_c) == not(it3_c < it1_c) ); - CHECK( (it2_c <= it3_c) == not(it3_c < it2_c) ); + CHECK( (it1 <= it1) == !(it1 < it1) ); + CHECK( (it1 <= it2) == !(it2 < it1) ); + CHECK( (it1 <= it3) == !(it3 < it1) ); + CHECK( (it2 <= it3) == !(it3 < it2) ); + CHECK( (it1_c <= it1_c) == !(it1_c < it1_c) ); + CHECK( (it1_c <= it2_c) == !(it2_c < it1_c) ); + CHECK( (it1_c <= it3_c) == !(it3_c < it1_c) ); + CHECK( (it2_c <= it3_c) == !(it3_c < it2_c) ); } } @@ -206,14 +206,14 @@ TEST_CASE("iterators 2") else { // check definition - CHECK( (it1 >= it1) == not(it1 < it1) ); - CHECK( (it1 >= it2) == not(it1 < it2) ); - CHECK( (it1 >= it3) == not(it1 < it3) ); - CHECK( (it2 >= it3) == not(it2 < it3) ); - CHECK( (it1_c >= it1_c) == not(it1_c < it1_c) ); - CHECK( (it1_c >= it2_c) == not(it1_c < it2_c) ); - CHECK( (it1_c >= it3_c) == not(it1_c < it3_c) ); - CHECK( (it2_c >= it3_c) == not(it2_c < it3_c) ); + CHECK( (it1 >= it1) == !(it1 < it1) ); + CHECK( (it1 >= it2) == !(it1 < it2) ); + CHECK( (it1 >= it3) == !(it1 < it3) ); + CHECK( (it2 >= it3) == !(it2 < it3) ); + CHECK( (it1_c >= it1_c) == !(it1_c < it1_c) ); + CHECK( (it1_c >= it2_c) == !(it1_c < it2_c) ); + CHECK( (it1_c >= it3_c) == !(it1_c < it3_c) ); + CHECK( (it2_c >= it3_c) == !(it2_c < it3_c) ); } } } @@ -491,26 +491,26 @@ TEST_CASE("iterators 2") // comparison: equal { CHECK(it1 == it1); - CHECK(not (it1 == it2)); - CHECK(not (it1 == it3)); - CHECK(not (it2 == it3)); + CHECK(!(it1 == it2)); + CHECK(!(it1 == it3)); + CHECK(!(it2 == it3)); CHECK(it1_c == it1_c); - CHECK(not (it1_c == it2_c)); - CHECK(not (it1_c == it3_c)); - CHECK(not (it2_c == it3_c)); + CHECK(!(it1_c == it2_c)); + CHECK(!(it1_c == it3_c)); + CHECK(!(it2_c == it3_c)); } // comparison: not equal { // check definition - CHECK( (it1 != it1) == not(it1 == it1) ); - CHECK( (it1 != it2) == not(it1 == it2) ); - CHECK( (it1 != it3) == not(it1 == it3) ); - CHECK( (it2 != it3) == not(it2 == it3) ); - CHECK( (it1_c != it1_c) == not(it1_c == it1_c) ); - CHECK( (it1_c != it2_c) == not(it1_c == it2_c) ); - CHECK( (it1_c != it3_c) == not(it1_c == it3_c) ); - CHECK( (it2_c != it3_c) == not(it2_c == it3_c) ); + CHECK( (it1 != it1) == !(it1 == it1) ); + CHECK( (it1 != it2) == !(it1 == it2) ); + CHECK( (it1 != it3) == !(it1 == it3) ); + CHECK( (it2 != it3) == !(it2 == it3) ); + CHECK( (it1_c != it1_c) == !(it1_c == it1_c) ); + CHECK( (it1_c != it2_c) == !(it1_c == it2_c) ); + CHECK( (it1_c != it3_c) == !(it1_c == it3_c) ); + CHECK( (it2_c != it3_c) == !(it2_c == it3_c) ); } // comparison: smaller @@ -536,11 +536,11 @@ TEST_CASE("iterators 2") } else { - CHECK(not (it1 < it1)); + CHECK(!(it1 < it1)); CHECK(it1 < it2); CHECK(it1 < it3); CHECK(it2 < it3); - CHECK(not (it1_c < it1_c)); + CHECK(!(it1_c < it1_c)); CHECK(it1_c < it2_c); CHECK(it1_c < it3_c); CHECK(it2_c < it3_c); @@ -571,14 +571,14 @@ TEST_CASE("iterators 2") else { // check definition - CHECK( (it1 <= it1) == not(it1 < it1) ); - CHECK( (it1 <= it2) == not(it2 < it1) ); - CHECK( (it1 <= it3) == not(it3 < it1) ); - CHECK( (it2 <= it3) == not(it3 < it2) ); - CHECK( (it1_c <= it1_c) == not(it1_c < it1_c) ); - CHECK( (it1_c <= it2_c) == not(it2_c < it1_c) ); - CHECK( (it1_c <= it3_c) == not(it3_c < it1_c) ); - CHECK( (it2_c <= it3_c) == not(it3_c < it2_c) ); + CHECK( (it1 <= it1) == !(it1 < it1) ); + CHECK( (it1 <= it2) == !(it2 < it1) ); + CHECK( (it1 <= it3) == !(it3 < it1) ); + CHECK( (it2 <= it3) == !(it3 < it2) ); + CHECK( (it1_c <= it1_c) == !(it1_c < it1_c) ); + CHECK( (it1_c <= it2_c) == !(it2_c < it1_c) ); + CHECK( (it1_c <= it3_c) == !(it3_c < it1_c) ); + CHECK( (it2_c <= it3_c) == !(it3_c < it2_c) ); } } @@ -641,14 +641,14 @@ TEST_CASE("iterators 2") else { // check definition - CHECK( (it1 >= it1) == not(it1 < it1) ); - CHECK( (it1 >= it2) == not(it1 < it2) ); - CHECK( (it1 >= it3) == not(it1 < it3) ); - CHECK( (it2 >= it3) == not(it2 < it3) ); - CHECK( (it1_c >= it1_c) == not(it1_c < it1_c) ); - CHECK( (it1_c >= it2_c) == not(it1_c < it2_c) ); - CHECK( (it1_c >= it3_c) == not(it1_c < it3_c) ); - CHECK( (it2_c >= it3_c) == not(it2_c < it3_c) ); + CHECK( (it1 >= it1) == !(it1 < it1) ); + CHECK( (it1 >= it2) == !(it1 < it2) ); + CHECK( (it1 >= it3) == !(it1 < it3) ); + CHECK( (it2 >= it3) == !(it2 < it3) ); + CHECK( (it1_c >= it1_c) == !(it1_c < it1_c) ); + CHECK( (it1_c >= it2_c) == !(it1_c < it2_c) ); + CHECK( (it1_c >= it3_c) == !(it1_c < it3_c) ); + CHECK( (it2_c >= it3_c) == !(it2_c < it3_c) ); } } } diff --git a/test/src/unit-json_pointer.cpp b/test/src/unit-json_pointer.cpp index 1e68bc83..44c9afa6 100644 --- a/test/src/unit-json_pointer.cpp +++ b/test/src/unit-json_pointer.cpp @@ -101,10 +101,10 @@ TEST_CASE("JSON pointers") CHECK(j["/foo/1"_json_pointer] == j["foo"][1]); CHECK(j.contains(json::json_pointer("/foo/0"))); CHECK(j.contains(json::json_pointer("/foo/1"))); - CHECK(not j.contains(json::json_pointer("/foo/3"))); - CHECK(not j.contains(json::json_pointer("/foo/+"))); - CHECK(not j.contains(json::json_pointer("/foo/1+2"))); - CHECK(not j.contains(json::json_pointer("/foo/-"))); + CHECK(!j.contains(json::json_pointer("/foo/3"))); + CHECK(!j.contains(json::json_pointer("/foo/+"))); + CHECK(!j.contains(json::json_pointer("/foo/1+2"))); + CHECK(!j.contains(json::json_pointer("/foo/-"))); // checked array access CHECK(j.at(json::json_pointer("/foo/0")) == j["foo"][0]); @@ -147,19 +147,19 @@ TEST_CASE("JSON pointers") // unescaped access // access to nonexisting values yield object creation - CHECK(not j.contains(json::json_pointer("/a/b"))); + CHECK(!j.contains(json::json_pointer("/a/b"))); CHECK_NOTHROW(j[json::json_pointer("/a/b")] = 42); CHECK(j.contains(json::json_pointer("/a/b"))); CHECK(j["a"]["b"] == json(42)); - CHECK(not j.contains(json::json_pointer("/a/c/1"))); + CHECK(!j.contains(json::json_pointer("/a/c/1"))); CHECK_NOTHROW(j[json::json_pointer("/a/c/1")] = 42); CHECK(j["a"]["c"] == json({nullptr, 42})); CHECK(j.contains(json::json_pointer("/a/c/1"))); - CHECK(not j.contains(json::json_pointer("/a/d/-"))); + CHECK(!j.contains(json::json_pointer("/a/d/-"))); CHECK_NOTHROW(j[json::json_pointer("/a/d/-")] = 42); - CHECK(not j.contains(json::json_pointer("/a/d/-"))); + CHECK(!j.contains(json::json_pointer("/a/d/-"))); CHECK(j["a"]["d"] == json::array({42})); // "/a/b" works for JSON {"a": {"b": 42}} CHECK(json({{"a", {{"b", 42}}}})[json::json_pointer("/a/b")] == json(42)); @@ -172,7 +172,7 @@ TEST_CASE("JSON pointers") CHECK_THROWS_AS(j_primitive.at("/foo"_json_pointer), json::out_of_range&); CHECK_THROWS_WITH(j_primitive.at("/foo"_json_pointer), "[json.exception.out_of_range.404] unresolved reference token 'foo'"); - CHECK(not j_primitive.contains(json::json_pointer("/foo"))); + CHECK(!j_primitive.contains(json::json_pointer("/foo"))); } SECTION("const access") @@ -272,7 +272,7 @@ TEST_CASE("JSON pointers") CHECK(j.contains("/foo"_json_pointer)); CHECK(j.contains("/foo/0"_json_pointer)); CHECK(j.contains("/foo/1"_json_pointer)); - CHECK(not j.contains("/foo/-"_json_pointer)); + CHECK(!j.contains("/foo/-"_json_pointer)); } } @@ -314,10 +314,10 @@ TEST_CASE("JSON pointers") CHECK_THROWS_WITH(j_const.at("/01"_json_pointer), "[json.exception.parse_error.106] parse error: array index '01' must not begin with '0'"); - CHECK(not j.contains("/01"_json_pointer)); - CHECK(not j.contains("/01"_json_pointer)); - CHECK(not j_const.contains("/01"_json_pointer)); - CHECK(not j_const.contains("/01"_json_pointer)); + CHECK(!j.contains("/01"_json_pointer)); + CHECK(!j.contains("/01"_json_pointer)); + CHECK(!j_const.contains("/01"_json_pointer)); + CHECK(!j_const.contains("/01"_json_pointer)); // error with incorrect numbers CHECK_THROWS_AS(j["/one"_json_pointer] = 1, json::parse_error&); @@ -362,10 +362,10 @@ TEST_CASE("JSON pointers") CHECK_THROWS_WITH(j_const.at("/one"_json_pointer) == 1, "[json.exception.parse_error.109] parse error: array index 'one' is not a number"); - CHECK(not j.contains("/one"_json_pointer)); - CHECK(not j.contains("/one"_json_pointer)); - CHECK(not j_const.contains("/one"_json_pointer)); - CHECK(not j_const.contains("/one"_json_pointer)); + CHECK(!j.contains("/one"_json_pointer)); + CHECK(!j.contains("/one"_json_pointer)); + CHECK(!j_const.contains("/one"_json_pointer)); + CHECK(!j_const.contains("/one"_json_pointer)); CHECK_THROWS_AS(json({{"/list/0", 1}, {"/list/1", 2}, {"/list/three", 3}}).unflatten(), json::parse_error&); CHECK_THROWS_WITH(json({{"/list/0", 1}, {"/list/1", 2}, {"/list/three", 3}}).unflatten(), @@ -379,7 +379,7 @@ TEST_CASE("JSON pointers") CHECK_THROWS_AS(j_const["/-"_json_pointer], json::out_of_range&); CHECK_THROWS_WITH(j_const["/-"_json_pointer], "[json.exception.out_of_range.402] array index '-' (3) is out of range"); - CHECK(not j_const.contains("/-"_json_pointer)); + CHECK(!j_const.contains("/-"_json_pointer)); // error when using "-" with at CHECK_THROWS_AS(j.at("/-"_json_pointer), json::out_of_range&); @@ -388,7 +388,7 @@ TEST_CASE("JSON pointers") CHECK_THROWS_AS(j_const.at("/-"_json_pointer), json::out_of_range&); CHECK_THROWS_WITH(j_const.at("/-"_json_pointer), "[json.exception.out_of_range.402] array index '-' (3) is out of range"); - CHECK(not j_const.contains("/-"_json_pointer)); + CHECK(!j_const.contains("/-"_json_pointer)); } SECTION("const access") @@ -404,13 +404,13 @@ TEST_CASE("JSON pointers") CHECK_THROWS_AS(j.at("/3"_json_pointer), json::out_of_range&); CHECK_THROWS_WITH(j.at("/3"_json_pointer), "[json.exception.out_of_range.401] array index 3 is out of range"); - CHECK(not j.contains("/3"_json_pointer)); + CHECK(!j.contains("/3"_json_pointer)); // assign to nonexisting index (with gap) CHECK_THROWS_AS(j.at("/5"_json_pointer), json::out_of_range&); CHECK_THROWS_WITH(j.at("/5"_json_pointer), "[json.exception.out_of_range.401] array index 5 is out of range"); - CHECK(not j.contains("/5"_json_pointer)); + CHECK(!j.contains("/5"_json_pointer)); // assign to "-" CHECK_THROWS_AS(j["/-"_json_pointer], json::out_of_range&); @@ -419,7 +419,7 @@ TEST_CASE("JSON pointers") CHECK_THROWS_AS(j.at("/-"_json_pointer), json::out_of_range&); CHECK_THROWS_WITH(j.at("/-"_json_pointer), "[json.exception.out_of_range.402] array index '-' (3) is out of range"); - CHECK(not j.contains("/-"_json_pointer)); + CHECK(!j.contains("/-"_json_pointer)); } } diff --git a/test/src/unit-modifiers.cpp b/test/src/unit-modifiers.cpp index 9214c608..0a2918d0 100644 --- a/test/src/unit-modifiers.cpp +++ b/test/src/unit-modifiers.cpp @@ -114,7 +114,7 @@ TEST_CASE("modifiers") json k = j; j.clear(); - CHECK(not j.empty()); + CHECK(!j.empty()); CHECK(j == json(json::value_t::binary)); CHECK(j == json(k.type())); } @@ -125,7 +125,7 @@ TEST_CASE("modifiers") json k = j; j.clear(); - CHECK(not j.empty()); + CHECK(!j.empty()); CHECK(j == json(json::value_t::binary)); CHECK(j == json(k.type())); } diff --git a/test/src/unit-msgpack.cpp b/test/src/unit-msgpack.cpp index 2fb89533..56b60dfe 100644 --- a/test/src/unit-msgpack.cpp +++ b/test/src/unit-msgpack.cpp @@ -1544,21 +1544,21 @@ TEST_CASE("MessagePack") { std::vector v = {0x93, 0x01, 0x02, 0x03}; SaxCountdown scp(0); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::msgpack)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::msgpack)); } SECTION("start_object(len)") { std::vector v = {0x81, 0xa3, 0x66, 0x6F, 0x6F, 0xc2}; SaxCountdown scp(0); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::msgpack)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::msgpack)); } SECTION("key()") { std::vector v = {0x81, 0xa3, 0x66, 0x6F, 0x6F, 0xc2}; SaxCountdown scp(1); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::msgpack)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::msgpack)); } } } diff --git a/test/src/unit-noexcept.cpp b/test/src/unit-noexcept.cpp index 6952c0ee..cce49edb 100644 --- a/test/src/unit-noexcept.cpp +++ b/test/src/unit-noexcept.cpp @@ -59,12 +59,12 @@ static_assert(noexcept(nlohmann::to_json(*j, 2.5)), ""); static_assert(noexcept(nlohmann::to_json(*j, true)), ""); static_assert(noexcept(nlohmann::to_json(*j, test{})), ""); static_assert(noexcept(nlohmann::to_json(*j, pod{})), ""); -static_assert(not noexcept(nlohmann::to_json(*j, pod_bis{})), ""); +static_assert(!noexcept(nlohmann::to_json(*j, pod_bis{})), ""); static_assert(noexcept(json(2)), ""); static_assert(noexcept(json(test{})), ""); static_assert(noexcept(json(pod{})), ""); static_assert(noexcept(j->get()), ""); -static_assert(not noexcept(j->get()), ""); +static_assert(!noexcept(j->get()), ""); static_assert(noexcept(json(pod{})), ""); } diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp index 8803ac90..76927b71 100644 --- a/test/src/unit-regression.cpp +++ b/test/src/unit-regression.cpp @@ -254,12 +254,12 @@ TEST_CASE("regression tests") json j1 = INFINITY; CHECK(j1.is_number_float()); json::number_float_t f1 = j1; - CHECK(not std::isfinite(f1)); + CHECK(!std::isfinite(f1)); json j2 = json::number_float_t(INFINITY); CHECK(j2.is_number_float()); json::number_float_t f2 = j2; - CHECK(not std::isfinite(f2)); + CHECK(!std::isfinite(f2)); } } @@ -1350,10 +1350,10 @@ TEST_CASE("regression tests") CHECK(j["a"] > 3); - CHECK(not(j["a"] <= 4)); - CHECK(not(j["a"] < 4)); - CHECK(not(j["a"] >= 6)); - CHECK(not(j["a"] > 6)); + CHECK(!(j["a"] <= 4)); + CHECK(!(j["a"] < 4)); + CHECK(!(j["a"] >= 6)); + CHECK(!(j["a"] > 6)); // scalar op json CHECK(5 == j["a"]); @@ -1364,10 +1364,10 @@ TEST_CASE("regression tests") CHECK(3 <= j["a"]); CHECK(3 < j["a"]); - CHECK(not(4 >= j["a"])); - CHECK(not(4 > j["a"])); - CHECK(not(6 <= j["a"])); - CHECK(not(6 < j["a"])); + CHECK(!(4 >= j["a"])); + CHECK(!(4 > j["a"])); + CHECK(!(6 <= j["a"])); + CHECK(!(6 < j["a"])); } SECTION("issue #575 - heap-buffer-overflow (OSS-Fuzz 1400)") @@ -1608,7 +1608,7 @@ TEST_CASE("regression tests") json::parser_callback_t cb = [](int /*depth*/, json::parse_event_t event, json & parsed) { // skip object elements with key "Thumbnail" - if (event == json::parse_event_t::key and parsed == json("Thumbnail")) + if (event == json::parse_event_t::key && parsed == json("Thumbnail")) { return false; } @@ -1680,7 +1680,7 @@ TEST_CASE("regression tests") json::parser_callback_t cb = [&](int, json::parse_event_t event, json & parsed) { // skip uninteresting events - if (event == json::parse_event_t::value and !parsed.is_primitive()) + if (event == json::parse_event_t::value && !parsed.is_primitive()) { return false; } @@ -1760,7 +1760,7 @@ TEST_CASE("regression tests") SECTION("issue #1292 - Serializing std::variant causes stack overflow") { static_assert( - not std::is_constructible>::value, ""); + !std::is_constructible>::value, ""); } #endif @@ -1947,7 +1947,7 @@ TEST_CASE("regression tests") } } -#if not defined(JSON_NOEXCEPTION) +#if !defined(JSON_NOEXCEPTION) TEST_CASE("regression tests, exceptions dependent") { SECTION("issue #1340 - eof not set on exhausted input stream") diff --git a/test/src/unit-testsuites.cpp b/test/src/unit-testsuites.cpp index 41ba349a..6888df1f 100644 --- a/test/src/unit-testsuites.cpp +++ b/test/src/unit-testsuites.cpp @@ -1235,7 +1235,7 @@ TEST_CASE("nst's JSONTestSuite (2)") json _; CHECK_THROWS_AS(_ = json::parse(f), json::parse_error&); std::ifstream f2(filename); - CHECK(not json::accept(f2)); + CHECK(!json::accept(f2)); } } @@ -1250,7 +1250,7 @@ TEST_CASE("nst's JSONTestSuite (2)") { CAPTURE(filename) std::ifstream f(filename); - CHECK(not json::accept(f)); + CHECK(!json::accept(f)); } } @@ -1352,7 +1352,7 @@ TEST_CASE("nst's JSONTestSuite (2)") json _; CHECK_THROWS_AS(_ = json::parse(f), json::exception&); // could be parse_error or out_of_range std::ifstream f2(filename); - CHECK(not json::accept(f2)); + CHECK(!json::accept(f2)); } } } diff --git a/test/src/unit-ubjson.cpp b/test/src/unit-ubjson.cpp index d6dde7ad..16f22d08 100644 --- a/test/src/unit-ubjson.cpp +++ b/test/src/unit-ubjson.cpp @@ -1586,42 +1586,42 @@ TEST_CASE("UBJSON") { std::vector v = {'[', 'T', 'F', ']'}; SaxCountdown scp(0); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::ubjson)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::ubjson)); } SECTION("start_object()") { std::vector v = {'{', 'i', 3, 'f', 'o', 'o', 'F', '}'}; SaxCountdown scp(0); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::ubjson)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::ubjson)); } SECTION("key() in object") { std::vector v = {'{', 'i', 3, 'f', 'o', 'o', 'F', '}'}; SaxCountdown scp(1); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::ubjson)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::ubjson)); } SECTION("start_array(len)") { std::vector v = {'[', '#', 'i', '2', 'T', 'F'}; SaxCountdown scp(0); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::ubjson)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::ubjson)); } SECTION("start_object(len)") { std::vector v = {'{', '#', 'i', '1', 3, 'f', 'o', 'o', 'F'}; SaxCountdown scp(0); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::ubjson)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::ubjson)); } SECTION("key() in object with length") { std::vector v = {'{', 'i', 3, 'f', 'o', 'o', 'F', '}'}; SaxCountdown scp(1); - CHECK(not json::sax_parse(v, &scp, json::input_format_t::ubjson)); + CHECK(!json::sax_parse(v, &scp, json::input_format_t::ubjson)); } } @@ -2363,7 +2363,7 @@ TEST_CASE("Universal Binary JSON Specification Examples 1") } } -#if not defined(JSON_NOEXCEPTION) +#if !defined(JSON_NOEXCEPTION) TEST_CASE("all UBJSON first bytes") { // these bytes will fail immediately with exception parse_error.112 diff --git a/test/src/unit-udt.cpp b/test/src/unit-udt.cpp index 2040899e..038914bc 100644 --- a/test/src/unit-udt.cpp +++ b/test/src/unit-udt.cpp @@ -551,7 +551,7 @@ struct pod_serializer template < typename BasicJsonType, typename U = T, typename std::enable_if < - not(std::is_pod::value and std::is_class::value), int >::type = 0 > + !(std::is_pod::value && std::is_class::value), int >::type = 0 > static void from_json(const BasicJsonType& j, U& t) { using nlohmann::from_json; @@ -559,9 +559,9 @@ struct pod_serializer } // special behaviour for pods - template ::value and std::is_class::value, int>::type = 0> + template < typename BasicJsonType, typename U = T, + typename std::enable_if < + std::is_pod::value && std::is_class::value, int >::type = 0 > static void from_json(const BasicJsonType& j, U& t) { std::uint64_t value; @@ -587,16 +587,16 @@ struct pod_serializer template < typename BasicJsonType, typename U = T, typename std::enable_if < - not(std::is_pod::value and std::is_class::value), int >::type = 0 > + !(std::is_pod::value && std::is_class::value), int >::type = 0 > static void to_json(BasicJsonType& j, const T& t) { using nlohmann::to_json; to_json(j, t); } - template ::value and std::is_class::value, int>::type = 0> + template < typename BasicJsonType, typename U = T, + typename std::enable_if < + std::is_pod::value && std::is_class::value, int >::type = 0 > static void to_json(BasicJsonType& j, const T& t) noexcept { auto bytes = static_cast< const unsigned char*>(static_cast(&t)); @@ -805,7 +805,7 @@ struct is_constructible_patched())))> : st TEST_CASE("an incomplete type does not trigger a compiler error in non-evaluated context" * doctest::test_suite("udt")) { - static_assert(not is_constructible_patched::value, ""); + static_assert(!is_constructible_patched::value, ""); } namespace @@ -839,5 +839,5 @@ TEST_CASE("Issue #924") TEST_CASE("Issue #1237") { struct non_convertible_type {}; - static_assert(not std::is_convertible::value, ""); + static_assert(!std::is_convertible::value, ""); } diff --git a/test/src/unit-unicode.cpp b/test/src/unit-unicode.cpp index c923180e..d6bf6563 100644 --- a/test/src/unit-unicode.cpp +++ b/test/src/unit-unicode.cpp @@ -217,7 +217,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte1 = 0x00; byte1 <= 0x7F; ++byte1) { // unescaped control characters are parse errors in JSON - if (0x00 <= byte1 and byte1 <= 0x1F) + if (0x00 <= byte1 && byte1 <= 0x1F) { check_utf8string(false, byte1); continue; @@ -274,7 +274,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte2 = 0x00; byte2 <= 0xFF; ++byte2) { // skip correct second byte - if (0x80 <= byte2 and byte2 <= 0xBF) + if (0x80 <= byte2 && byte2 <= 0xBF) { continue; } @@ -331,7 +331,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte2 = 0x00; byte2 <= 0xFF; ++byte2) { // skip correct second byte - if (0xA0 <= byte2 and byte2 <= 0xBF) + if (0xA0 <= byte2 && byte2 <= 0xBF) { continue; } @@ -354,7 +354,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte3 = 0x00; byte3 <= 0xFF; ++byte3) { // skip correct third byte - if (0x80 <= byte3 and byte3 <= 0xBF) + if (0x80 <= byte3 && byte3 <= 0xBF) { continue; } @@ -412,7 +412,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte2 = 0x00; byte2 <= 0xFF; ++byte2) { // skip correct second byte - if (0x80 <= byte2 and byte2 <= 0xBF) + if (0x80 <= byte2 && byte2 <= 0xBF) { continue; } @@ -435,7 +435,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte3 = 0x00; byte3 <= 0xFF; ++byte3) { // skip correct third byte - if (0x80 <= byte3 and byte3 <= 0xBF) + if (0x80 <= byte3 && byte3 <= 0xBF) { continue; } @@ -493,7 +493,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte2 = 0x00; byte2 <= 0xFF; ++byte2) { // skip correct second byte - if (0x80 <= byte2 and byte2 <= 0x9F) + if (0x80 <= byte2 && byte2 <= 0x9F) { continue; } @@ -516,7 +516,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte3 = 0x00; byte3 <= 0xFF; ++byte3) { // skip correct third byte - if (0x80 <= byte3 and byte3 <= 0xBF) + if (0x80 <= byte3 && byte3 <= 0xBF) { continue; } @@ -574,7 +574,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte2 = 0x00; byte2 <= 0xFF; ++byte2) { // skip correct second byte - if (0x80 <= byte2 and byte2 <= 0xBF) + if (0x80 <= byte2 && byte2 <= 0xBF) { continue; } @@ -597,7 +597,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte3 = 0x00; byte3 <= 0xFF; ++byte3) { // skip correct third byte - if (0x80 <= byte3 and byte3 <= 0xBF) + if (0x80 <= byte3 && byte3 <= 0xBF) { continue; } @@ -673,7 +673,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte2 = 0x00; byte2 <= 0xFF; ++byte2) { // skip correct second byte - if (0x90 <= byte2 and byte2 <= 0xBF) + if (0x90 <= byte2 && byte2 <= 0xBF) { continue; } @@ -699,7 +699,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte3 = 0x00; byte3 <= 0xFF; ++byte3) { // skip correct third byte - if (0x80 <= byte3 and byte3 <= 0xBF) + if (0x80 <= byte3 && byte3 <= 0xBF) { continue; } @@ -725,7 +725,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte4 = 0x00; byte4 <= 0xFF; ++byte4) { // skip fourth second byte - if (0x80 <= byte3 and byte3 <= 0xBF) + if (0x80 <= byte3 && byte3 <= 0xBF) { continue; } @@ -802,7 +802,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte2 = 0x00; byte2 <= 0xFF; ++byte2) { // skip correct second byte - if (0x80 <= byte2 and byte2 <= 0xBF) + if (0x80 <= byte2 && byte2 <= 0xBF) { continue; } @@ -828,7 +828,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte3 = 0x00; byte3 <= 0xFF; ++byte3) { // skip correct third byte - if (0x80 <= byte3 and byte3 <= 0xBF) + if (0x80 <= byte3 && byte3 <= 0xBF) { continue; } @@ -854,7 +854,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte4 = 0x00; byte4 <= 0xFF; ++byte4) { // skip correct fourth byte - if (0x80 <= byte3 and byte3 <= 0xBF) + if (0x80 <= byte3 && byte3 <= 0xBF) { continue; } @@ -931,7 +931,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte2 = 0x00; byte2 <= 0xFF; ++byte2) { // skip correct second byte - if (0x80 <= byte2 and byte2 <= 0x8F) + if (0x80 <= byte2 && byte2 <= 0x8F) { continue; } @@ -957,7 +957,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte3 = 0x00; byte3 <= 0xFF; ++byte3) { // skip correct third byte - if (0x80 <= byte3 and byte3 <= 0xBF) + if (0x80 <= byte3 && byte3 <= 0xBF) { continue; } @@ -983,7 +983,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (int byte4 = 0x00; byte4 <= 0xFF; ++byte4) { // skip correct fourth byte - if (0x80 <= byte3 and byte3 <= 0xBF) + if (0x80 <= byte3 && byte3 <= 0xBF) { continue; } @@ -1030,7 +1030,7 @@ TEST_CASE("Unicode" * doctest::skip()) // they will never be assigned a character, so there should be no // reason to encode them. The official Unicode standard says that // no UTF forms, including UTF-16, can encode these code points. - if (cp >= 0xD800u and cp <= 0xDFFFu) + if (cp >= 0xD800u && cp <= 0xDFFFu) { // if we would not skip these code points, we would get a // "missing low surrogate" exception @@ -1117,7 +1117,7 @@ TEST_CASE("Unicode" * doctest::skip()) { for (std::size_t cp2 = 0x0000u; cp2 <= 0xFFFFu; ++cp2) { - if (0xDC00u <= cp2 and cp2 <= 0xDFFFu) + if (0xDC00u <= cp2 && cp2 <= 0xDFFFu) { continue; } @@ -1163,7 +1163,7 @@ TEST_CASE("Unicode" * doctest::skip()) for (auto s : j) { // skip non-string JSON values - if (not s.is_string()) + if (!s.is_string()) { continue; }