Mercurial > repos > public > sbplib_julia
changeset 1414:1aa8adbf13d5 bugfix/grids/complete_interface_impl
Move tests for axes out of indexing interface testset
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 23 Aug 2023 09:36:05 +0200 |
parents | 410bc321242c |
children | 18e21601da2d |
files | test/Grids/equidistant_grid_test.jl test/Grids/tensor_grid_test.jl |
diffstat | 2 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
diff -r 410bc321242c -r 1aa8adbf13d5 test/Grids/equidistant_grid_test.jl --- a/test/Grids/equidistant_grid_test.jl Wed Aug 23 09:32:01 2023 +0200 +++ b/test/Grids/equidistant_grid_test.jl Wed Aug 23 09:36:05 2023 +0200 @@ -22,9 +22,6 @@ @test firstindex(g) == 1 @test lastindex(g) == 101 - - @test axes(g,1) == 1:101 - @test axes(g) == (1:101,) end @testset "Iterator interface" begin @@ -41,6 +38,10 @@ @testset "Base" begin @test ndims(EquidistantGrid(0:10)) == 1 + + g = EquidistantGrid(0:0.1:10) + @test axes(g,1) == 1:101 + @test axes(g) == (1:101,) end @testset "spacing" begin
diff -r 410bc321242c -r 1aa8adbf13d5 test/Grids/tensor_grid_test.jl --- a/test/Grids/tensor_grid_test.jl Wed Aug 23 09:32:01 2023 +0200 +++ b/test/Grids/tensor_grid_test.jl Wed Aug 23 09:36:05 2023 +0200 @@ -39,10 +39,6 @@ @test g[begin, begin] == g[1,1] @test g[begin, end] == g[1,6] @test g[end, end] == g[11,6] - - @test axes(g, 1) == 1:11 - @test axes(g, 2) == 1:6 - @test axes(g) == (1:11,1:6) end @testset "cartesian indexing" begin @@ -114,6 +110,16 @@ @test collect(TensorGrid(g₁, g₄, g₂)) == [@SVector[x,1,2,y] for x ∈ range(0,1,length=11), y ∈ range(2,3,length=6)] end + @testset "Base" begin + g₁ = EquidistantGrid(range(0,1,length=11)) + g₂ = EquidistantGrid(range(2,3,length=6)) + g = TensorGrid(g₁, g₂) + + @test axes(g, 1) == 1:11 + @test axes(g, 2) == 1:6 + @test axes(g) == (1:11,1:6) + end + @testset "refine" begin g1(n) = EquidistantGrid(range(0,1,length=n)) g2(n) = EquidistantGrid(range(2,3,length=n))