hello coveralls...
This commit is contained in:
parent
572232614d
commit
d6f54711f3
2 changed files with 75 additions and 6 deletions
|
@ -24,4 +24,4 @@ after_success:
|
|||
- make clean
|
||||
- make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage"
|
||||
- ./json_unit
|
||||
- coveralls --exclude test/catch.hpp --include src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.8'
|
||||
- coveralls --gcov-options '\-lp' --gcov 'gcov-4.8'
|
||||
|
|
|
@ -1419,4 +1419,73 @@ TEST_CASE("value conversion")
|
|||
}
|
||||
}
|
||||
|
||||
SECTION("get an integer number (explicit)")
|
||||
{
|
||||
json::number_integer_t n_reference {42};
|
||||
json j(n_reference);
|
||||
|
||||
SECTION("number_integer_t")
|
||||
{
|
||||
json::number_integer_t n = j.get<json::number_integer_t>();
|
||||
CHECK(json(n) == j);
|
||||
}
|
||||
|
||||
SECTION("short")
|
||||
{
|
||||
short n = j.get<short>();
|
||||
CHECK(json(n) == j);
|
||||
}
|
||||
|
||||
SECTION("unsigned short")
|
||||
{
|
||||
unsigned short n = j.get<unsigned short>();
|
||||
CHECK(json(n) == j);
|
||||
}
|
||||
|
||||
SECTION("int")
|
||||
{
|
||||
int n = j.get<int>();
|
||||
CHECK(json(n) == j);
|
||||
}
|
||||
|
||||
SECTION("unsigned int")
|
||||
{
|
||||
unsigned int n = j.get<unsigned int>();
|
||||
CHECK(json(n) == j);
|
||||
}
|
||||
|
||||
SECTION("long")
|
||||
{
|
||||
long n = j.get<long>();
|
||||
CHECK(json(n) == j);
|
||||
}
|
||||
|
||||
SECTION("unsigned long")
|
||||
{
|
||||
unsigned long n = j.get<unsigned long>();
|
||||
CHECK(json(n) == j);
|
||||
}
|
||||
|
||||
SECTION("long long")
|
||||
{
|
||||
long long n = j.get<long long>();
|
||||
CHECK(json(n) == j);
|
||||
}
|
||||
|
||||
SECTION("unsigned long long")
|
||||
{
|
||||
unsigned long long n = j.get<unsigned long long>();
|
||||
CHECK(json(n) == j);
|
||||
}
|
||||
|
||||
SECTION("exception in case of a non-number type")
|
||||
{
|
||||
CHECK_THROWS_AS(json(json::value_t::null).get<json::number_integer_t>(), std::logic_error);
|
||||
CHECK_THROWS_AS(json(json::value_t::object).get<json::number_integer_t>(), std::logic_error);
|
||||
CHECK_THROWS_AS(json(json::value_t::array).get<json::number_integer_t>(), std::logic_error);
|
||||
CHECK_THROWS_AS(json(json::value_t::string).get<json::number_integer_t>(), std::logic_error);
|
||||
CHECK_THROWS_AS(json(json::value_t::boolean).get<json::number_integer_t>(), std::logic_error);
|
||||
CHECK_NOTHROW(json(json::value_t::number_float).get<json::number_integer_t>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue