1 #define BOOST_TEST_MODULE (make_tool_t) 2 #include "boost/test/unit_test.hpp" 17 pset_from_oss(std::ostringstream
const& ss)
25 BOOST_AUTO_TEST_SUITE(make_tool_t)
30 ps.
put(
"tool_type",
"ClassTool"s);
31 auto t1 = art::make_tool<arttest::ClassTool>(
ps);
32 BOOST_TEST(
t1->addOne(17) == 18);
38 ps.
put(
"tool_type",
"FunctionTool"s);
40 auto addOne1 = art::make_tool<decltype(arttest::addOne)>(
ps,
"addOne");
41 auto addOne2 = art::make_tool<int(int)>(
ps,
"addOne");
42 BOOST_TEST(addOne1(i) == 18);
43 BOOST_TEST(addOne2(i) == 18);
48 std::ostringstream ss;
49 ss <<
"tool_type: NestedFunctionTool\n" 51 <<
" tool_type: FunctionTool" 53 auto const& ps = pset_from_oss(ss);
55 art::make_tool<decltype(arttest::callThroughToAddOne)>(
56 ps,
"callThroughToAddOne");
63 std::ostringstream ss;
64 ss <<
"tool_type: NestedClassTool\n" 66 <<
" tool_type: ClassTool" 68 auto const& ps = pset_from_oss(ss);
69 auto t = art::make_tool<arttest::NestedClassTool>(
ps);
70 BOOST_TEST(
t->callThroughToAddOne(17) == 18);
75 std::ostringstream ss;
76 ss <<
"tool_type: NestedFunctionInClassTool\n" 78 <<
" tool_type: FunctionTool" 80 auto const& ps = pset_from_oss(ss);
81 auto t = art::make_tool<arttest::NestedFunctionInClassTool>(
ps);
82 BOOST_TEST(
t->callThroughToAddOne(17) == 18);
90 ps.
put(
"tool_type",
"AddNumber");
91 ps.
put(
"incrementBy", 7);
92 art::make_tool<arttest::OperationBase>(
ps)->adjustNumber(i);
97 ps.
put(
"tool_type",
"SubtractNumber");
98 art::make_tool<arttest::OperationBase>(
ps)->adjustNumber(i);
103 ps.
put(
"tool_type",
"MultiplyNumber");
104 art::make_tool<arttest::OperationBase>(
ps)->adjustNumber(i);
109 BOOST_AUTO_TEST_SUITE_END()
static ParameterSet make(intermediate_table const &tbl)
static constexpr double ps
int callThroughToAddOne(fhicl::ParameterSet const &pset, int const i)
void put(std::string const &key)