1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-29 23:01:16 +03:00

added test cases

This commit is contained in:
Niels
2015-05-09 14:37:22 +02:00
parent 869035a6c9
commit bb142d6cae
2 changed files with 12 additions and 1 deletions

View File

@ -7377,6 +7377,15 @@ TEST_CASE("parser class")
// empty string
CHECK(json::parser("\"\"").parse() == json(json::value_t::string));
SECTION("errors")
{
// error: tab in string
CHECK_THROWS_AS(json::parser("\"\t\"").parse(), std::invalid_argument);
// error: newline in string
CHECK_THROWS_AS(json::parser("\"\n\"").parse(), std::invalid_argument);
CHECK_THROWS_AS(json::parser("\"\r\"").parse(), std::invalid_argument);
}
SECTION("escaped")
{
// quotation mark "\""
@ -8524,11 +8533,13 @@ TEST_CASE("regression tests")
SECTION("NAN value")
{
CHECK(json(NAN) == json());
CHECK(json(json::number_float_t(NAN)) == json());
}
SECTION("infinity")
{
CHECK(json(INFINITY) == json());
CHECK(json(json::number_float_t(INFINITY)) == json());
}
}
}