diff --git a/tests/bases.cpp b/tests/bases.cpp index 87b69b3..ae596e3 100644 --- a/tests/bases.cpp +++ b/tests/bases.cpp @@ -1,6 +1,8 @@ #include "catch.hpp" #include "expected.hpp" +#include + // Old versions of GCC don't have the correct trait names. Could fix them up if needs be. #if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && \ !defined(__clang__)) @@ -116,10 +118,69 @@ TEST_CASE("Deletion", "[bases.deletion]") { }; REQUIRE(std::is_copy_constructible>::value); REQUIRE(std::is_copy_assignable>::value); - //TODO see why this fails - //REQUIRE(!std::is_move_constructible>::value); - //REQUIRE(!std::is_move_assignable>::value); } + + { + tl::expected e; + REQUIRE(std::is_default_constructible::value); + REQUIRE(std::is_copy_constructible::value); + REQUIRE(std::is_move_constructible::value); + REQUIRE(std::is_copy_assignable::value); + REQUIRE(std::is_move_assignable::value); + REQUIRE(IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))); + REQUIRE(IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))); +# if !defined(TL_EXPECTED_GCC49) + REQUIRE(std::is_trivially_move_constructible::value); + REQUIRE(std::is_trivially_move_assignable::value); +# endif + } + + { + tl::expected e; + REQUIRE(std::is_default_constructible::value); + REQUIRE(std::is_copy_constructible::value); + REQUIRE(std::is_move_constructible::value); + REQUIRE(std::is_copy_assignable::value); + REQUIRE(std::is_move_assignable::value); + REQUIRE(!IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))); + REQUIRE(!IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))); +# if !defined(TL_EXPECTED_GCC49) + REQUIRE(!std::is_trivially_move_constructible::value); + REQUIRE(!std::is_trivially_move_assignable::value); +# endif + } + + { + tl::expected e; + REQUIRE(std::is_default_constructible::value); + REQUIRE(std::is_copy_constructible::value); + REQUIRE(std::is_move_constructible::value); + REQUIRE(std::is_copy_assignable::value); + REQUIRE(std::is_move_assignable::value); + REQUIRE(!IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))); + REQUIRE(!IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))); +# if !defined(TL_EXPECTED_GCC49) + REQUIRE(!std::is_trivially_move_constructible::value); + REQUIRE(!std::is_trivially_move_assignable::value); +# endif + } + + { + tl::expected e; + REQUIRE(std::is_default_constructible::value); + REQUIRE(std::is_copy_constructible::value); + REQUIRE(std::is_move_constructible::value); + REQUIRE(std::is_copy_assignable::value); + REQUIRE(std::is_move_assignable::value); + REQUIRE(!IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))); + REQUIRE(!IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))); +# if !defined(TL_EXPECTED_GCC49) + REQUIRE(!std::is_trivially_move_constructible::value); + REQUIRE(!std::is_trivially_move_assignable::value); +# endif + } + } + #endif