Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Add test for comparing immovable types

Commit
65c9a1d31a338f28ef93cd61c475efc40f6cc42e
Author
Martin Hořeňovský ·
Parents
fa31d58934f0

Files · Download .tar.gz

Changes

 tests/SelfTest/UsageTests/Compilation.tests.cpp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/SelfTest/UsageTests/Compilation.tests.cpp b/tests/SelfTest/UsageTests/Compilation.tests.cpp
index 0f339cb8..5f8c82a3 100644
--- a/tests/SelfTest/UsageTests/Compilation.tests.cpp
+++ b/tests/SelfTest/UsageTests/Compilation.tests.cpp
@@ -259,3 +259,21 @@ TEST_CASE("Assertion macros support bit operators and bool conversions", "[compi
     REQUIRE_FALSE(lhs ^ lhs);
 }
 
+namespace {
+    struct ImmovableType {
+        ImmovableType() = default;
+
+        ImmovableType(ImmovableType const&) = delete;
+        ImmovableType& operator=(ImmovableType const&) = delete;
+        ImmovableType(ImmovableType&&) = delete;
+        ImmovableType& operator=(ImmovableType&&) = delete;
+
+        friend bool operator==(ImmovableType const&, ImmovableType const&) {
+            return true;
+        }
+    };
+}
+
+TEST_CASE("Immovable types are supported in basic assertions", "[compilation][.approvals]") {
+    REQUIRE(ImmovableType{} == ImmovableType{});
+}