19 #define BOOST_TEST_MODULE ( PointIsolationAlg_test ) 20 #include "boost/test/unit_test.hpp" 30 #include "TInterpreter.h" 31 #include "TClassEdit.h" 41 TInterpreter* interpreter = gROOT->GetInterpreter();
45 char* classNameC = TClassEdit::DemangleTypeIdName(
typeid(
T), err);
49 TClassEdit::GetNormalizedName(normalizedClassName, classNameC);
52 std::free(classNameC);
55 return interpreter->GenerateTClass(normalizedClassName.c_str(), kTRUE, kTRUE);
72 QuickGenerateTClass<MyAssns_t>();
77 std::array<std::pair<Index_t, std::vector<Index_t>>, 3U>
expected;
78 expected[0] = { 0, { 0, 3, 6 } };
79 expected[1] = { 1, { 2, 4, 6 } };
80 expected[2] = { 3, { 8, 10, 12, 13 } };
85 for (
auto const& pair: expected) {
86 auto const& aIndex = pair.first;
87 for (
auto const& bIndex: pair.second) {
88 assns.addSingle({ aPID, aIndex,
nullptr }, { bPID, bIndex,
nullptr });
92 std::vector<std::pair<Index_t, std::vector<Index_t>>> results;
94 std::cout <<
"Association group #" << results.size() <<
":" <<
std::endl;
95 std::vector<Index_t> myBs;
96 myBs.reserve(Bs.size());
99 myBs.push_back(
B.key());
101 results.emplace_back(
A.key(),
std::move(myBs));
105 std::cout <<
"Starting check..." <<
std::endl;
106 BOOST_TEST(results.size() == expected.size());
109 auto const& [
A, Bs ] =
result;
110 auto const& [ expectedA, expectedBs ] =
expected;
111 BOOST_TEST_MESSAGE(
" element #" << i <<
", A=" << expectedA);
112 BOOST_TEST(
A == expectedA);
113 BOOST_CHECK_EQUAL_COLLECTIONS
114 (Bs.cbegin(), Bs.cend(), expectedBs.cbegin(), expectedBs.cend());
void associated_groups_with_left_test()
auto associated_groups_with_left(A const &assns)
Helper functions to access associations in order, also with key.
Definition of util::enumerate().
unsigned int Index_t
Type to denote the index of the flag.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
TClass * QuickGenerateTClass()
void err(const char *fmt,...)
BOOST_AUTO_TEST_CASE(AssociatedGroupsWithLeftTestCase)
Helper functions to access associations in order.
QTextStream & endl(QTextStream &s)