File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,28 @@ TEST(RNTupleImporter, Empty)
3535 EXPECT_THROW (importer->Import (), ROOT::RException);
3636}
3737
38+ TEST (RNTupleImporter, CreateInDirectory)
39+ {
40+ FileRaii fileGuard (" test_ntuple_importer_create_in_directory.root" );
41+ {
42+ std::unique_ptr<TFile> file (TFile::Open (fileGuard.GetPath ().c_str (), " RECREATE" ));
43+ TDirectory *dir = file->mkdir (" dir1" );
44+ ASSERT_NE (dir, nullptr );
45+ file->cd (" dir1" );
46+ auto tree = std::make_unique<TTree>(" tree" , " " );
47+ tree->Write ();
48+ }
49+
50+ auto importer = RNTupleImporter::Create (fileGuard.GetPath (), " dir1/tree" , fileGuard.GetPath ());
51+ importer->SetIsQuiet (true );
52+ EXPECT_THROW (importer->Import (), ROOT::RException);
53+ importer->SetNTupleName (" dir2/ntuple" );
54+ importer->Import ();
55+ auto reader = RNTupleReader::Open (" dir2/ntuple" , fileGuard.GetPath ());
56+ EXPECT_EQ (0U , reader->GetNEntries ());
57+ EXPECT_THROW (importer->Import (), ROOT::RException);
58+ }
59+
3860TEST (RNTupleImporter, CreateFromTree)
3961{
4062 FileRaii fileGuard (" test_ntuple_importer_empty.root" );
You can’t perform that action at this time.
0 commit comments