diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2023-06-09 14:25:31 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2023-06-09 14:25:31 +0200 |
| commit | 434a38d36d9ad12a91a25af69cfe90b470ce007f (patch) | |
| tree | 9f381eb7435423230a37cc3d80e068de39a03415 | |
| parent | 976992ac86656d29a1dc1fc50866fcfbc55222bb (diff) | |
| download | newtype-434a38d36d9ad12a91a25af69cfe90b470ce007f.tar.xz newtype-434a38d36d9ad12a91a25af69cfe90b470ce007f.zip | |
derivation_clause: remove relational operators
| -rw-r--r-- | source/lib/include/newtype/newtype.hpp | 36 | ||||
| -rw-r--r-- | source/tests/src/derivation_clause.cpp | 115 |
2 files changed, 0 insertions, 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<DerivableTag>{}) && (*this)(derivable<RemainingDerivableTags>{}...); } - - template<typename... OtherDerivableTags> - auto constexpr operator<(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool - { - return (sizeof...(DerivableTags) < sizeof...(OtherDerivableTags)) && other(derivable<DerivableTags>{}...); - } - - template<typename... OtherDerivableTags> - auto constexpr operator>(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool - { - return other < *this; - } - - template<typename... OtherDerivableTags> - auto constexpr operator==(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool - { - return sizeof...(DerivableTags) == sizeof...(OtherDerivableTags) && other(derivable<DerivableTags>{}...); - } - - template<typename... OtherDerivableTags> - auto constexpr operator!=(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool - { - return !(*this == other); - } - - template<typename... OtherDerivableTags> - auto constexpr operator<=(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool - { - return *this < other || *this == other; - } - - template<typename... OtherDerivableTags> - auto constexpr operator>=(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool - { - return *this > other || *this == other; - } }; template<typename DerivationClause, auto... Features> 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)); - } } } |
