Implementing refptr up and downcasts

This commit is contained in:
Dynamitos
2020-03-09 12:30:07 +01:00
parent 9bff657419
commit f232cffe30
10 changed files with 1404 additions and 49 deletions
+17
View File
@@ -31,6 +31,23 @@ BOOST_AUTO_TEST_CASE(basic_refcount)
}
}
struct DerivedStruct : public TestStruct
{
};
BOOST_AUTO_TEST_CASE(inheritance_cast)
{
Seele::RefPtr<DerivedStruct> backCast;
{
Seele::RefPtr<DerivedStruct> derived = new DerivedStruct();
Seele::RefPtr<TestStruct> base = derived;
BOOST_REQUIRE_EQUAL(base->data, 10);
backCast = base.cast<DerivedStruct>();
}
BOOST_REQUIRE_EQUAL(backCast->data, 10);
}
BOOST_AUTO_TEST_CASE(unique_ptr)
{
UniquePtr<TestStruct> uptr = new TestStruct();