more test cases (objects, floats)
This commit is contained in:
parent
3f46fe7a08
commit
c1bf002522
1 changed files with 15 additions and 0 deletions
|
@ -4133,6 +4133,11 @@ TEST_CASE("parser class")
|
|||
CHECK(json::parser("{}").parse() == json(json::value_t::object));
|
||||
CHECK(json::parser("{ }").parse() == json(json::value_t::object));
|
||||
}
|
||||
|
||||
SECTION("nonempty object")
|
||||
{
|
||||
CHECK(json::parser("{\"\": true, \"one\": 1, \"two\": null}").parse() == json({{"", true}, {"one", 1}, {"two", nullptr}}));
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("number")
|
||||
|
@ -4160,6 +4165,16 @@ TEST_CASE("parser class")
|
|||
}
|
||||
}
|
||||
|
||||
SECTION("floating-point")
|
||||
{
|
||||
SECTION("without exponent")
|
||||
{
|
||||
CHECK(json::parser("-128.5").parse() == json(-128.5));
|
||||
CHECK(json::parser("0.999").parse() == json(0.999));
|
||||
CHECK(json::parser("128.5").parse() == json(128.5));
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("invalid numbers")
|
||||
{
|
||||
CHECK_THROWS_AS(json::parser("01").parse(), std::invalid_argument);
|
||||
|
|
Loading…
Reference in a new issue