Mercurial > repos > public > sbplib_julia
diff test/Grids/equidistant_grid_test.jl @ 1829:871f3f1decea refactor/grids/iterable_boundary_indices
Merge default
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Sun, 20 Oct 2024 21:38:09 +0200 |
| parents | 98ae79eb0709 471a948cd2b2 |
| children | edee7d677efb f93ba5832146 |
line wrap: on
line diff
--- a/test/Grids/equidistant_grid_test.jl Tue Sep 17 11:20:00 2024 +0200 +++ b/test/Grids/equidistant_grid_test.jl Sun Oct 20 21:38:09 2024 +0200 @@ -1,7 +1,6 @@ -using Sbplib.Grids +using Diffinitive.Grids using Test -using Sbplib.RegionIndices -using Sbplib.LazyTensors +using Diffinitive.LazyTensors @testset "EquidistantGrid" begin @@ -56,30 +55,35 @@ @test inverse_spacing(EquidistantGrid(0:0.1:10)) == 10 end + @testset "min_spacing" begin + @test min_spacing(EquidistantGrid(0:10)) == 1 + @test min_spacing(EquidistantGrid(0:0.1:10)) == 0.1 + end + @testset "boundary_identifiers" begin g = EquidistantGrid(0:0.1:10) - @test boundary_identifiers(g) == (Lower(), Upper()) + @test boundary_identifiers(g) == (LowerBoundary(), UpperBoundary()) @inferred boundary_identifiers(g) end @testset "boundary_grid" begin g = EquidistantGrid(0:0.1:1) - @test boundary_grid(g, Lower()) == ZeroDimGrid(0.0) - @test boundary_grid(g, Upper()) == ZeroDimGrid(1.0) + @test boundary_grid(g, LowerBoundary()) == ZeroDimGrid(0.0) + @test boundary_grid(g, UpperBoundary()) == 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 + @test boundary_indices(g, LowerBoundary()) == 1 + @test boundary_indices(g, UpperBoundary()) == 11 gf = collect(g) - @test gf[boundary_indices(g, Lower())] == gf[1] - @test gf[boundary_indices(g, Upper())] == gf[11] + @test gf[boundary_indices(g, LowerBoundary())] == gf[1] + @test gf[boundary_indices(g, UpperBoundary())] == gf[11] g = EquidistantGrid(2:0.1:10) - @test boundary_indices(g, Lower()) == 1 - @test boundary_indices(g, Upper()) == 81 + @test boundary_indices(g, LowerBoundary()) == 1 + @test boundary_indices(g, UpperBoundary()) == 81 end @testset "refine" begin @@ -110,6 +114,7 @@ @testset "equidistant_grid" begin @test equidistant_grid(0.0,1.0, 4) isa EquidistantGrid @test equidistant_grid((0.0,0.0),(8.0,5.0), 4, 3) isa TensorGrid + @test equidistant_grid((0.0,),(8.0,), 4) isa TensorGrid # constuctor @test_throws DomainError equidistant_grid(0.0, 1.0, 0)
