From b573841ace86bfcdd49021a8122302b48a1ea3e8 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 28 Dec 2014 22:38:57 +0100 Subject: [PATCH] + more test cases --- .travis.yml | 1 - src/JSON.cc | 1 + test/JSON_unit.cc | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 52bce403..ca11543a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,4 +23,3 @@ after_success: - make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage" - ./json_unit - coveralls --exclude lib --exclude test --gcov-options '\-lp' --gcov 'gcov-4.8' - diff --git a/src/JSON.cc b/src/JSON.cc index 9329a26f..44bc1c1f 100644 --- a/src/JSON.cc +++ b/src/JSON.cc @@ -1381,6 +1381,7 @@ JSON::iterator::iterator(const JSON::iterator& o) : _object(o._object) } default: { + // not sure if used break; } } diff --git a/test/JSON_unit.cc b/test/JSON_unit.cc index 5ca2e86a..ebabd115 100644 --- a/test/JSON_unit.cc +++ b/test/JSON_unit.cc @@ -1402,12 +1402,31 @@ TEST_CASE("Iterators") JSON::iterator i2(i1); JSON::iterator i3; i3 = i2; + CHECK(i1 == i1); JSON::const_iterator i4 = j_array.begin(); ++i4; JSON::const_iterator i5(i4); JSON::const_iterator i6; i6 = i5; + CHECK(i4 == i4); + } + { + JSON j_object = {{"1", 1}, {"2", 2}}; + + JSON::iterator i1 = j_object.begin(); + ++i1; + JSON::iterator i2(i1); + JSON::iterator i3; + i3 = i2; + CHECK(i1 == i1); + + JSON::const_iterator i4 = j_object.begin(); + ++i4; + JSON::const_iterator i5(i4); + JSON::const_iterator i6; + i6 = i5; + CHECK(i4 == i4); } // iterator copy assignment