Skip to content

Commit a1c421d

Browse files
authored
[test] fix merge substitution
1 parent 8359d72 commit a1c421d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

io/io/test/TFileMergerTests.cxx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,19 @@ TEST(TFileMerger, MergeBranches)
142142
ASSERT_TRUE(dummy.FindBranch("a") != nullptr);
143143
ASSERT_TRUE(dummy.FindBranch("b") == nullptr);
144144
EXPECT_EQ(dummy.FindBranch("a")->GetEntries(), 2);
145+
EXPECT_EQ(atree.FindBranch("a")->GetEntries(), 2); // atree has now 2 entries instead of zero since it was used as skeleton for dummy
145146
file2->Write();
146147

147148
// Case 3 - This (NoEntries) + 2 entries
149+
TTree a0tree("a0tree", "a0title"); // We cannot reuse atree since it was cannibalized by dummy
150+
a0tree.Branch("a", &value);
148151
treelist.Clear();
149152
treelist.Add(&abtree);
150153
std::unique_ptr<TFile> file3(TFile::Open("d_4716.root", "RECREATE"));
151154
TFileMergeInfo info3(file3.get());
152-
atree.Merge(&treelist, &info3);
153-
ASSERT_TRUE(atree.FindBranch("a") != nullptr);
154-
ASSERT_TRUE(atree.FindBranch("b") == nullptr);
155-
EXPECT_EQ(atree.FindBranch("a")->GetEntries(), 2);
155+
a0tree.Merge(&treelist, &info3);
156+
ASSERT_TRUE(a0tree.FindBranch("a") != nullptr);
157+
ASSERT_TRUE(a0tree.FindBranch("b") == nullptr);
158+
EXPECT_EQ(a0tree.FindBranch("a")->GetEntries(), 2);
156159
file3->Write();
157160
}

0 commit comments

Comments
 (0)