From 6d24711208e60ad4ef85c2d055bd49af120e8f77 Mon Sep 17 00:00:00 2001 From: Antony Woods Date: Thu, 6 Nov 2014 14:10:38 +0000 Subject: Added boolean types to json rvalue (.b()) including tests --- tests/unittest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/unittest.cpp b/tests/unittest.cpp index 4dec727..2b6a20a 100644 --- a/tests/unittest.cpp +++ b/tests/unittest.cpp @@ -453,6 +453,14 @@ TEST(json_read) q = y["ints"][2].i(); ASSERT_EQUAL(3, q); + std::string s2 = R"({"bools":[true, false], "doubles":[1.2, -3.4]})"; + auto z = json::load(s2); + ASSERT_EQUAL(2, z["bools"].size()); + ASSERT_EQUAL(2, z["doubles"].size()); + ASSERT_EQUAL(true, z["bools"][0].b()); + ASSERT_EQUAL(false, z["bools"][1].b()); + ASSERT_EQUAL(1.2, z["doubles"][0].d()); + ASSERT_EQUAL(-3.4, z["doubles"][1].d()); } TEST(json_read_unescaping) -- cgit v1.2.3-54-g00ecf