From f8333d3e171ada4f3470651e033172fcb0aee2a6 Mon Sep 17 00:00:00 2001 From: Tamas Gal <himself@tamasgal.com> Date: Thu, 25 Jul 2024 14:35:30 +0200 Subject: [PATCH] Fix iteration --- src/root/offline.jl | 2 +- test/tools.jl | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/root/offline.jl b/src/root/offline.jl index 856e94c1..9edfbb23 100644 --- a/src/root/offline.jl +++ b/src/root/offline.jl @@ -49,7 +49,7 @@ Base.firstindex(::FitInformation) = 0 Base.lastindex(fitinf::FitInformation) = length(fitinf) - 1 Base.eltype(::FitInformation) = Float64 function Base.iterate(fitinf::FitInformation, state=0) - state > length(fitinf) ? nothing : (fitinf[state], state+1) + state > length(fitinf)+1 ? nothing : (fitinf[state], state+1) end """ diff --git a/test/tools.jl b/test/tools.jl index 09d884a1..6cb5b7fe 100644 --- a/test/tools.jl +++ b/test/tools.jl @@ -91,7 +91,8 @@ const ONLINEFILE = datapath("online", "km3net_online.root") @test 56 == length(t[1].trks) @test 0 == length(t[1].w) @test 17 == length(t[1].trks[1].fitinf) - @test 0.009290906625313346 == t[end].trks[1].fitinf[0] + @test 63.92088448672399 == sum(t[end].trks[2].fitinf) + @test 101.0 == t[1].trks[1].fitinf[end] close(f) f = ROOTFile(datapath("offline", "numucc.root")) -- GitLab