forked from TartanLlama/expected
More tests
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "catch.hpp"
|
||||
#include "expected.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
// 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<tl::expected<T,int>>::value);
|
||||
REQUIRE(std::is_copy_assignable<tl::expected<T,int>>::value);
|
||||
//TODO see why this fails
|
||||
//REQUIRE(!std::is_move_constructible<tl::expected<T,int>>::value);
|
||||
//REQUIRE(!std::is_move_assignable<tl::expected<T,int>>::value);
|
||||
}
|
||||
|
||||
{
|
||||
tl::expected<int, int> e;
|
||||
REQUIRE(std::is_default_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_copy_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_move_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_copy_assignable<decltype(e)>::value);
|
||||
REQUIRE(std::is_move_assignable<decltype(e)>::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<decltype(e)>::value);
|
||||
REQUIRE(std::is_trivially_move_assignable<decltype(e)>::value);
|
||||
# endif
|
||||
}
|
||||
|
||||
{
|
||||
tl::expected<int, std::string> e;
|
||||
REQUIRE(std::is_default_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_copy_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_move_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_copy_assignable<decltype(e)>::value);
|
||||
REQUIRE(std::is_move_assignable<decltype(e)>::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<decltype(e)>::value);
|
||||
REQUIRE(!std::is_trivially_move_assignable<decltype(e)>::value);
|
||||
# endif
|
||||
}
|
||||
|
||||
{
|
||||
tl::expected<std::string, int> e;
|
||||
REQUIRE(std::is_default_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_copy_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_move_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_copy_assignable<decltype(e)>::value);
|
||||
REQUIRE(std::is_move_assignable<decltype(e)>::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<decltype(e)>::value);
|
||||
REQUIRE(!std::is_trivially_move_assignable<decltype(e)>::value);
|
||||
# endif
|
||||
}
|
||||
|
||||
{
|
||||
tl::expected<std::string, std::string> e;
|
||||
REQUIRE(std::is_default_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_copy_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_move_constructible<decltype(e)>::value);
|
||||
REQUIRE(std::is_copy_assignable<decltype(e)>::value);
|
||||
REQUIRE(std::is_move_assignable<decltype(e)>::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<decltype(e)>::value);
|
||||
REQUIRE(!std::is_trivially_move_assignable<decltype(e)>::value);
|
||||
# endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user