add tests for binary type

parent f0c6ab4d
...@@ -115,6 +115,14 @@ TEST_CASE("constructors") ...@@ -115,6 +115,14 @@ TEST_CASE("constructors")
CHECK(j.type() == t); CHECK(j.type() == t);
CHECK(j == 0.0); CHECK(j == 0.0);
} }
SECTION("binary")
{
auto t = json::value_t::binary;
json j(t);
CHECK(j.type() == t);
CHECK(j == json::binary_array({}));
}
} }
SECTION("create a null object (implicitly)") SECTION("create a null object (implicitly)")
......
...@@ -91,6 +91,13 @@ TEST_CASE("other constructors and destructor") ...@@ -91,6 +91,13 @@ TEST_CASE("other constructors and destructor")
json k(j); json k(j);
CHECK(j == k); CHECK(j == k);
} }
SECTION("binary")
{
json j = json::binary_array({1, 2, 3});
json k(j);
CHECK(j == k);
}
} }
SECTION("move constructor") SECTION("move constructor")
...@@ -167,6 +174,14 @@ TEST_CASE("other constructors and destructor") ...@@ -167,6 +174,14 @@ TEST_CASE("other constructors and destructor")
k = j; k = j;
CHECK(j == k); CHECK(j == k);
} }
SECTION("binary")
{
json j = json::binary_array({1, 2, 3});
json k;
k = j;
CHECK(j == k);
}
} }
SECTION("destructor") SECTION("destructor")
......
...@@ -694,6 +694,22 @@ TEST_CASE("element access 1") ...@@ -694,6 +694,22 @@ TEST_CASE("element access 1")
CHECK(it == j.end()); CHECK(it == j.end());
} }
} }
SECTION("binary")
{
{
json j = json::binary_array({1, 2, 3});
json::iterator it = j.erase(j.begin());
CHECK(j.type() == json::value_t::null);
CHECK(it == j.end());
}
{
json j = json::binary_array({1, 2, 3});
json::const_iterator it = j.erase(j.cbegin());
CHECK(j.type() == json::value_t::null);
CHECK(it == j.end());
}
}
} }
SECTION("erase with one invalid iterator") SECTION("erase with one invalid iterator")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment