WIP: tests + bug fixing

This commit is contained in:
Michele Caini
2017-09-08 15:34:54 +02:00
parent ed98ae3e70
commit 63c1b046e0
5 changed files with 55 additions and 3 deletions

26
test/ident.cpp Normal file
View File

@@ -0,0 +1,26 @@
#include <gtest/gtest.h>
#include <ident.hpp>
struct A {};
struct B {};
TEST(Identifier, Uniqueness) {
constexpr auto ID = entt::ident<A, B>;
constexpr A a;
constexpr B b;
ASSERT_NE(ID.get<A>(), ID.get<B>());
ASSERT_EQ(ID.get<A>(), ID.get<decltype(a)>());
ASSERT_NE(ID.get<A>(), ID.get<decltype(b)>());
ASSERT_EQ(ID.get<A>(), ID.get<A>());
ASSERT_EQ(ID.get<B>(), ID.get<B>());
// test uses in constant expressions
switch(ID.get<B>()) {
case ID.get<A>():
FAIL();
break;
case ID.get<B>():
SUCCEED();
}
}