From 603dedfa2b3704730fa4db8e7f84702b26da9ae6 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sat, 3 Jan 2015 16:17:11 +0100 Subject: Improved contains functionality (now includes the parent types of each aggregated type and the aggregated types of each parent) --- test/core/common/RttiTest.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'test/core/common/RttiTest.cpp') diff --git a/test/core/common/RttiTest.cpp b/test/core/common/RttiTest.cpp index 7990593..fdeb8f0 100644 --- a/test/core/common/RttiTest.cpp +++ b/test/core/common/RttiTest.cpp @@ -35,15 +35,23 @@ class RttiTestClass3 { }; class RttiTestClass4 { }; +class RttiTestClass5 { +}; +class RttiTestClass6 { +}; +class RttiTestClass7 { +}; -extern const Rtti Type6; +extern const Rtti Type6; +extern const Rtti Type7; const Rtti Type1("Type1"); const Rtti Type2("Type2"); const Rtti Type3("Type3", {&Type1}); const Rtti Type4("Type4", {&Type3, &Type2}); -const Rtti Type5("Type5", {}, {&Type6}); -const Rtti Type6("Type6", {}, {&Type5, &Type1}); +const Rtti Type5("Type5", {}, {&Type6, &Type7}); +const Rtti Type6("Type6", {}, {&Type1}); +const Rtti Type7("Type7", {&Type6}, {}); TEST(Rtti, isa) { @@ -78,21 +86,32 @@ TEST(Rtti, contains) ASSERT_FALSE(t->contains(Type4)); ASSERT_FALSE(t->contains(Type5)); ASSERT_FALSE(t->contains(Type6)); + ASSERT_FALSE(t->contains(Type7)); } ASSERT_TRUE(Type5.contains(Type1)); ASSERT_FALSE(Type5.contains(Type2)); ASSERT_FALSE(Type5.contains(Type3)); ASSERT_FALSE(Type5.contains(Type4)); - ASSERT_TRUE(Type5.contains(Type5)); + ASSERT_FALSE(Type5.contains(Type5)); ASSERT_TRUE(Type5.contains(Type6)); + ASSERT_TRUE(Type5.contains(Type7)); ASSERT_TRUE(Type6.contains(Type1)); ASSERT_FALSE(Type6.contains(Type2)); ASSERT_FALSE(Type6.contains(Type3)); ASSERT_FALSE(Type6.contains(Type4)); - ASSERT_TRUE(Type6.contains(Type5)); - ASSERT_TRUE(Type6.contains(Type6)); + ASSERT_FALSE(Type6.contains(Type5)); + ASSERT_FALSE(Type6.contains(Type6)); + ASSERT_FALSE(Type6.contains(Type7)); + + ASSERT_TRUE(Type7.contains(Type1)); + ASSERT_FALSE(Type7.contains(Type2)); + ASSERT_FALSE(Type7.contains(Type3)); + ASSERT_FALSE(Type7.contains(Type4)); + ASSERT_FALSE(Type7.contains(Type5)); + ASSERT_FALSE(Type7.contains(Type6)); + ASSERT_FALSE(Type7.contains(Type7)); } } } -- cgit v1.2.3