summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-08-16 21:48:33 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-08-16 21:48:33 +0100
commit0a2793c64280c1ae6a18dd8f2f9b5a789e863f09 (patch)
tree0f9e20ab92dd45922c7d01b8b93bdde2b1d0bc71
parentOrder list of components in preprocessor test (diff)
downloadslicer-0a2793c64280c1ae6a18dd8f2f9b5a789e863f09.tar.bz2
slicer-0a2793c64280c1ae6a18dd8f2f9b5a789e863f09.tar.xz
slicer-0a2793c64280c1ae6a18dd8f2f9b5a789e863f09.zip
Assert behaviour of ModelPartForClass::GetTypeId with a non-local class
-rw-r--r--slicer/test/compilation.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/slicer/test/compilation.cpp b/slicer/test/compilation.cpp
index bea08a5..0ba6b11 100644
--- a/slicer/test/compilation.cpp
+++ b/slicer/test/compilation.cpp
@@ -140,3 +140,35 @@ BOOST_AUTO_TEST_CASE( compile_auto_modelpart_type_enum )
BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get());
}
+BOOST_AUTO_TEST_CASE( normalClassTypeId )
+{
+ TestModule::BasePtr base = new TestModule::Base(1);
+ BOOST_REQUIRE(base);
+ auto a = Slicer::ModelPart::CreateFor(base);
+ BOOST_REQUIRE(a);
+ auto baseType = a->GetTypeId();
+ BOOST_REQUIRE(!baseType);
+}
+
+BOOST_AUTO_TEST_CASE( normalSubClassTypeId )
+{
+ TestModule::BasePtr base = new TestModule::D1(1, 2);
+ BOOST_REQUIRE(base);
+ auto a = Slicer::ModelPart::CreateFor(base);
+ BOOST_REQUIRE(a);
+ auto baseType = a->GetTypeId();
+ BOOST_REQUIRE(baseType);
+ BOOST_REQUIRE_EQUAL(*baseType, "::TestModule::D1");
+}
+
+BOOST_AUTO_TEST_CASE( normalSubSubClassTypeId )
+{
+ TestModule::BasePtr base = new TestModule::D3(1, 2, 3);
+ BOOST_REQUIRE(base);
+ auto a = Slicer::ModelPart::CreateFor(base);
+ BOOST_REQUIRE(a);
+ auto baseType = a->GetTypeId();
+ BOOST_REQUIRE(baseType);
+ BOOST_REQUIRE_EQUAL(*baseType, "::TestModule::D3");
+}
+