1 #define BOOST_TEST_MODULE (ProcessHistoryRegistry_t) 2 #include "boost/test/unit_test.hpp" 9 #include "hep_concurrency/simultaneous_function_spawner.h" 19 makeProcessConfiguration(
std::string const& process_name,
23 moduleParams.
put(
"module_type",
"IntProducer"s);
24 moduleParams.
put(
"module_label", module_label);
27 processParams.
put(
"process_name", process_name);
28 processParams.
put(module_label, moduleParams);
35 BOOST_AUTO_TEST_SUITE(ProcessHistoryTest)
39 std::vector<ProcessConfiguration> pcs;
40 pcs.push_back(makeProcessConfiguration(
"p1",
"m1"));
41 pcs.push_back(makeProcessConfiguration(
"p2",
"m2"));
42 pcs.push_back(makeProcessConfiguration(
"pA",
"mA"));
43 pcs.push_back(makeProcessConfiguration(
"pB",
"mB"));
45 auto makeProcessHistory = [&pcs](std::size_t
const first,
46 std::size_t
const last) {
53 std::vector<ProcessHistory> histories;
54 histories.push_back(makeProcessHistory(0, 1));
55 histories.push_back(makeProcessHistory(0, 3));
56 histories.push_back(makeProcessHistory(2, 1));
57 histories.push_back(makeProcessHistory(2, 3));
61 std::vector<std::function<void()>> tasks;
65 hep::concurrency::simultaneous_function_spawner sfs{tasks};
72 std::vector<ProcessHistory> retrievedHistories(histories.size());
73 std::vector<std::function<void()>> tasks;
76 [&retrievedHistories, &tasks](std::size_t
const i,
auto const&
h) {
77 auto&
entry = retrievedHistories[i];
78 tasks.push_back([&
h, &
entry] {
84 hep::concurrency::simultaneous_function_spawner sfs{tasks};
85 BOOST_TEST(histories == retrievedHistories);
89 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(concurrent_insertion_reading)
void for_all_with_index(FwdCont &, Func)
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
static collection_type const & get()
std::string const & getReleaseVersion()
auto transform_all(Container &, OutputIt, UnaryOp)
ParameterSetID id() const
void push_back(const_reference t)
static auto emplace(value_type const &value)
void put(std::string const &key)