🎨 replace alternative operators (and, not, or)
This commit is contained in:
parent
0498202a03
commit
65c4b07451
23 changed files with 352 additions and 352 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue