1 #define BOOST_TEST_MODULE (ParentageRegistry_t) 2 #include "boost/test/unit_test.hpp" 8 #include "hep_concurrency/simultaneous_function_spawner.h" 16 BOOST_AUTO_TEST_SUITE(ParentageTest)
20 using ParentNames = std::vector<std::string>;
21 using ParentProductIDs = std::vector<ProductID>;
23 std::vector<ParentProductIDs> setsOfParents;
25 std::vector<ParentNames> setsOfParentNames{
26 {
"p1a",
"p1b",
"p1c"}, {
"p2a",
"p2b",
"p2c",
"p2d"}, {
"p3a",
"p3b"}};
28 std::back_inserter(setsOfParents),
29 [](
auto const& parentNames) {
30 ParentProductIDs pids;
33 std::back_inserter(pids),
40 std::vector<Parentage> parentages;
42 std::back_inserter(parentages),
43 [](
auto const& parents) {
return Parentage{parents}; });
47 std::vector<std::function<void()>> tasks;
49 parentages, std::back_inserter(tasks), [](
auto const&
p) {
52 hep::concurrency::simultaneous_function_spawner sfs{tasks};
59 std::vector<Parentage> retrievedParentages(parentages.size());
60 std::vector<std::function<void()>> tasks;
63 [&retrievedParentages, &tasks](std::size_t
const i,
auto const&
h) {
64 auto&
entry = retrievedParentages[i];
65 tasks.push_back([&
h, &
entry] {
71 hep::concurrency::simultaneous_function_spawner sfs{tasks};
72 BOOST_TEST(parentages == retrievedParentages);
76 BOOST_AUTO_TEST_SUITE_END()
void for_all_with_index(FwdCont &, Func)
BOOST_AUTO_TEST_CASE(concurrent_insertion_reading)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
static collection_type const & get()
auto transform_all(Container &, OutputIt, UnaryOp)
static auto emplace(value_type const &value)