From d38596793ea7131d6f06550b331008ed9279ec50 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 8 Feb 2015 16:14:49 +0100 Subject: [PATCH] more test cases --- test/unit.cpp | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/test/unit.cpp b/test/unit.cpp index f31a22da..c9e5fb7d 100644 --- a/test/unit.cpp +++ b/test/unit.cpp @@ -197,7 +197,7 @@ TEST_CASE("constructors") CHECK(j == j_reference); } - SECTION("std::array") + SECTION("std::array") { std::array a {{json(1), json(2.2), json(false), json("string"), json()}}; json j(a); @@ -1170,7 +1170,7 @@ TEST_CASE("value conversion") SECTION("json::object_t") { - json::object_t o = j.get>(); + json::object_t o = j.get(); CHECK(json(o) == j); } @@ -1198,4 +1198,40 @@ TEST_CASE("value conversion") CHECK(json(o) == j); } } + + SECTION("get an array (explicit)") + { + json::array_t a_reference {json(1), json(2.2), json(false), json("string"), json()}; + json j(a_reference); + + SECTION("json::array_t") + { + json::array_t a = j.get(); + CHECK(json(a) == j); + } + + SECTION("std::list") + { + std::list a = j.get>(); + CHECK(json(a) == j); + } + + SECTION("std::forward_list") + { + std::forward_list a = j.get>(); + CHECK(json(a) == j); + } + + SECTION("std::vector") + { + std::vector a = j.get>(); + CHECK(json(a) == j); + } + + SECTION("std::deque") + { + std::deque a = j.get>(); + CHECK(json(a) == j); + } + } }