@@ -68,8 +68,8 @@ class RNTupleDSTest : public ::testing::Test {
6868 auto fldElectron = model->MakeField <Electron>(" electron" );
6969 fldElectron->pt = 137.0 ;
7070 auto fldVecElectron = model->MakeField <std::vector<Electron>>(" VecElectron" );
71- fldVecElectron-> push_back (*fldElectron);
72- fldVecElectron->push_back (*fldElectron);
71+ for ( int i = 0 ; i < 128 ; ++i)
72+ fldVecElectron->push_back (*fldElectron);
7373 auto fldNElectron = std::make_unique<ROOT::RField<ROOT::RNTupleCardinality<std::uint64_t >>>(" nElectron" );
7474 model->AddProjectedField (std::move (fldNElectron), [](const std::string &) { return " VecElectron" ; });
7575 {
@@ -152,17 +152,21 @@ TEST_F(RNTupleDSTest, ProjectedCardinalityColumn)
152152{
153153 auto df = ROOT::RDF::FromRNTuple (fNtplName , fFileName );
154154
155- EXPECT_EQ (2u , *df.Filter (" nElectron == 2" ).Max (" nElectron" ));
156-
157- EXPECT_EQ (2u , *df.Filter ([](std::uint64_t x) { return x == 2 ; }, {" nElectron" }).Max (" nElectron" ));
158- EXPECT_EQ (2u , *df.Filter ([](std::int32_t x) { return x == 2 ; }, {" nElectron" }).Max (" nElectron" ));
159- EXPECT_EQ (2u , *df.Filter ([](std::uint32_t x) { return x == 2 ; }, {" nElectron" }).Max (" nElectron" ));
160- EXPECT_EQ (2u , *df.Filter ([](std::int16_t x) { return x == 2 ; }, {" nElectron" }).Max (" nElectron" ));
161- EXPECT_EQ (2u , *df.Filter ([](std::uint16_t x) { return x == 2 ; }, {" nElectron" }).Max (" nElectron" ));
162- EXPECT_EQ (2u , *df.Filter ([](std::int8_t x) { return x == 2 ; }, {" nElectron" }).Max (" nElectron" ));
163- EXPECT_EQ (2u , *df.Filter ([](std::uint8_t x) { return x == 2 ; }, {" nElectron" }).Max (" nElectron" ));
164- EXPECT_EQ (2u , *df.Filter ([](char x) { return x == 2 ; }, {" nElectron" }).Max (" nElectron" ));
165- EXPECT_EQ (2u , *df.Filter ([](bool x) { return x; }, {" nElectron" }).Max (" nElectron" ));
155+ EXPECT_EQ (128u , *df.Filter (" nElectron == 128" ).Max (" nElectron" ));
156+
157+ EXPECT_EQ (128u , *df.Filter ([](std::uint64_t x) { return x == 128 ; }, {" nElectron" }).Max (" nElectron" ));
158+ EXPECT_EQ (128u , *df.Filter ([](std::int32_t x) { return x == 128 ; }, {" nElectron" }).Max (" nElectron" ));
159+ EXPECT_EQ (128u , *df.Filter ([](std::uint32_t x) { return x == 128 ; }, {" nElectron" }).Max (" nElectron" ));
160+ EXPECT_EQ (128u , *df.Filter ([](std::int16_t x) { return x == 128 ; }, {" nElectron" }).Max (" nElectron" ));
161+ EXPECT_EQ (128u , *df.Filter ([](std::uint16_t x) { return x == 128 ; }, {" nElectron" }).Max (" nElectron" ));
162+ EXPECT_EQ (128u , *df.Filter ([](std::uint8_t x) { return x == 128 ; }, {" nElectron" }).Max (" nElectron" ));
163+ EXPECT_EQ (128u , *df.Filter ([](bool x) { return x; }, {" nElectron" }).Max (" nElectron" ));
164+ try {
165+ *df.Filter ([](std::int8_t x) { return x == 0 ; }, {" nElectron" }).Count ();
166+ FAIL () << " integer overflow should fail" ;
167+ } catch (const ROOT::RException &e) {
168+ EXPECT_THAT (e.what (), ::testing::HasSubstr (" integer overflow" ));
169+ }
166170}
167171
168172static void ReadTest (const std::string &name, const std::string &fname)
@@ -206,7 +210,7 @@ static void ReadTest(const std::string &name, const std::string &fname)
206210 EXPECT_TRUE (All (rvec->at (0 ) == ROOT::RVecI{1 , 2 , 3 }));
207211 EXPECT_TRUE (All (vectorasrvec->at (0 ) == ROOT::RVecF{1 .f , 2 .f }));
208212 EXPECT_FLOAT_EQ (137.0 , sumElectronPt.GetValue ());
209- EXPECT_FLOAT_EQ (2 . * 137.0 , sumVecElectronPt.GetValue ());
213+ EXPECT_FLOAT_EQ (128 . * 137.0 , sumVecElectronPt.GetValue ());
210214}
211215
212216static void ChainTest (const std::string &name, const std::string &fname)
0 commit comments