<commit_before>#include "TFile.h"
#include "TTree.h"
#include "TTreeReader.h"
#include "TTreeReaderArray.h"

#include "gtest/gtest.h"

#include <fstream>

TEST(TTreeReaderArray, Vector) {
   TTree* tree = new TTree("TTreeReaderArrayTree", "In-memory test tree");
   std::vector<float> vecf{17.f, 18.f, 19.f, 20.f, 21.f};
   tree->Branch("vec", &vecf);

   tree->Fill();
   tree->Fill();
   tree->Fill();

   TTreeReader tr(tree);
   TTreeReaderArray<double> vec(tr, "vec");

   EXPECT_EQ(5u, vec.GetSize());
   EXPECT_DOUBLE_EQ(19., vec[2]);
   EXPECT_DOUBLE_EQ(17., vec[0]);
}


TEST(TTreeReaderArray, MultiReaders) {
   // See https://root.cern.ch/phpBB3/viewtopic.php?f=3&t=22790
   TTree* tree = new TTree("TTreeReaderArrayTree", "In-memory test tree");
   double Double[6] = {42.f, 43.f, 44.f, 45.f, 46.f, 47.f};
   tree->Branch("D", &Double, "D[4]/D");

   tree->Fill();
   tree->Fill();
   tree->Fill();

   TTreeReader TR(tree);
   TTreeReaderArray<double> trDouble0(TR, "D");
   TTreeReaderArray<double> trDouble1(TR, "D");<commit_msg>Branch contains floats; set entry number. ResetBranchAddresses().<commit_after>#include "TFile.h"
#include "TTree.h"
#include "TTreeReader.h"
#include "TTreeReaderArray.h"

#include "gtest/gtest.h"

#include <fstream>

TEST(TTreeReaderArray, Vector) {
   TTree* tree = new TTree("TTreeReaderArrayTree", "In-memory test tree");
   std::vector<float> vecf{17.f, 18.f, 19.f, 20.f, 21.f};
   tree->Branch("vec", &vecf);

   tree->Fill();
   tree->Fill();
   tree->Fill();

   tree->ResetBranchAddresses();

   TTreeReader tr(tree);
   TTreeReaderArray<float> vec(tr, "vec");

   tr.SetEntry(1);

   EXPECT_EQ(5u, vec.GetSize());
   EXPECT_DOUBLE_EQ(19., vec[2]);
   EXPECT_DOUBLE_EQ(17., vec[0]);
}


TEST(TTreeReaderArray, MultiReaders) {
   // See https://root.cern.ch/phpBB3/viewtopic.php?f=3&t=22790
   TTree* tree = new TTree("TTreeReaderArrayTree", "In-memory test tree");
   double Double[6] = {42.f, 43.f, 44.f, 45.f, 46.f, 47.f};
   tree->Branch("D", &Double, "D[4]/D");

   tree->Fill();
   tree->Fill();
   tree->Fill();

   tree->ResetBranchAddresses();

   TTreeReader TR(tree);
   TTreeReaderArray<double> trDouble0(TR, "D");
   TTreeReaderArray<double> trDouble1(TR, "D");
{'fraction_non_alphanumeric': 0.1971261787157611, 'fraction_numerical': 0.03637180062864841, 'mean_word_length': 4.342925659472422, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 31, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2738512', 'n_tokens_mistral': 936, 'n_tokens_neox': 885, 'n_words': 160}