diff options
-rw-r--r-- | slicer/slicer/modelParts.cpp | 4 | ||||
-rw-r--r-- | slicer/test/compilation.cpp | 24 |
2 files changed, 14 insertions, 14 deletions
diff --git a/slicer/slicer/modelParts.cpp b/slicer/slicer/modelParts.cpp index 1b40773..abe94d8 100644 --- a/slicer/slicer/modelParts.cpp +++ b/slicer/slicer/modelParts.cpp @@ -14,7 +14,7 @@ namespace Slicer { ModelPartPtr ModelPart::GetSubclassModelPart(const std::string &) { - return shared_from_this(); + throw std::logic_error {"GetSubclassModelPart not supported on this ModelPart"}; } TypeId @@ -69,7 +69,7 @@ namespace Slicer { ModelPartPtr ModelPart::GetContainedModelPart() { - return shared_from_this(); + throw std::logic_error {"GetContainedModelPart not supported on this ModelPart"}; } bool diff --git a/slicer/test/compilation.cpp b/slicer/test/compilation.cpp index 6bc6993..fbbbb5f 100644 --- a/slicer/test/compilation.cpp +++ b/slicer/test/compilation.cpp @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_class) { TypeTest(TestModule::BuiltInsPtr, std::make_shared<TestModule::BuiltIns>(), ModelPartForClass, ModelPartType::Complex); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } static void @@ -53,7 +53,7 @@ hookHandler(std::vector<std::string> * names, const std::string & name, Slicer:: { names->push_back(name); BOOST_REQUIRE(mpp); - BOOST_REQUIRE(mpp->GetContainedModelPart()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); BOOST_REQUIRE(h); BOOST_REQUIRE_EQUAL(h->name, name); } @@ -104,61 +104,61 @@ BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_mapstructs) BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_bi_string) { StackTypeTest(std::string, ModelPartForSimple, ModelPartType::Simple); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_bi_bool) { StackTypeTest(bool, ModelPartForSimple, ModelPartType::Simple); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_bi_float) { StackTypeTest(Ice::Float, ModelPartForSimple, ModelPartType::Simple); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_bi_double) { StackTypeTest(Ice::Double, ModelPartForSimple, ModelPartType::Simple); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_bi_byte) { StackTypeTest(Ice::Byte, ModelPartForSimple, ModelPartType::Simple); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_bi_short) { StackTypeTest(Ice::Short, ModelPartForSimple, ModelPartType::Simple); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_bi_int) { StackTypeTest(Ice::Int, ModelPartForSimple, ModelPartType::Simple); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_bi_long) { StackTypeTest(Ice::Long, ModelPartForSimple, ModelPartType::Simple); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_struct) { StackTypeTest(TestModule::StructType, ModelPartForStruct, ModelPartType::Complex); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_enum) { StackTypeTest(TestModule::SomeNumbers, ModelPartForEnum, ModelPartType::Simple); - BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get()); + BOOST_CHECK_THROW(mpp->GetContainedModelPart(), std::logic_error); } BOOST_AUTO_TEST_CASE(normalClassTypeId) |