diff test/Grids/equidistant_grid_test.jl @ 1462:05eb8ba149e2 feature/grids/boundary_indicies

Implement boundary_indices for EquidistantGrid
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 28 Nov 2023 08:51:58 +0100
parents e3a80ef08d09
children 37cf9f79caa4
line wrap: on
line diff
--- a/test/Grids/equidistant_grid_test.jl	Tue Nov 28 08:42:00 2023 +0100
+++ b/test/Grids/equidistant_grid_test.jl	Tue Nov 28 08:51:58 2023 +0100
@@ -68,6 +68,17 @@
         @test boundary_grid(g, Upper()) == ZeroDimGrid(1.0)
     end
 
+    @testset "boundary_indices" begin
+        g = EquidistantGrid(0:0.1:1)
+        @test boundary_indices(g, Lower()) == 1
+        @test boundary_indices(g, Upper()) == 11
+
+        g = EquidistantGrid(2:0.1:10)
+        @test boundary_indices(g, Lower()) == 1
+        @test boundary_indices(g, Upper()) == 81
+
+    end
+
     @testset "refine" begin
         g = EquidistantGrid(0:0.1:1)
         @test refine(g, 1) == g