From 29a8d43d5a4c35455bddd7acf82f1fc6633261bb Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 10 Feb 2015 17:40:47 +0100 Subject: [PATCH] fixed tests for copy assignment --- src/json.hpp | 1 - src/json.hpp.re2c | 1 - test/unit.cpp | 21 ++++++++++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index ed3f1fb7..d8f46c52 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -445,7 +445,6 @@ class basic_json /// copy assignment inline reference& operator=(basic_json other) noexcept { - assert(false); // not sure if function will ever be called std::swap(m_type, other.m_type); std::swap(m_value, other.m_value); return *this; diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 0a91b3db..c16f6eef 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -445,7 +445,6 @@ class basic_json /// copy assignment inline reference& operator=(basic_json other) noexcept { - assert(false); // not sure if function will ever be called std::swap(m_type, other.m_type); std::swap(m_value, other.m_value); return *this; diff --git a/test/unit.cpp b/test/unit.cpp index 9e8db7fc..352c05ae 100644 --- a/test/unit.cpp +++ b/test/unit.cpp @@ -963,49 +963,56 @@ TEST_CASE("other constructors and destructor") SECTION("object") { json j {{"foo", 1}, {"bar", false}}; - json k = j; + json k; + k = j; CHECK(j == k); } SECTION("array") { json j {"foo", 1, 42.23, false}; - json k = j; + json k; + k = j; CHECK(j == k); } SECTION("null") { json j(nullptr); - json k = j; + json k; + k = j; CHECK(j == k); } SECTION("boolean") { json j(true); - json k = j; + json k; + k = j; CHECK(j == k); } SECTION("string") { json j("Hello world"); - json k = j; + json k; + k = j; CHECK(j == k); } SECTION("number (integer)") { json j(42); - json k = j; + json k; + k = j; CHECK(j == k); } SECTION("number (floating-point)") { json j(42.23); - json k = j; + json k; + k = j; CHECK(j == k); } }