From 434a38d36d9ad12a91a25af69cfe90b470ce007f Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 9 Jun 2023 14:25:31 +0200 Subject: derivation_clause: remove relational operators --- source/lib/include/newtype/newtype.hpp | 36 ----------- source/tests/src/derivation_clause.cpp | 115 --------------------------------- 2 files changed, 151 deletions(-) diff --git a/source/lib/include/newtype/newtype.hpp b/source/lib/include/newtype/newtype.hpp index 74896ef..b1199b3 100644 --- a/source/lib/include/newtype/newtype.hpp +++ b/source/lib/include/newtype/newtype.hpp @@ -770,42 +770,6 @@ namespace nt { return (*this)(derivable{}) && (*this)(derivable{}...); } - - template - auto constexpr operator<(derivation_clause other) const noexcept -> bool - { - return (sizeof...(DerivableTags) < sizeof...(OtherDerivableTags)) && other(derivable{}...); - } - - template - auto constexpr operator>(derivation_clause other) const noexcept -> bool - { - return other < *this; - } - - template - auto constexpr operator==(derivation_clause other) const noexcept -> bool - { - return sizeof...(DerivableTags) == sizeof...(OtherDerivableTags) && other(derivable{}...); - } - - template - auto constexpr operator!=(derivation_clause other) const noexcept -> bool - { - return !(*this == other); - } - - template - auto constexpr operator<=(derivation_clause other) const noexcept -> bool - { - return *this < other || *this == other; - } - - template - auto constexpr operator>=(derivation_clause other) const noexcept -> bool - { - return *this > other || *this == other; - } }; template diff --git a/source/tests/src/derivation_clause.cpp b/source/tests/src/derivation_clause.cpp index bf0ab83..4cda87f 100644 --- a/source/tests/src/derivation_clause.cpp +++ b/source/tests/src/derivation_clause.cpp @@ -29,36 +29,6 @@ SCENARIO("Derivation Clause", "[infrastructure]") { STATIC_REQUIRE(clause(nt::Show)); } - - THEN("it copares less-than one containing nt::Show and nt::EqBase") - { - STATIC_REQUIRE(clause < deriving(nt::Show, nt::EqBase)); - } - - THEN("it does not compare less-than one conataining only nt::EqBase") - { - STATIC_REQUIRE_FALSE(clause < deriving(nt::EqBase)); - } - - THEN("it does not compare greater-than one conataining only nt::EqBase") - { - STATIC_REQUIRE_FALSE(clause > deriving(nt::EqBase)); - } - - THEN("it does not compare equal-to one containiing only nt::Arithmetic") - { - STATIC_REQUIRE_FALSE(clause == deriving(nt::Arithmetic)); - } - - THEN("it compares not-equal-to one containing only nt::Arithmetic") - { - STATIC_REQUIRE(clause != deriving(nt::Arithmetic)); - } - - THEN("it compares less-than-equal to one containing both nt::Show and nt::EqBase") - { - STATIC_REQUIRE(clause <= deriving(nt::Show, nt::EqBase)); - } } GIVEN("A derivation clause containing only nt::Show and nt::EqBase") @@ -89,90 +59,5 @@ SCENARIO("Derivation Clause", "[infrastructure]") { STATIC_REQUIRE_FALSE(clause(nt::Arithmetic, nt::Show)); } - - THEN("it does not compare less-than one containing nt::Show and nt::EqBase") - { - STATIC_REQUIRE_FALSE(clause < deriving(nt::Show, nt::EqBase)); - } - - THEN("it does not compare less-than one containing nt::EqBase and nt::Show") - { - STATIC_REQUIRE_FALSE(clause < deriving(nt::EqBase, nt::Show)); - } - - THEN("it compares greater-than one containing only nt::Show") - { - STATIC_REQUIRE(clause > deriving(nt::Show)); - } - - THEN("it does not compare greater-than one containing both nt::Show and nt::EqBase") - { - STATIC_REQUIRE_FALSE(clause > deriving(nt::Show, nt::EqBase)); - } - - THEN("it does not compare greater-than one containing both nt::EqBase and nt::Show") - { - STATIC_REQUIRE_FALSE(clause > deriving(nt::EqBase, nt::Show)); - } - - THEN("it compares equal-to one containing both nt::Show and nt::EqBase") - { - STATIC_REQUIRE(clause == deriving(nt::Show, nt::EqBase)); - } - - THEN("it compares equal-to one containing both nt::EqBase and nt::Show") - { - STATIC_REQUIRE(clause == deriving(nt::EqBase, nt::Show)); - } - - THEN("it does not compare equal-to one containiing only nt::Arithmetic") - { - STATIC_REQUIRE_FALSE(clause == deriving(nt::Arithmetic)); - } - - THEN("it does not compare equal-to one containiing all nt::Show, nt::EqBase, and nt::Arithmetic") - { - STATIC_REQUIRE_FALSE(clause == deriving(nt::Show, nt::EqBase, nt::Arithmetic)); - } - - THEN("it does not compare not-equal-to one containing both nt::Show and nt::EqBase") - { - STATIC_REQUIRE_FALSE(clause != deriving(nt::Show, nt::EqBase)); - } - - THEN("it does not compare not-equal-to one containing both nt::Show and nt::EqBase") - { - STATIC_REQUIRE_FALSE(clause != deriving(nt::EqBase, nt::Show)); - } - - THEN("it compares not-equal-to one containing only nt::Arithmetic") - { - STATIC_REQUIRE(clause != deriving(nt::Arithmetic)); - } - - THEN("it compares less-than-equal to one containing both nt::Show and nt::EqBase") - { - STATIC_REQUIRE(clause <= deriving(nt::Show, nt::EqBase)); - } - - THEN("a derivation clause containing only nt::Arithmetic does not compare less-than-equal to it") - { - STATIC_REQUIRE_FALSE(deriving(nt::Arithmetic) <= clause); - } - - THEN("it compares greather-than-equal to one containing only nt::Show") - { - STATIC_REQUIRE(clause >= deriving(nt::Show)); - } - - THEN("it compares greather-than-equal to one containing both nt::Show and nt::EqBase") - { - STATIC_REQUIRE(clause >= deriving(nt::Show, nt::EqBase)); - } - - THEN("it does not compare greather-than-eqaul to one containing only nt::Arithmetic") - { - STATIC_REQUIRE_FALSE(clause >= deriving(nt::Arithmetic)); - } } } -- cgit v1.2.3