From 3f46fe7a08da5c3acb34c904d11454c7b35999ed Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 11 Feb 2015 11:47:00 +0100 Subject: [PATCH] more test cases --- test/unit.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/unit.cpp b/test/unit.cpp index f475bdfe..947e62a1 100644 --- a/test/unit.cpp +++ b/test/unit.cpp @@ -4112,6 +4112,29 @@ TEST_CASE("parser class") CHECK(json::parser("false").parse() == json(false)); } + SECTION("array") + { + SECTION("empty array") + { + CHECK(json::parser("[]").parse() == json(json::value_t::array)); + CHECK(json::parser("[ ]").parse() == json(json::value_t::array)); + } + + SECTION("nonempty array") + { + CHECK(json::parser("[true, false, null]").parse() == json({true, false, nullptr})); + } + } + + SECTION("object") + { + SECTION("empty object") + { + CHECK(json::parser("{}").parse() == json(json::value_t::object)); + CHECK(json::parser("{ }").parse() == json(json::value_t::object)); + } + } + SECTION("number") { SECTION("integers")