diff --git a/root/tree/index/index64.ref b/root/tree/index/index64.ref index 287dc94630..b134f27148 100644 --- a/root/tree/index/index64.ref +++ b/root/tree/index/index64.ref @@ -1,16 +1,16 @@ Processing runindex64.C... -Tree BuildIndex returns 9 -Entry should be 3: 3 -Entry should be 6: 6 -Entries in chain: 9 -BuildIndex returns 9 -Try to get value that is not in the chain, this should return a -1: +Tree BuildIndex returns 13 +Entries in chain: 13 +BuildIndex returns 13 +Try to find the position of run=0, event=500 in the chain, as it does not exist, this should return a -1: -1 -3 -Entries in chain: 9 +Try to find the position of run=5, event=bigval in the chain, which was inserted in position 4: +4 +Entries in chain: 13 BuildIndex returns 1 -Try to get value that is not in the chain, this should return a -1: +Try to find the position of run=0, event=500 in the chain, as it does not exist, this should return a -1: -1 -3 +Try to find the position of run=5, event=bigval in the chain, which was inserted in position 4: +4 (int) 0 diff --git a/root/tree/index/runindex64.C b/root/tree/index/runindex64.C index 833a8843df..163cea69a4 100644 --- a/root/tree/index/runindex64.C +++ b/root/tree/index/runindex64.C @@ -8,8 +8,9 @@ const char* fname = "index64.root"; // Apple M1 has long double == double; these values exceed its range // and cannot be represented as (even temporary) expression results. // There would be a warning if you'd try. +// More info: https://github.com/root-project/roottest/commit/f3c97809c9064feccaed3844007de9e7c6a5980d and https://github.com/root-project/roottest/commit/9e3843d4bf50bc34e6e15dfe7c027f029417d6c0 static constexpr bool shortlongdouble = sizeof(long double) < 16; // was true for __APPLE__ and __arm64__ -const Long64_t bigval = shortlongdouble ? 0xFFFFFFFFFFFF : 0xFFFFFFFFFFFFFFF; // still positive number +const Long64_t bigval = shortlongdouble ? 0x0FFFFFFFFFFFF : 0x0FFFFFFFFFFFFFFF; // still positive number const ULong64_t biguval = shortlongdouble ? 0xFFFFFFFFFFFF0 : 0xFFFFFFFFFFFFFFF0; // "negative" number int runindex64(){ @@ -25,20 +26,30 @@ int runindex64(){ tree->Branch("run", &run, "run/l"); tree->Branch("event", &event, "event/l"); - ULong64_t events[] = { 1,2,3, bigval, biguval, 5 }; - run = 5; - for(int i=0; iFill(); } - run = 4; event = bigval; tree->Fill(); - run = 6; event = 3; tree->Fill(); - run = biguval; event = bigval; tree->Fill(); tree->Write(); - + + bool pass = true; cout<<"Tree BuildIndex returns "<BuildIndex("run", "event")<GetEntryNumberWithIndex(5,bigval) << endl; - cout << "Entry should be 6: " << tree->GetEntryNumberWithIndex(4,bigval) << endl; + for (size_t i=0; iGetEntryNumberWithIndex(run, event) == i); + } + if (!pass) { + tree->Scan("run:event","","colsize=30"); + for (size_t i=0; iGetEntryNumberWithIndex(run, event) << endl; + } + } test(tree); file.Close(); @@ -60,8 +71,9 @@ bool test(TTree *chain) { cout<<"Entries in chain: "<GetEntries()<BuildIndex("run", "event")<GetEntryWithIndex(500)<GetEntryNumberWithIndex(5, bigval)<GetEntryNumberWithIndex(500)==-1); + cout<<"Try to find the position of run=5, event=bigval in the chain, which was inserted in position 4:"<GetEntryNumberWithIndex(5, bigval)<GetEntryNumberWithIndex(500)==-1) && (chain->GetEntryNumberWithIndex(5, bigval) == 4); }