diff --git a/src/utils/PartitionerOptions.hpp b/src/utils/PartitionerOptions.hpp index b17180e0b78e612c314f64bad878c7136ff328bc..7adce0db4ae35ace3a5d75509efea5742e2957fb 100644 --- a/src/utils/PartitionerOptions.hpp +++ b/src/utils/PartitionerOptions.hpp @@ -43,9 +43,7 @@ getPartitionerEnumFromName(const std::string& enum_name) return PartitionerEnumType{enum_value}; } } - // LCOV_EXCL_START - throw UnexpectedError(std::string{"could not find '"} + enum_name + "' associate type!"); - // LCOV_EXCL_STOP + throw NormalError(std::string{"could not find '"} + enum_name + "' associate type!"); } class PartitionerOptions diff --git a/tests/test_PartitionerOptions.cpp b/tests/test_PartitionerOptions.cpp index 9f0605b4e15861abad28599006c1b53392d9d54d..d1de1dde0e010fab8f54126783631f4a7cf9c499 100644 --- a/tests/test_PartitionerOptions.cpp +++ b/tests/test_PartitionerOptions.cpp @@ -13,7 +13,33 @@ TEST_CASE("PartitionerOptions", "[utils]") REQUIRE(name(PartitionerLibrary::ptscotch) == "PTScotch"); REQUIRE_THROWS_WITH(name(PartitionerLibrary::PT__end), "unexpected error: Partitioner library name is not defined!"); + } + + SECTION("type from name") + { + REQUIRE(getPartitionerEnumFromName<PartitionerLibrary>("ParMETIS") == PartitionerLibrary::parmetis); + REQUIRE(getPartitionerEnumFromName<PartitionerLibrary>("PTScotch") == PartitionerLibrary::ptscotch); + + REQUIRE_THROWS_WITH(getPartitionerEnumFromName<PartitionerLibrary>("foobar"), + "error: could not find 'foobar' associate type!"); + } + + SECTION("output") + { + { + PartitionerOptions options; + options.library() = PartitionerLibrary::parmetis; + std::stringstream os; + os << options; + REQUIRE(os.str() == " library: ParMETIS\n"); + } - WARN("not finished"); + { + PartitionerOptions options; + options.library() = PartitionerLibrary::ptscotch; + std::stringstream os; + os << options; + REQUIRE(os.str() == " library: PTScotch\n"); + } } }