comparison test/Grids/equidistant_grid_test.jl @ 1825:98ae79eb0709 refactor/grids/iterable_boundary_indices

Refine tests
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 17 Sep 2024 09:12:36 +0200
parents 7a2375080287
children 871f3f1decea
comparison
equal deleted inserted replaced
1824:7a2375080287 1825:98ae79eb0709
68 @test boundary_grid(g, Upper()) == ZeroDimGrid(1.0) 68 @test boundary_grid(g, Upper()) == ZeroDimGrid(1.0)
69 end 69 end
70 70
71 @testset "boundary_indices" begin 71 @testset "boundary_indices" begin
72 g = EquidistantGrid(0:0.1:1) 72 g = EquidistantGrid(0:0.1:1)
73 @test collect(boundary_indices(g, Lower())) == [(1,)] 73 @test boundary_indices(g, Lower()) == 1
74 @test collect(boundary_indices(g, Upper())) == [(11,)] 74 @test boundary_indices(g, Upper()) == 11
75 75
76 76 gf = collect(g)
77 gf = collect(1:length(g)) 77 @test gf[boundary_indices(g, Lower())] == gf[1]
78 @test gf[boundary_indices(g, Lower()] == gf[1] 78 @test gf[boundary_indices(g, Upper())] == gf[11]
79 @test gf[boundary_indices(g, Upper()] == gf[11]
80 79
81 g = EquidistantGrid(2:0.1:10) 80 g = EquidistantGrid(2:0.1:10)
82 @test collect(boundary_indices(g, Lower())) == [(1,)] 81 @test boundary_indices(g, Lower()) == 1
83 @test collect(boundary_indices(g, Upper())) == [(81,)] 82 @test boundary_indices(g, Upper()) == 81
84
85 end 83 end
86 84
87 @testset "refine" begin 85 @testset "refine" begin
88 g = EquidistantGrid(0:0.1:1) 86 g = EquidistantGrid(0:0.1:1)
89 @test refine(g, 1) == g 87 @test refine(g, 1) == g