|
|
@@ -1,31 +1,30 @@
|
|
|
#include <type_traits>
|
|
|
#include <gtest/gtest.h>
|
|
|
+#include <common/boxed_type.h>
|
|
|
+#include <common/empty.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;
|
|
|
+ using id = entt::ident<test::empty, test::boxed_int>;
|
|
|
+ constexpr test::empty instance;
|
|
|
+ constexpr test::boxed_int other;
|
|
|
|
|
|
- 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>);
|
|
|
+ ASSERT_NE(id::value<test::empty>, id::value<test::boxed_int>);
|
|
|
+ ASSERT_EQ(id::value<test::empty>, id::value<decltype(instance)>);
|
|
|
+ ASSERT_NE(id::value<test::empty>, id::value<decltype(other)>);
|
|
|
+ ASSERT_EQ(id::value<test::empty>, id::value<test::empty>);
|
|
|
+ ASSERT_EQ(id::value<test::boxed_int>, id::value<test::boxed_int>);
|
|
|
|
|
|
// test uses in constant expressions
|
|
|
- switch(id::value<another_type>) {
|
|
|
- case id::value<a_type>:
|
|
|
+ switch(id::value<test::boxed_int>) {
|
|
|
+ case id::value<test::empty>:
|
|
|
FAIL();
|
|
|
- case id::value<another_type>:
|
|
|
+ case id::value<test::boxed_int>:
|
|
|
SUCCEED();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
TEST(Identifier, SingleType) {
|
|
|
- using id = entt::ident<a_type>;
|
|
|
- [[maybe_unused]] const std::integral_constant<id::value_type, id::value<a_type>> ic;
|
|
|
+ using id = entt::ident<test::empty>;
|
|
|
+ [[maybe_unused]] const std::integral_constant<id::value_type, id::value<test::empty>> ic;
|
|
|
}
|