mirror of
https://github.com/nlohmann/json.git
synced 2026-02-22 11:26:25 +00:00
♻️ rename internal_binary_t with binary_t
This commit is contained in:
@@ -968,21 +968,35 @@ TEST_CASE("modifiers")
|
||||
SECTION("binary_t type")
|
||||
{
|
||||
json j = json::binary_array({1, 2, 3, 4});
|
||||
json::binary_t s = {1, 2, 3, 4};
|
||||
json::binary_t s = {{5, 6, 7, 8}};
|
||||
|
||||
j.swap(s);
|
||||
|
||||
CHECK(j == json::binary_array({1, 2, 3, 4}));
|
||||
CHECK(j == json::binary_array({5, 6, 7, 8}));
|
||||
|
||||
j.swap(s);
|
||||
|
||||
CHECK(j == json::binary_array({1, 2, 3, 4}));
|
||||
}
|
||||
|
||||
SECTION("non-string_t type")
|
||||
SECTION("binary_t::container_type type")
|
||||
{
|
||||
json j = json::binary_array({1, 2, 3, 4});
|
||||
std::vector<std::uint8_t> s = {{5, 6, 7, 8}};
|
||||
|
||||
j.swap(s);
|
||||
|
||||
CHECK(j == json::binary_array({5, 6, 7, 8}));
|
||||
|
||||
j.swap(s);
|
||||
|
||||
CHECK(j == json::binary_array({1, 2, 3, 4}));
|
||||
}
|
||||
|
||||
SECTION("non-binary_t type")
|
||||
{
|
||||
json j = 17;
|
||||
json::binary_t s = {1, 2, 3, 4};
|
||||
json::binary_t s = {{1, 2, 3, 4}};
|
||||
|
||||
CHECK_THROWS_AS(j.swap(s), json::type_error&);
|
||||
CHECK_THROWS_WITH(j.swap(s), "[json.exception.type_error.310] cannot use swap() with number");
|
||||
|
||||
Reference in New Issue
Block a user