From 98af0887f235cd41d4d1aa60f430cf900d65d537 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 28 Dec 2014 22:29:06 +0100 Subject: [PATCH] + more test cases --- src/JSON.cc | 11 ++++++----- test/JSON_unit.cc | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/JSON.cc b/src/JSON.cc index a0121d78..9329a26f 100644 --- a/src/JSON.cc +++ b/src/JSON.cc @@ -477,11 +477,6 @@ const std::string JSON::toString() const noexcept { switch (_type) { - case (value_type::null): - { - return "null"; - } - case (value_type::string): { return std::string("\"") + *_value.string + "\""; @@ -533,6 +528,12 @@ const std::string JSON::toString() const noexcept return "{" + result + "}"; } + + // actually only value_type::null - but making the compiler happy + default: + { + return "null"; + } } } diff --git a/test/JSON_unit.cc b/test/JSON_unit.cc index 88214db5..5ca2e86a 100644 --- a/test/JSON_unit.cc +++ b/test/JSON_unit.cc @@ -1394,6 +1394,21 @@ TEST_CASE("Iterators") JSON::iterator tmp1(j7.begin()); JSON::const_iterator tmp2(j7.cbegin()); } + { + JSON j_array = {0, 1, 2, 3, 4, 5}; + + JSON::iterator i1 = j_array.begin(); + ++i1; + JSON::iterator i2(i1); + JSON::iterator i3; + i3 = i2; + + JSON::const_iterator i4 = j_array.begin(); + ++i4; + JSON::const_iterator i5(i4); + JSON::const_iterator i6; + i6 = i5; + } // iterator copy assignment {