Skip to content
Snippets Groups Projects
Commit d67a2ac9 authored by Enrico Guiraud's avatar Enrico Guiraud
Browse files

[DF] Add a test for the PassAsVec RDF helper

parent 6361c830
No related branches found
No related tags found
No related merge requests found
#include <ROOT/RDataFrame.hxx>
#include <ROOT/RDFHelpers.hxx>
#include "gtest/gtest.h"
#include <ROOT/RVec.hxx>
#include <algorithm>
#include <deque>
#include <vector>
#include "gtest/gtest.h"
using namespace ROOT;
using namespace ROOT::RDF;
using namespace ROOT::VecOps;
struct TrueFunctor {
bool operator()() const { return true; }
......@@ -32,3 +37,15 @@ TEST(RDFHelpers, Not)
EXPECT_EQ(1u, *RDataFrame(1).Filter(Not(Not(l))).Count());
}
TEST(RDFHelpers, PassAsVec)
{
auto One = [] { return 1; };
auto df = RDataFrame(1).Define("one", One).Define("_1", One);
auto TwoOnes = [](const std::vector<int> &v) { return v.size() == 2 && v[0] == 1 && v[1] == 1; };
EXPECT_EQ(1u, *df.Filter(PassAsVec<2, int>(TwoOnes), {"one", "_1"}).Count());
auto TwoOnesRVec = [](const RVec<int> &v) { return v.size() == 2 && All(v == 1); };
EXPECT_EQ(1u, *df.Filter(PassAsVec<2, int>(TwoOnesRVec), {"one", "_1"}).Count());
auto TwoOnesDeque = [](const std::deque<int> &v) { return v.size() == 2 && v[0] == 1 && v[1] == 1; };
EXPECT_EQ(1u, *df.Filter(PassAsVec<2, int>(TwoOnesDeque), {"one", "_1"}).Count());
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment