Skip to content

Commit 9558f29

Browse files
committed
Add test for ROOT-10804.
1 parent bc241b0 commit 9558f29

File tree

6 files changed

+129
-0
lines changed

6 files changed

+129
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ROOTTEST_GENERATE_REFLEX_DICTIONARY(ROOT10804 ROOT10804.h SELECTION selection.xml)
2+
set(depends ${GENERATE_REFLEX_TEST})
3+
4+
ROOTTEST_ADD_TEST(execROOT10804
5+
MACRO execROOT10804.C
6+
OUTREF execROOT10804.oref
7+
ERRREF execROOT10804.eref
8+
DEPENDS ${depends})

root/meta/ROOT-10804/ROOT10804.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <list>
2+
namespace Outer {
3+
inline namespace Inline {
4+
class Class {
5+
int MEMBER;
6+
};
7+
template <class T>
8+
class Template {
9+
T t;
10+
};
11+
}
12+
template <typename T> class Container {};
13+
}
14+
15+
namespace Instantiations {
16+
// Simulating what the Gaudi experiments do due to legacy gccxml
17+
// "I only see what you instantiate" (not needed anymore with cling).
18+
std::list<Outer::Class> inst1;
19+
Outer::Container<Outer::Class> inst2;
20+
Outer::Template<Outer::Class> inst3;
21+
Outer::Container<Outer::Template<Outer::Class> > inst4;
22+
Outer::Template<Float16_t> inst5;
23+
Outer::Container<Outer::Template<Double32_t> > inst6;
24+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
int numErrors = 0;
2+
3+
void check(const char *what) {
4+
if (!TClassTable::GetProto(what)) {
5+
std::cerr << "FAILED to get TProtoClass for \"" << what << "\"\n";
6+
++numErrors;
7+
}
8+
}
9+
10+
void check_not(const char *what) {
11+
if (TClassTable::GetProto(what)) {
12+
std::cerr << "FAILED to NOT get TProtoClass for \"" << what
13+
<< "\" (expected nullptr but got != nullptr)\n";
14+
++numErrors;
15+
}
16+
}
17+
18+
int execROOT10804() {
19+
if (gSystem->Load("libROOT10804_dictrflx") < 0) {
20+
std::cerr << "Failed to load ROOT10804Dict!\n";
21+
return 1;
22+
}
23+
check("Outer::Inline::Class");
24+
check("Outer::Class");
25+
26+
check("list<Outer::Inline::Class>");
27+
check("list<Outer::Class>");
28+
check("std::list<Outer::Inline::Class>");
29+
check("std::list<Outer::Class>");
30+
31+
check("Outer::Container<Outer::Inline::Class>");
32+
check("Outer::Container<Outer::Inline::Class>");
33+
check("Outer::Container<Outer::Class>");
34+
35+
check("Outer::Inline::Template<Outer::Inline::Class>");
36+
check("Outer::Template<Outer::Inline::Class>");
37+
check("Outer::Inline::Template<Outer::Class>");
38+
check("Outer::Template<Outer::Class>");
39+
40+
check("Outer::Container<"
41+
"Outer::Inline::Template<"
42+
"Outer::Inline::Class>>");
43+
44+
check("Outer::Container<"
45+
"Outer::Inline::Template<"
46+
"Outer::Inline::Class>>>");
47+
48+
check("Outer::Container<"
49+
"Outer::Inline::Template<"
50+
"Outer::Class>>");
51+
check("Outer::Container<"
52+
"Outer::Template<"
53+
"Outer::Inline::Class>>");
54+
55+
check("Outer::Container<"
56+
"Outer::Template<"
57+
"Outer::Class>>");
58+
59+
// Container is not Inline::
60+
check_not("Outer::Inline::Container<"
61+
"Outer::Inline::Template<"
62+
"Outer::Inline::Class>>");
63+
64+
// Float16_t won't get a demangled alternate name,
65+
// only as-written-in-selection.xml
66+
check("Outer::Template<Float16_t>");
67+
// FIXME: can be resolved now that the payload has been parsed.
68+
// And that shows that the test needs to check *one* type name only,
69+
// before parsing the payload.
70+
//!!! check_not("Outer::Inline::Template<Float16_t>");
71+
72+
// Double32_t won't get a demangled alternate name,
73+
// only as-written-in-selection.xml
74+
check("Outer::Container<Outer::Template<Double32_t>>");
75+
// FIXME: can be resolved now that the payload has been parsed.
76+
// And that shows that the test needs to check *one* type name only,
77+
// before parsing the payload.
78+
//!!! check_not("Outer::Container<Outer::Inline::Template<Double32_t>>");
79+
80+
// Cross-check: not selected.
81+
check_not("Outer::Container<int>");
82+
check_not("Outer::Container<Outer::Template<Float16_t>>");
83+
check_not("Outer::Template<float>"); // but did select Template<Float16_t>!
84+
return numErrors ? 1 : 0;
85+
}

root/meta/ROOT-10804/execROOT10804.eref

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
Processing execROOT10804.C...
3+
(int) 0

root/meta/ROOT-10804/selection.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<lcgdict>
2+
<class name="Outer::Class"/>
3+
<class name="list<Outer::Class>"/>
4+
<class name="Outer::Container<Outer::Class>"/>
5+
<class name="Outer::Template<Outer::Class>"/>
6+
<class name="Outer::Container<Outer::Template<Outer::Class> >"/>
7+
<class name="Outer::Template<Float16_t>"/>
8+
<class name="Outer::Container<Outer::Template<Double32_t> >"/>
9+
</lcgdict>

0 commit comments

Comments
 (0)