From ea85da8a5533a62dbbeee5eaddb41a609f78e113 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 28 Dec 2014 22:16:58 +0100 Subject: [PATCH] + more test cases --- test/JSON_unit.cc | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/test/JSON_unit.cc b/test/JSON_unit.cc index febf2afa..88214db5 100644 --- a/test/JSON_unit.cc +++ b/test/JSON_unit.cc @@ -1407,10 +1407,41 @@ TEST_CASE("Iterators") { JSON j; const JSON j_const = j; - for (JSON::iterator i = j.begin(); i != j.end(); ++i); - for (JSON::const_iterator i = j.cbegin(); i != j.cend(); ++i); - for (JSON::const_iterator i = j_const.begin(); i != j_const.end(); ++i); - for (JSON::const_iterator i = j_const.cbegin(); i != j_const.cend(); ++i); + { + JSON::iterator i = j.begin(); + ++i; + CHECK(i == j.end()); + ++i; + CHECK(i == j.end()); + } + { + JSON::const_iterator i = j.begin(); + ++i; + CHECK(i == j.end()); + ++i; + CHECK(i == j.end()); + } + { + JSON::const_iterator i = j_const.begin(); + ++i; + CHECK(i == j_const.end()); + ++i; + CHECK(i == j_const.end()); + } + { + JSON::const_iterator i = j.cbegin(); + ++i; + CHECK(i == j.cend()); + ++i; + CHECK(i == j.cend()); + } + { + JSON::const_iterator i = j_const.cbegin(); + ++i; + CHECK(i == j_const.cend()); + ++i; + CHECK(i == j_const.cend()); + } } }