diff --git a/opm/simulators/linalg/PropertyTree.cpp b/opm/simulators/linalg/PropertyTree.cpp index 5f747efc9..d52dd0d11 100644 --- a/opm/simulators/linalg/PropertyTree.cpp +++ b/opm/simulators/linalg/PropertyTree.cpp @@ -126,6 +126,7 @@ template void PropertyTree::put(const std::string& key, const double& value); template void PropertyTree::put(const std::string& key, const float& value); template void PropertyTree::put(const std::string& key, const int& value); template void PropertyTree::put(const std::string& key, const std::size_t& value); +template void PropertyTree::put(const std::string& key, const bool& value); template std::string PropertyTree::get(const std::string& key) const; template double PropertyTree::get(const std::string& key) const; diff --git a/tests/test_propertytree.cpp b/tests/test_propertytree.cpp index 6b6891b79..7bb33f8a5 100644 --- a/tests/test_propertytree.cpp +++ b/tests/test_propertytree.cpp @@ -56,6 +56,7 @@ BOOST_AUTO_TEST_CASE(Top_Node_Only) t.put("b", 123.4); t.put("c", std::string { "hello" }); t.put("d", 12.34f); + t.put("e", true); { const auto a = t.get("a"); @@ -88,6 +89,14 @@ BOOST_AUTO_TEST_CASE(Top_Node_Only) const auto dd = t.get("dd", -1.618f); BOOST_CHECK_CLOSE(dd, -1.618f, 1.0e-6f); } + + { + const auto e = t.get("e"); + BOOST_CHECK_EQUAL(e, true); + + const auto ee = t.get("ee", false); + BOOST_CHECK_EQUAL(ee, false); + } } BOOST_AUTO_TEST_CASE(Size_T) @@ -278,6 +287,11 @@ BOOST_AUTO_TEST_CASE(Vector) expect.begin(), expect.end()); } + { + const auto aa = t.get_child_items_as_vector("aa"); + BOOST_CHECK_MESSAGE(!aa.has_value(), R"(Node "aa" must NOT exist)"); + } + { const auto b = t.get_child_items_as_vector("b"); BOOST_REQUIRE_MESSAGE(b.has_value(), R"(Node "b" must exist)");