diff --git a/Tests/BaseLib/TestConfigTree.cpp b/Tests/BaseLib/TestConfigTree.cpp index ff5568b9a97df4e8a76f888638effc9b2b9364fc..c75db7edcb4d7984841527b64480452f2a689930 100644 --- a/Tests/BaseLib/TestConfigTree.cpp +++ b/Tests/BaseLib/TestConfigTree.cpp @@ -120,7 +120,7 @@ TEST(BaseLibConfigTree, Get) "<vector_bad1>x 1 2a</vector_bad1>" "<vector_bad2>0 1 2a</vector_bad2>" ; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { @@ -256,7 +256,7 @@ TEST(BaseLibConfigTree, IncompleteParse) "<pt x=\"0.5\">1</pt>" "<pt2 x=\"0.5\" y=\"1.0\" z=\"2.0\" />" ; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { @@ -297,7 +297,7 @@ TEST(BaseLibConfigTree, CheckRange) "<int>0</int>" "<int>1</int>" "<int>2</int>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { @@ -336,7 +336,7 @@ TEST(BaseLibConfigTree, GetSubtreeList) "<val><int>0</int></val>" "<val><int>1</int></val>" "<val><int>2</int></val>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { @@ -368,7 +368,7 @@ TEST(BaseLibConfigTree, GetParamList) "<int>2</int>" "<int2 a=\"b\">3</int2>" "<int3>4<error/></int3>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { @@ -419,7 +419,7 @@ TEST(BaseLibConfigTree, GetValueList) "<int>0</int>" "<int>1</int>" "<int>2</int>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { @@ -454,7 +454,7 @@ TEST(BaseLibConfigTree, NoConversion) "<ign/>" "<ign2/><ign2/><ign2/>" ; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { @@ -506,7 +506,7 @@ TEST(BaseLibConfigTree, NoConversion) TEST(BaseLibConfigTree, BadKeynames) { const char xml[] = ""; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { @@ -550,7 +550,7 @@ TEST(BaseLibConfigTree, StringLiterals) const char xml[] = "<s>test</s>" "<t>Test</t>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { @@ -576,7 +576,7 @@ TEST(BaseLibConfigTree, MoveConstruct) "<s>test</s>" "<t>Test</t>" "<u>data</u>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { @@ -620,7 +620,7 @@ TEST(BaseLibConfigTree, MoveAssign) "<s>test</s>" "<t>Test</t>" "<u>data</u>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); Callbacks cbs; { diff --git a/Tests/MaterialLib/TestCapillaryPressureSaturationModel.cpp b/Tests/MaterialLib/TestCapillaryPressureSaturationModel.cpp index 22824522f544c41fa3a2ef17f9906e1112c9d5b5..425953b2ff5c690c68a11d6d9a3dfc35c1e44c5b 100644 --- a/Tests/MaterialLib/TestCapillaryPressureSaturationModel.cpp +++ b/Tests/MaterialLib/TestCapillaryPressureSaturationModel.cpp @@ -28,7 +28,7 @@ using namespace MaterialLib::PorousMedium; std::unique_ptr<CapillaryPressureSaturation> createCapillaryPressureModel( const char xml[]) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("capillary_pressure"); diff --git a/Tests/MaterialLib/TestFluidDensity.cpp b/Tests/MaterialLib/TestFluidDensity.cpp index 9e459749b2200aa6e4f9113bf741847f04297667..1b6bf024d9134721157dc1890820c23a631f0340 100644 --- a/Tests/MaterialLib/TestFluidDensity.cpp +++ b/Tests/MaterialLib/TestFluidDensity.cpp @@ -28,7 +28,7 @@ using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType; // Test density models. std::unique_ptr<FluidProperty> createTestFluidDensityModel(const char xml[]) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("density"); diff --git a/Tests/MaterialLib/TestFluidProperties.cpp b/Tests/MaterialLib/TestFluidProperties.cpp index a09d31572bb7fcc91592ddaba77a7243c16a2e75..8d41ff57eabbe454d69232925a78db8d882439b3 100644 --- a/Tests/MaterialLib/TestFluidProperties.cpp +++ b/Tests/MaterialLib/TestFluidProperties.cpp @@ -30,7 +30,7 @@ using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType; std::unique_ptr<FluidProperties> createTestFluidProperties(const char xml[]) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("fluid"); diff --git a/Tests/MaterialLib/TestFluidSpecificHeatCapacityModel.cpp b/Tests/MaterialLib/TestFluidSpecificHeatCapacityModel.cpp index abb9d1e8af8766b57cdc547cd67a62d0d8635c79..6beeed8cceb19fab8d500c4e5da65a8ea6c9ee9c 100644 --- a/Tests/MaterialLib/TestFluidSpecificHeatCapacityModel.cpp +++ b/Tests/MaterialLib/TestFluidSpecificHeatCapacityModel.cpp @@ -30,7 +30,7 @@ using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType; std::unique_ptr<FluidProperty> createSpecificFluidHeatCapacityModel( const char xml[]) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("specific_heat_capacity"); diff --git a/Tests/MaterialLib/TestFluidThermalConductivityModel.cpp b/Tests/MaterialLib/TestFluidThermalConductivityModel.cpp index 67b2e33cd72f3ab699d402f0d3c0e80043d61c74..eef10327548080885697c197cd4309323528ccab 100644 --- a/Tests/MaterialLib/TestFluidThermalConductivityModel.cpp +++ b/Tests/MaterialLib/TestFluidThermalConductivityModel.cpp @@ -31,7 +31,7 @@ using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType; std::unique_ptr<FluidProperty> createFluidThermalConductivityModel( const char xml[]) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("thermal_conductivity"); diff --git a/Tests/MaterialLib/TestFluidViscosity.cpp b/Tests/MaterialLib/TestFluidViscosity.cpp index 3130935ec4e37cc37e402f1b65fd05f2db7fbad7..6a7bef22790ae714c7e55d56c589e2f3bb45a291 100644 --- a/Tests/MaterialLib/TestFluidViscosity.cpp +++ b/Tests/MaterialLib/TestFluidViscosity.cpp @@ -27,7 +27,7 @@ using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType; std::unique_ptr<FluidProperty> createTestViscosityModel(const char xml[]) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("viscosity"); diff --git a/Tests/MaterialLib/TestMPL.cpp b/Tests/MaterialLib/TestMPL.cpp index 0dcb8795121036017dad61cc1dd003596f20de4e..7ed654f1689acac2e6bd1fb7a2bc8e53f3c23325 100644 --- a/Tests/MaterialLib/TestMPL.cpp +++ b/Tests/MaterialLib/TestMPL.cpp @@ -18,12 +18,13 @@ #include "MaterialLib/MPL/CreateMedium.h" #include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h" #include "ParameterLib/Parameter.h" +#include "Tests/TestTools.h" namespace Tests { std::unique_ptr<MPL::Medium> createTestMaterial(std::string const& xml) { - auto const ptree = readXml(xml.c_str()); + auto const ptree = Tests::readXml(xml.c_str()); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& config = conf.getConfigSubtree("medium"); @@ -41,7 +42,7 @@ std::unique_ptr<MaterialPropertyLib::Property> createTestProperty( BaseLib::ConfigTree const& config)> createProperty) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("property"); diff --git a/Tests/MaterialLib/TestPorousMediumStorage.cpp b/Tests/MaterialLib/TestPorousMediumStorage.cpp index 29bdda8b84fb8fc0d060b9bc7dcc2f056aea9ae1..bc475ed885c79afd13c1c3fac3b87aeb40a12447 100644 --- a/Tests/MaterialLib/TestPorousMediumStorage.cpp +++ b/Tests/MaterialLib/TestPorousMediumStorage.cpp @@ -24,7 +24,7 @@ using namespace MaterialLib::PorousMedium; std::unique_ptr<Storage> createTestStorageModel(const char xml[]) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("storage"); diff --git a/Tests/MaterialLib/TestRelativePermeabilityModel.cpp b/Tests/MaterialLib/TestRelativePermeabilityModel.cpp index e69e43900b8e552e0509374cc51000438d1e268f..b4cae71a6f2fb006c83f00363e371fe690035dfe 100644 --- a/Tests/MaterialLib/TestRelativePermeabilityModel.cpp +++ b/Tests/MaterialLib/TestRelativePermeabilityModel.cpp @@ -28,7 +28,7 @@ using namespace MaterialLib::PorousMedium; std::unique_ptr<RelativePermeability> createRelativePermeabilityModel( const char xml[]) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("relative_permeability"); diff --git a/Tests/MathLib/TestLinearSolver.cpp b/Tests/MathLib/TestLinearSolver.cpp index 417b49f512d910d8668dfa67bc9e1a7f23d691cd..b0a5cf497cccc911841b6f0002a9cfbfb9cb09f1 100644 --- a/Tests/MathLib/TestLinearSolver.cpp +++ b/Tests/MathLib/TestLinearSolver.cpp @@ -283,7 +283,7 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_basic) " </parameters>" " <prefix>ptest1</prefix>" "</petsc>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector, @@ -317,7 +317,7 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_chebyshev_sor) " </parameters>" " <prefix>ptest2</prefix>" "</petsc>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector, @@ -353,7 +353,7 @@ TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_gmres_amg) " </parameters>" " <prefix>ptest3</prefix>" "</petsc>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); checkLinearSolverInterface<MathLib::PETScMatrix, MathLib::PETScVector, diff --git a/Tests/MathLib/TestPiecewiseLinearCurve.cpp b/Tests/MathLib/TestPiecewiseLinearCurve.cpp index 750cbaaaf4245b83cdb635baf305482df84f8859..37bcef80f91d32edb69018b86bbd50ddd7a55433 100644 --- a/Tests/MathLib/TestPiecewiseLinearCurve.cpp +++ b/Tests/MathLib/TestPiecewiseLinearCurve.cpp @@ -24,7 +24,7 @@ template <typename CurveType> std::unique_ptr<CurveType> createPiecewiseLinearCurve(const char xml[]) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("curve"); diff --git a/Tests/NumLib/TestODEInt.cpp b/Tests/NumLib/TestODEInt.cpp index c216470fe0d3bfc839a619dee320b85aa0ce5e30..1e7e4467aa1f6be9119cbb7b5b9a1ae7609b5498 100644 --- a/Tests/NumLib/TestODEInt.cpp +++ b/Tests/NumLib/TestODEInt.cpp @@ -41,7 +41,7 @@ createLinearSolver() "<petsc><parameters>" "-ksp_type bcgs -pc_type sor -ksp_rtol 1e-24 -ksp_max_it 100 -ksp_initial_guess_nonzero false" "</parameters></petsc>"; - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree config(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); return std::make_unique<GlobalLinearSolver>("", &config); diff --git a/Tests/NumLib/TestTimeSteppingEvolutionaryPIDcontroller.cpp b/Tests/NumLib/TestTimeSteppingEvolutionaryPIDcontroller.cpp index 74d297a3c4b828944a86263357448373272e8f9e..81f00799763b1acb6995de952f93d244fd970f2d 100644 --- a/Tests/NumLib/TestTimeSteppingEvolutionaryPIDcontroller.cpp +++ b/Tests/NumLib/TestTimeSteppingEvolutionaryPIDcontroller.cpp @@ -25,7 +25,7 @@ std::unique_ptr<NumLib::TimeStepAlgorithm> createTestTimeStepper( const char xml[]) { - auto const ptree = readXml(xml); + auto const ptree = Tests::readXml(xml); BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto const& sub_config = conf.getConfigSubtree("time_stepping"); diff --git a/Tests/ParameterLib/Parameter.cpp b/Tests/ParameterLib/Parameter.cpp index ababafa72d26265bf2b6da050bde886e4d25379a..b35966abb1d8599e5a97894a56e12b4871f604db 100644 --- a/Tests/ParameterLib/Parameter.cpp +++ b/Tests/ParameterLib/Parameter.cpp @@ -35,7 +35,7 @@ std::unique_ptr<Parameter<double>> constructParameterFromString( std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const& curves = {}) { - auto const xml_ptree = readXml(xml.c_str()); + auto const xml_ptree = Tests::readXml(xml.c_str()); BaseLib::ConfigTree config_tree(xml_ptree, "", BaseLib::ConfigTree::onerror, BaseLib::ConfigTree::onwarning); auto parameter_base = createParameter(config_tree, meshes, curves); diff --git a/Tests/TestTools.cpp b/Tests/TestTools.cpp index ae7772f8b5869e8bf475ac40b02fa3fa20e7f1d4..98ff64c9484f76251c8c30dc9d1c12f5e19262d8 100644 --- a/Tests/TestTools.cpp +++ b/Tests/TestTools.cpp @@ -11,8 +11,9 @@ #include "Tests/TestTools.h" -boost::property_tree::ptree -readXml(const char xml[]) +namespace Tests +{ +boost::property_tree::ptree readXml(const char xml[]) { boost::property_tree::ptree ptree; std::istringstream xml_str(xml); @@ -22,3 +23,5 @@ readXml(const char xml[]) boost::property_tree::xml_parser::trim_whitespace); return ptree; } + +} // namespace Tests diff --git a/Tests/TestTools.h b/Tests/TestTools.h index 6a9bce301c5d90ba9bdacfff09cb414f80a0ed0c..f15110466d9ddc45c80ea02cb11dcbcd812fa898 100644 --- a/Tests/TestTools.h +++ b/Tests/TestTools.h @@ -24,6 +24,7 @@ #define ASSERT_ARRAY_EQ(E,A,N)\ for (std::size_t i=0; i<(unsigned)(N); i++) \ ASSERT_EQ((E)[i], (A)[i]); - -boost::property_tree::ptree -readXml(const char xml[]); +namespace Tests +{ +boost::property_tree::ptree readXml(const char xml[]); +} // namespace Tests