Skip to content

Commit

Permalink
tests: fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
theodelrieu committed Apr 3, 2019
1 parent e6e6805 commit d66abda
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/src/unit-conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,19 @@ TEST_CASE("value conversion")
CHECK(json(b) == j);
}

SECTION("uint8_t")
{
auto n = j.get<uint8_t>();
CHECK(n == 1);
}

SECTION("bool")
{
bool b = j.get<bool>();
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>(),
json::type_error&);
Expand All @@ -650,6 +656,8 @@ TEST_CASE("value conversion")
json::type_error&);
CHECK_THROWS_AS(json(json::value_t::string).get<json::boolean_t>(),
json::type_error&);
CHECK_THROWS_AS(json(json::value_t::string).get<uint8_t>(),
json::type_error&);
CHECK_THROWS_AS(
json(json::value_t::number_integer).get<json::boolean_t>(),
json::type_error&);
Expand Down

0 comments on commit d66abda

Please sign in to comment.