diff --git a/Tests/MaterialLib/TestMPL.cpp b/Tests/MaterialLib/TestMPL.cpp index f2c5e20428388542dc95756880413ff573a78745..ff4b43c31c866722d2b46020e67abcdf2e6aca79 100644 --- a/Tests/MaterialLib/TestMPL.cpp +++ b/Tests/MaterialLib/TestMPL.cpp @@ -32,3 +32,24 @@ std::unique_ptr<MPL::Medium> createTestMaterial(std::string const& xml) return MPL::createMedium(config, parameters, nullptr, curves); } + +namespace Tests +{ +std::unique_ptr<MaterialPropertyLib::Property> createTestProperty( + const char xml[], + std::function<std::unique_ptr<MaterialPropertyLib::Property>( + BaseLib::ConfigTree const& config)> + createProperty) +{ + auto const ptree = readXml(xml); + BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, + BaseLib::ConfigTree::onwarning); + auto const& sub_config = conf.getConfigSubtree("property"); + // Parsing the property name: + auto const property_name = + sub_config.getConfigParameter<std::string>("name"); + + return createProperty(sub_config); +} + +} // namespace Tests diff --git a/Tests/MaterialLib/TestMPL.h b/Tests/MaterialLib/TestMPL.h index 9916a31b0e8a307e75c718b59d209efe92230e4b..6f5e9584de6a0e06b631b30fc4d3062149e29d9e 100644 --- a/Tests/MaterialLib/TestMPL.h +++ b/Tests/MaterialLib/TestMPL.h @@ -13,9 +13,31 @@ #pragma once -#include "Tests/TestTools.h" +#include <functional> +#include <memory> #include "MaterialLib/MPL/Medium.h" + namespace MPL = MaterialPropertyLib; +namespace BaseLib +{ +class ConfigTree; +} + +namespace MaterialPropertyLib +{ +class Property; +} + std::unique_ptr<MPL::Medium> createTestMaterial(std::string const& xml); + +namespace Tests +{ +std::unique_ptr<MaterialPropertyLib::Property> createTestProperty( + const char xml[], + std::function<std::unique_ptr<MaterialPropertyLib::Property>( + BaseLib::ConfigTree const& config)> + createProperty); + +} // namespace Tests diff --git a/Tests/MaterialLib/TestMPLCapillaryPressureRegularizedVanGenuchten.cpp b/Tests/MaterialLib/TestMPLCapillaryPressureRegularizedVanGenuchten.cpp index 7561cc4e026f88ebf9f981fe66c3272376e8a2ac..730a2a7fa1d23988dac60dcaf5be728fd32ab182 100644 --- a/Tests/MaterialLib/TestMPLCapillaryPressureRegularizedVanGenuchten.cpp +++ b/Tests/MaterialLib/TestMPLCapillaryPressureRegularizedVanGenuchten.cpp @@ -27,23 +27,6 @@ namespace MPL = MaterialPropertyLib; -std::unique_ptr<MaterialPropertyLib::Property> createTestProperty( - const char xml[], - std::function<std::unique_ptr<MaterialPropertyLib::Property>( - BaseLib::ConfigTree const& config)> - createProperty) -{ - auto const ptree = readXml(xml); - BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, - BaseLib::ConfigTree::onwarning); - auto const& sub_config = conf.getConfigSubtree("property"); - // Parsing the property name: - auto const property_name = - sub_config.getConfigParameter<std::string>("name"); - - return createProperty(sub_config); -} - TEST(MaterialPropertyLib, CapillaryPressureRegularizedVanGenuchten) { const char xml_pc_S[] = @@ -55,7 +38,7 @@ TEST(MaterialPropertyLib, CapillaryPressureRegularizedVanGenuchten) " <exponent>0.6</exponent>" " <p_b>1.e+4</p_b>" "</property>"; - auto const capillary_pressure_property_ptr = createTestProperty( + auto const capillary_pressure_property_ptr = Tests::createTestProperty( xml_pc_S, MPL::createCapillaryPressureRegularizedVanGenuchten); MPL::Property const& capillary_pressure_property =