changeset 1253:ff8f335c32d1 refactor/grids

Fix indexing with begin and end for EquidistantGrid
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 22 Feb 2023 12:53:16 +0100
parents c150eabaf656
children f98d8ede0e90
files src/Grids/equidistant_grid.jl test/Grids/equidistant_grid_test.jl
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/Grids/equidistant_grid.jl	Wed Feb 22 12:47:08 2023 +0100
+++ b/src/Grids/equidistant_grid.jl	Wed Feb 22 12:53:16 2023 +0100
@@ -12,6 +12,9 @@
 Base.length(g::EquidistantGrid) = length(g.points)
 Base.eachindex(g::EquidistantGrid) = eachindex(g.points)
 
+Base.firstindex(g::EquidistantGrid) = firstindex(g.points)
+Base.lastindex(g::EquidistantGrid) = lastindex(g.points)
+
 # TODO: Make sure collect works!
 
 
--- a/test/Grids/equidistant_grid_test.jl	Wed Feb 22 12:47:08 2023 +0100
+++ b/test/Grids/equidistant_grid_test.jl	Wed Feb 22 12:53:16 2023 +0100
@@ -39,8 +39,8 @@
         @test g[5] == 0.4
         @test g[101] == 10.0
 
-        @test_broken g[begin] == 0.0
-        @test_broken g[end] == 10.0
+        @test g[begin] == 0.0
+        @test g[end] == 10.0
     end
 
     @testset "boundary_identifiers" begin