forked from Green-Sky/tomato
Squashed 'external/entt/entt/' content from commit fef92113
git-subtree-dir: external/entt/entt git-subtree-split: fef921132cae7588213d0f9bcd2fb9c8ffd8b7fc
This commit is contained in:
31
test/entt/core/ident.cpp
Normal file
31
test/entt/core/ident.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <type_traits>
|
||||
#include <gtest/gtest.h>
|
||||
#include <entt/core/ident.hpp>
|
||||
|
||||
struct a_type {};
|
||||
struct another_type {};
|
||||
|
||||
TEST(Ident, Uniqueness) {
|
||||
using id = entt::ident<a_type, another_type>;
|
||||
constexpr a_type an_instance;
|
||||
constexpr another_type another_instance;
|
||||
|
||||
ASSERT_NE(id::value<a_type>, id::value<another_type>);
|
||||
ASSERT_EQ(id::value<a_type>, id::value<decltype(an_instance)>);
|
||||
ASSERT_NE(id::value<a_type>, id::value<decltype(another_instance)>);
|
||||
ASSERT_EQ(id::value<a_type>, id::value<a_type>);
|
||||
ASSERT_EQ(id::value<another_type>, id::value<another_type>);
|
||||
|
||||
// test uses in constant expressions
|
||||
switch(id::value<another_type>) {
|
||||
case id::value<a_type>:
|
||||
FAIL();
|
||||
case id::value<another_type>:
|
||||
SUCCEED();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Identifier, SingleType) {
|
||||
using id = entt::ident<a_type>;
|
||||
[[maybe_unused]] std::integral_constant<id::value_type, id::value<a_type>> ic;
|
||||
}
|
||||
Reference in New Issue
Block a user