From b60da703a79f5bd0071f64d8cd6882370a7d249a Mon Sep 17 00:00:00 2001 From: Jeremiah Lewis <4462211+jeremiahpslewis@users.noreply.github.com> Date: Wed, 27 Mar 2024 19:42:56 +0100 Subject: [PATCH] Flesh out boundserror check --- test/runtests.jl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 2241b19..a2db81c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -23,13 +23,21 @@ CUDA.allowscalar(false) @test_throws BoundsError @view b[:, 9] end - @testset "Bounds error for zero-length buffer" begin + @testset "Bounds error for zero-length / underfilled buffer" begin b = CircularVectorBuffer{Bool}(10) + @test_throws BoundsError b[1] @test_throws BoundsError b[end] - for i in 1:5 + + push!(b, true) + @test b[1] == true + @test b[end] == true + @test_throws BoundsError b[2] + for i in 1:15 push!(b, true) end @test b[end] == true + @test b[10] == true + @test_throws BoundsError b[15] end @testset "1D vector" begin