Skip to content
Snippets Groups Projects
Commit dea6a79b authored by Danilo Piparo's avatar Danilo Piparo
Browse files

[DF] Add test for HasColumn and change test file name

parent 91fb25a5
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#### C++ TESTS #### #### C++ TESTS ####
ROOT_ADD_GTEST(dataframe_friends dataframe_friends.cxx LIBRARIES ROOTDataFrame) ROOT_ADD_GTEST(dataframe_friends dataframe_friends.cxx LIBRARIES ROOTDataFrame)
ROOT_ADD_GTEST(dataframe_alias dataframe_aliases.cxx LIBRARIES ROOTDataFrame) ROOT_ADD_GTEST(dataframe_colnames dataframe_colnames.cxx LIBRARIES ROOTDataFrame)
ROOT_ADD_GTEST(dataframe_cache dataframe_cache.cxx LIBRARIES ROOTDataFrame) ROOT_ADD_GTEST(dataframe_cache dataframe_cache.cxx LIBRARIES ROOTDataFrame)
ROOT_ADD_GTEST(dataframe_callbacks dataframe_callbacks.cxx LIBRARIES ROOTDataFrame) ROOT_ADD_GTEST(dataframe_callbacks dataframe_callbacks.cxx LIBRARIES ROOTDataFrame)
ROOT_ADD_GTEST(dataframe_histomodels dataframe_histomodels.cxx LIBRARIES ROOTDataFrame) ROOT_ADD_GTEST(dataframe_histomodels dataframe_histomodels.cxx LIBRARIES ROOTDataFrame)
......
...@@ -2,6 +2,34 @@ ...@@ -2,6 +2,34 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
TEST(ColNames, HasColumn)
{
// From scratch
ROOT::RDataFrame fromScratch(1);
EXPECT_TRUE(fromScratch.HasColumn("rdfentry_"));
EXPECT_TRUE(fromScratch.HasColumn("rdfslot_"));
auto rdf = fromScratch.Define("def", [](){return 0;}).Alias("alias", "def");
EXPECT_TRUE(rdf.HasColumn("def"));
EXPECT_TRUE(rdf.HasColumn("alias"));
// From tree
TTree t("t","t");
int i;
t.Branch("branch", &i);
ROOT::RDataFrame fromTree(t);
EXPECT_TRUE(fromTree.HasColumn("branch"));
// From Source
auto fromSource = rdf.Cache<int>({"def"});
EXPECT_TRUE(fromSource.HasColumn("def"));
}
TEST(Aliases, DefineOnAlias) TEST(Aliases, DefineOnAlias)
{ {
ROOT::RDataFrame tdf(2); ROOT::RDataFrame tdf(2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment