type_traits: add tests for is_ebco_eligible_v

This commit is contained in:
Michele Caini
2021-10-09 19:03:28 +02:00
parent e4991d367e
commit 0fb86f21e4

View File

@@ -12,7 +12,7 @@ struct not_comparable {
bool operator==(const not_comparable &) const = delete;
};
struct nlohmann_json_like {
struct nlohmann_json_like final {
using value_type = nlohmann_json_like;
bool operator==(const nlohmann_json_like &) const {
@@ -153,6 +153,13 @@ TEST(TypeTraits, IsIteratorType) {
static_assert(entt::is_iterator_type_v<std::vector<int>::iterator, std::reverse_iterator<std::reverse_iterator<std::vector<int>::iterator>>>);
}
TEST(TypeTraits, IsEBCOEligible) {
static_assert(entt::is_ebco_eligible_v<not_comparable>);
static_assert(!entt::is_ebco_eligible_v<nlohmann_json_like>);
static_assert(!entt::is_ebco_eligible_v<double>);
static_assert(!entt::is_ebco_eligible_v<void>);
}
TEST(TypeTraits, ConstnessAs) {
static_assert(std::is_same_v<entt::constness_as_t<int, char>, int>);
static_assert(std::is_same_v<entt::constness_as_t<const int, char>, int>);