Skip to content

Commit

Permalink
[df] Add regression test for #12043
Browse files Browse the repository at this point in the history
  • Loading branch information
vepadulano committed Oct 3, 2023
1 parent f7d9db5 commit a561750
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tree/dataframe/test/dataframe_definepersample.cxx
Expand Up @@ -157,6 +157,24 @@ TEST(DefinePerSampleMore, GetDefinedColumnNames)
EXPECT_EQ(df.GetDefinedColumnNames(), std::vector<std::string>{"x"});
}

// Regression test for https://github.com/root-project/root/issues/12043
TEST(DefinePerSample, TwoExecutions)
{
bool flag = false;
auto df = ROOT::RDataFrame(1).DefinePerSample("x", [&flag](unsigned int, const ROOT::RDF::RSampleInfo &) {
flag = true;
return 0;
});
// Trigger the first execution of the event loop, the flag should be true.
df.Count().GetValue();
EXPECT_TRUE(flag);
// Reset the flag and trigger again, flag should be again set to true after
// the end of the second event loop.
flag = false;
df.Count().GetValue();
EXPECT_TRUE(flag);
}

/* TODO
// Not supported yet
TEST(DefinePerSample, DataSource)
Expand Down

0 comments on commit a561750

Please sign in to comment.