Skip to content

Commit bc50e58

Browse files
Brinick Simmonssawenzel
authored andcommitted
ConfigurableParam: add a unit test for setValue
Add an explicit test for the two ways of calling setValue for a parameter.
1 parent 4f69862 commit bc50e58

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Detectors/TPC/base/test/testTPCParameters.cxx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,20 @@ BOOST_AUTO_TEST_CASE(ParameterGas_test2)
186186
BOOST_CHECK_CLOSE(o2::conf::ConfigurableParam::getValueAs<float>("TPCGasParam.BetheBlochParam[4]"), 16.f, 1e-12);
187187
}
188188

189+
/// \brief Trivial test of the two ways to setValue for a ConfigurableParameter
190+
/// Precision: 1E-3 %
191+
BOOST_AUTO_TEST_CASE(setValues_test1)
192+
{
193+
BOOST_CHECK_CLOSE(ParameterGas::Instance().Wion, o2::conf::ConfigurableParam::getValueAs<float>("TPCGasParam.Wion"), 1e-3);
194+
o2::conf::ConfigurableParam::setValue<float>("TPCGasParam", "Wion", 3.0);
195+
BOOST_CHECK_CLOSE(ParameterGas::Instance().Wion, 3.0, 1e-3);
196+
BOOST_CHECK_CLOSE(o2::conf::ConfigurableParam::getValueAs<float>("TPCGasParam.Wion"), 3.0, 1e-3);
197+
o2::conf::ConfigurableParam::setValue("TPCGasParam.Wion", "5.0");
198+
BOOST_CHECK_CLOSE(ParameterGas::Instance().Wion, 5.0, 1e-3);
199+
BOOST_CHECK_CLOSE(o2::conf::ConfigurableParam::getValueAs<float>("TPCGasParam.Wion"), 5.0, 1e-3);
200+
ParameterGas::Instance().printKeyValues(true);
201+
}
202+
189203
/// \brief Trivial test of the default initialization of Parameter GEM
190204
/// Precision: 1E-3 %
191205
///

0 commit comments

Comments
 (0)