diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-08-16 21:48:33 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-08-16 21:48:33 +0100 |
commit | 0a2793c64280c1ae6a18dd8f2f9b5a789e863f09 (patch) | |
tree | 0f9e20ab92dd45922c7d01b8b93bdde2b1d0bc71 | |
parent | Order list of components in preprocessor test (diff) | |
download | slicer-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.cpp | 32 |
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"); +} + |