Skip to content

Commit 91dbbf3

Browse files
authored
[test] fix dictionary generation
1 parent 232bd3e commit 91dbbf3

File tree

6 files changed

+41
-16
lines changed

6 files changed

+41
-16
lines changed

tree/tree/test/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66

77

88
ROOT_GENERATE_DICTIONARY(ElementStructDict ElementStruct.h LINKDEF ElementStructLinkDef.h OPTIONS -inlineInputHeader)
9+
ROOT_GENERATE_DICTIONARY(TestRefObjDict TestRefObj.h LINKDEF TestRefObjLinkDef.h OPTIONS -inlineInputHeader)
910
ROOT_ADD_GTEST(testTOffsetGeneration TOffsetGeneration.cxx ElementStruct.cxx ElementStructDict.cxx
1011
LIBRARIES RIO Tree MathCore
1112
)
13+
ROOT_ADD_GTEST(testClonesArray testClonesArray.cxx TestRefObj.cxx TestRefObjDict.cxx LIBRARIES RIO Tree)
1214
if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja)
1315
add_custom_command(TARGET testTOffsetGeneration POST_BUILD
1416
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libElementStructDict_rdict.pcm
1517
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/libElementStructDict_rdict.pcm)
18+
add_custom_command(TARGET testClonesArray POST_BUILD
19+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libTestRefObjDict_rdict.pcm
20+
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/libTestRefObjDict_rdict.pcm)
1621
endif()
1722
target_include_directories(testTOffsetGeneration PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
1823
ROOT_STANDARD_LIBRARY_PACKAGE(SillyStruct NO_INSTALL_HEADERS HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/SillyStruct.h SOURCES SillyStruct.cxx LINKDEF SillyStructLinkDef.h DEPENDENCIES RIO)
@@ -36,7 +41,6 @@ ROOT_ADD_GTEST(testTChainSaveAsCxx TChainSaveAsCxx.cxx LIBRARIES RIO Tree)
3641
ROOT_ADD_GTEST(testTChainRegressions TChainRegressions.cxx LIBRARIES RIO Tree)
3742
ROOT_ADD_GTEST(testTTreeTruncatedDatatypes TTreeTruncatedDatatypes.cxx LIBRARIES RIO Tree)
3843
ROOT_ADD_GTEST(testTTreeRegressions TTreeRegressions.cxx LIBRARIES RIO Tree)
39-
ROOT_ADD_GTEST(testClonesArray testClonesArray.cxx LIBRARIES RIO Tree)
4044
ROOT_ADD_GTEST(entrylist_addsublist entrylist_addsublist.cxx LIBRARIES RIO Tree)
4145
ROOT_ADD_GTEST(chain_setentrylist chain_setentrylist.cxx LIBRARIES RIO Tree)
4246
ROOT_ADD_GTEST(entrylist_enter entrylist_enter.cxx LIBRARIES RIO Tree)

tree/tree/test/ElementStruct.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef ELEMENTSTRUCT_H
2+
#define ELEMENTSTRUCT_H
13
/**
24
* The ElementStruct has no purpose except to provide
35
* inputs to the test cases.
@@ -8,3 +10,4 @@ class ElementStruct {
810
int i;
911
double *d; //[i]
1012
};
13+
#endif

tree/tree/test/TestRefObj.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "TestRefObj.h"

tree/tree/test/TestRefObj.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#ifndef TESTREFOBJ_H
2+
#define TESTREFOBJ_H
3+
4+
#include "TRef.h"
5+
#include "TRefArray.h"
6+
7+
// https://its.cern.ch/jira/browse/ROOT-7249
8+
class TestRefObj : public TObject {
9+
protected:
10+
TRefArray lChildren;
11+
12+
public:
13+
TestRefObj() : lChildren() {}
14+
virtual ~TestRefObj() {}
15+
virtual void Clear(Option_t *opt = "C") { lChildren.Clear(opt); }
16+
virtual void SetChild(TestRefObj *aChild) { lChildren.Add(aChild); }
17+
virtual const TestRefObj *GetChild(Int_t idx = 0) const { return static_cast<TestRefObj *>(lChildren.At(idx)); }
18+
virtual Bool_t HasChild() const { return (lChildren.GetEntriesFast() > 0); }
19+
ClassDef(TestRefObj, 1);
20+
};
21+
22+
#endif

tree/tree/test/TestRefObjLinkDef.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifdef __CLING__
2+
3+
#pragma link off all globals;
4+
#pragma link off all classes;
5+
#pragma link off all functions;
6+
7+
#pragma link C++ class TestRefObj+;
8+
9+
#endif

tree/tree/test/testClonesArray.cxx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "TObject.h"
2-
#include "TRef.h"
3-
#include "TRefArray.h"
2+
#include "TestRefObj.h"
43
#include "TFile.h"
54
#include "TTree.h"
65
#include "TRandom.h"
@@ -11,19 +10,6 @@
1110
#include "gtest/gtest.h"
1211

1312
// https://its.cern.ch/jira/browse/ROOT-7249
14-
class TestRefObj : public TObject {
15-
protected:
16-
TRefArray lChildren;
17-
18-
public:
19-
TestRefObj() : lChildren() {}
20-
virtual ~TestRefObj() {}
21-
virtual void Clear(Option_t *opt = "C") { lChildren.Clear(opt); }
22-
virtual void SetChild(TestRefObj *aChild) { lChildren.Add(aChild); }
23-
virtual const TestRefObj *GetChild(Int_t idx = 0) const { return static_cast<TestRefObj *>(lChildren.At(idx)); }
24-
virtual Bool_t HasChild() const { return (lChildren.GetEntriesFast() > 0); }
25-
ClassDef(TestRefObj, 1);
26-
};
2713
TEST(TClonesArray, RefArrayClearChildren)
2814
{
2915
Bool_t resetObjectCount = kTRUE;

0 commit comments

Comments
 (0)