tests: fix coverage
This commit is contained in:
parent
e6e6805c6c
commit
d66abda4ee
1 changed files with 9 additions and 1 deletions
|
@ -634,13 +634,19 @@ TEST_CASE("value conversion")
|
||||||
CHECK(json(b) == j);
|
CHECK(json(b) == j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("uint8_t")
|
||||||
|
{
|
||||||
|
auto n = j.get<uint8_t>();
|
||||||
|
CHECK(n == 1);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("bool")
|
SECTION("bool")
|
||||||
{
|
{
|
||||||
bool b = j.get<bool>();
|
bool b = j.get<bool>();
|
||||||
CHECK(json(b) == j);
|
CHECK(json(b) == j);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("exception in case of a non-string type")
|
SECTION("exception in case of a non-number type")
|
||||||
{
|
{
|
||||||
CHECK_THROWS_AS(json(json::value_t::null).get<json::boolean_t>(),
|
CHECK_THROWS_AS(json(json::value_t::null).get<json::boolean_t>(),
|
||||||
json::type_error&);
|
json::type_error&);
|
||||||
|
@ -650,6 +656,8 @@ TEST_CASE("value conversion")
|
||||||
json::type_error&);
|
json::type_error&);
|
||||||
CHECK_THROWS_AS(json(json::value_t::string).get<json::boolean_t>(),
|
CHECK_THROWS_AS(json(json::value_t::string).get<json::boolean_t>(),
|
||||||
json::type_error&);
|
json::type_error&);
|
||||||
|
CHECK_THROWS_AS(json(json::value_t::string).get<uint8_t>(),
|
||||||
|
json::type_error&);
|
||||||
CHECK_THROWS_AS(
|
CHECK_THROWS_AS(
|
||||||
json(json::value_t::number_integer).get<json::boolean_t>(),
|
json(json::value_t::number_integer).get<json::boolean_t>(),
|
||||||
json::type_error&);
|
json::type_error&);
|
||||||
|
|
Loading…
Reference in a new issue