comparison 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
comparison
equal deleted inserted replaced
1461:455e6b4c8b02 1462:05eb8ba149e2
64 64
65 @testset "boundary_grid" begin 65 @testset "boundary_grid" begin
66 g = EquidistantGrid(0:0.1:1) 66 g = EquidistantGrid(0:0.1:1)
67 @test boundary_grid(g, Lower()) == ZeroDimGrid(0.0) 67 @test boundary_grid(g, Lower()) == ZeroDimGrid(0.0)
68 @test boundary_grid(g, Upper()) == ZeroDimGrid(1.0) 68 @test boundary_grid(g, Upper()) == ZeroDimGrid(1.0)
69 end
70
71 @testset "boundary_indices" begin
72 g = EquidistantGrid(0:0.1:1)
73 @test boundary_indices(g, Lower()) == 1
74 @test boundary_indices(g, Upper()) == 11
75
76 g = EquidistantGrid(2:0.1:10)
77 @test boundary_indices(g, Lower()) == 1
78 @test boundary_indices(g, Upper()) == 81
79
69 end 80 end
70 81
71 @testset "refine" begin 82 @testset "refine" begin
72 g = EquidistantGrid(0:0.1:1) 83 g = EquidistantGrid(0:0.1:1)
73 @test refine(g, 1) == g 84 @test refine(g, 1) == g