From cb348218345cfe2bea09d4a8ca8ea4c0f13f8bc3 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Mon, 21 Oct 2019 15:18:10 -0700 Subject: [PATCH] coverage odds and ends --- include/boost/json/impl/storage.ipp | 9 ++++----- include/boost/json/storage.hpp | 2 +- test/error.cpp | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/json/impl/storage.ipp b/include/boost/json/impl/storage.ipp index 2c2bdaca..9685fde2 100644 --- a/include/boost/json/impl/storage.ipp +++ b/include/boost/json/impl/storage.ipp @@ -11,6 +11,7 @@ #define BOOST_JSON_IMPL_STORAGE_IPP #include +#include #include namespace boost { @@ -49,11 +50,9 @@ global_storage() noexcept is_equal(storage const& other) const noexcept override { - auto p = dynamic_cast< - builtin const*>(&other); - if(! p) - return false; - return true; + BOOST_ASSERT(dynamic_cast< + builtin const*>(&other) == nullptr); + return false; } }; static storage_ptr const sp = diff --git a/include/boost/json/storage.hpp b/include/boost/json/storage.hpp index 7b2fa4ef..8fb66bc5 100644 --- a/include/boost/json/storage.hpp +++ b/include/boost/json/storage.hpp @@ -84,7 +84,7 @@ public: storage const& lhs, storage const& rhs) noexcept { - return !(lhs == rhs); + return &lhs != &rhs && ! lhs.is_equal(rhs); } }; diff --git a/test/error.cpp b/test/error.cpp index 71ebeedb..52735b35 100644 --- a/test/error.cpp +++ b/test/error.cpp @@ -24,6 +24,8 @@ public: auto const ec = make_error_code(e); ec.category().name(); BEAST_EXPECT(! ec.message().empty()); + BEAST_EXPECT(ec.category().default_error_condition( + static_cast(e)).category() == ec.category()); } void check(condition c, error e) @@ -79,7 +81,6 @@ public: check(condition::assign_error, error::integer_overflow); check(error::key_not_found); - check(error::test_failure); } };