From 5551b5536201b38271ecaf9289a65617ef1c05ba Mon Sep 17 00:00:00 2001 From: Martin Marinov <Martin.Marinov@autodesk.com> Date: Thu, 23 Sep 2021 17:45:35 +0100 Subject: [PATCH] REFORM-1097 Fix Test::Checksum::Compare (#64) --- Test/TestChecksumCompare.cc | 6 +----- Test/TestChecksumCompare.hh | 15 +++++++-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Test/TestChecksumCompare.cc b/Test/TestChecksumCompare.cc index fae9147..808160e 100755 --- a/Test/TestChecksumCompare.cc +++ b/Test/TestChecksumCompare.cc @@ -356,10 +356,6 @@ void Compare::Impl::check_equal() const TEST_THROW_ERROR(TEST_CHECKSUM_COMPARE_DIFFERENCES); } } - -Compare::Impl* Compare::impl_ = nullptr; -bool Compare::owned_ = false; - void Compare::make() { if (impl_ != nullptr) @@ -371,7 +367,7 @@ void Compare::make() void Compare::set(Compare& _othr) { TEST_THROW_ERROR_if( - _othr.impl_ != nullptr, TEST_CHECKSUM_COMPARE_INCOMING_IMPL_NULL); + _othr.impl_ == nullptr, TEST_CHECKSUM_COMPARE_INCOMING_IMPL_NULL); TEST_THROW_ERROR_if(impl_ != nullptr, TEST_CHECKSUM_COMPARE_IMPL_ALREADY_SET); impl_ = _othr.impl_; diff --git a/Test/TestChecksumCompare.hh b/Test/TestChecksumCompare.hh index 9c627df..45437e2 100644 --- a/Test/TestChecksumCompare.hh +++ b/Test/TestChecksumCompare.hh @@ -41,15 +41,14 @@ linked statically, i.e., they share the same binary. class Compare { public: + //! Destroy the owned instance + ~Compare(); + //! Make and store the unique instance - static void make(); + void make(); //! Set an instance made in another binary - static void set(Compare&); - -public: - //! Destroy the owned instance - ~Compare(); + void set(Compare&); //! Set the report pair to compare void set_reports(const fs::path& _left_path, const fs::path& _right_path); @@ -76,8 +75,8 @@ private: private: class Impl; - static Impl* impl_; // shared implementation pointer - static bool owned_; // own implementation or not + Impl* impl_ = nullptr; // shared implementation + bool owned_ = false; // own implementation or not }; /*! -- GitLab