1 #include <type_traits>
2 #include <gtest/gtest.h>
3 #include <entt/core/ident.hpp>
4 
5 struct a_type {};
6 struct another_type {};
7 
TEST(Identifier,Uniqueness)8 TEST(Identifier, Uniqueness) {
9     using id = entt::identifier<a_type, another_type>;
10     constexpr a_type an_instance;
11     constexpr another_type another_instance;
12 
13     ASSERT_NE(id::type<a_type>, id::type<another_type>);
14     ASSERT_EQ(id::type<a_type>, id::type<decltype(an_instance)>);
15     ASSERT_NE(id::type<a_type>, id::type<decltype(another_instance)>);
16     ASSERT_EQ(id::type<a_type>, id::type<a_type>);
17     ASSERT_EQ(id::type<another_type>, id::type<another_type>);
18 
19     // test uses in constant expressions
20     switch(id::type<another_type>) {
21     case id::type<a_type>:
22         FAIL();
23     case id::type<another_type>:
24         SUCCEED();
25     }
26 }
27 
TEST(Identifier,SingleType)28 TEST(Identifier, SingleType) {
29     using id = entt::identifier<a_type>;
30     std::integral_constant<id::identifier_type, id::type<a_type>> ic;
31     (void)ic;
32 }
33