review: delegate (see #101 and #102)

This commit is contained in:
Michele Caini
2018-06-18 17:10:31 +02:00
parent 107eb72225
commit 957697c383
3 changed files with 27 additions and 11 deletions

View File

@@ -16,20 +16,23 @@ TEST(Delegate, Functionalities) {
entt::Delegate<int(int)> mfdel;
DelegateFunctor functor;
ASSERT_EQ(ffdel(42), int{});
ASSERT_EQ(mfdel(42), int{});
ASSERT_TRUE(ffdel.empty());
ASSERT_TRUE(mfdel.empty());
ffdel.connect<&delegateFunction>();
mfdel.connect<DelegateFunctor, &DelegateFunctor::operator()>(&functor);
ASSERT_FALSE(ffdel.empty());
ASSERT_FALSE(mfdel.empty());
ASSERT_EQ(ffdel(3), 9);
ASSERT_EQ(mfdel(3), 6);
ffdel.reset();
mfdel.reset();
ASSERT_EQ(ffdel(42), int{});
ASSERT_EQ(mfdel(42), int{});
ASSERT_TRUE(ffdel.empty());
ASSERT_TRUE(mfdel.empty());
}
TEST(Delegate, Comparison) {