Mercurial > repos > public > sbplib_julia
comparison test/Grids/tensor_grid_test.jl @ 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 | 949fe47d65a4 f11615573e4d e3a80ef08d09 |
comparison
equal
deleted
inserted
replaced
1413:410bc321242c | 1414:1aa8adbf13d5 |
---|---|
37 | 37 |
38 g = TensorGrid(g₁, g₂) | 38 g = TensorGrid(g₁, g₂) |
39 @test g[begin, begin] == g[1,1] | 39 @test g[begin, begin] == g[1,1] |
40 @test g[begin, end] == g[1,6] | 40 @test g[begin, end] == g[1,6] |
41 @test g[end, end] == g[11,6] | 41 @test g[end, end] == g[11,6] |
42 | |
43 @test axes(g, 1) == 1:11 | |
44 @test axes(g, 2) == 1:6 | |
45 @test axes(g) == (1:11,1:6) | |
46 end | 42 end |
47 | 43 |
48 @testset "cartesian indexing" begin | 44 @testset "cartesian indexing" begin |
49 cases = [ | 45 cases = [ |
50 (TensorGrid(g₁, g₂), (1,1) ), | 46 (TensorGrid(g₁, g₂), (1,1) ), |
112 @test collect(TensorGrid(g₁, g₂, g₃)) == [@SVector[x,y,z] for x ∈ range(0,1,length=11), y ∈ range(2,3,length=6), z ∈ 1:10] | 108 @test collect(TensorGrid(g₁, g₂, g₃)) == [@SVector[x,y,z] for x ∈ range(0,1,length=11), y ∈ range(2,3,length=6), z ∈ 1:10] |
113 @test collect(TensorGrid(g₁, g₄)) == [@SVector[x,1,2] for x ∈ range(0,1,length=11)] | 109 @test collect(TensorGrid(g₁, g₄)) == [@SVector[x,1,2] for x ∈ range(0,1,length=11)] |
114 @test collect(TensorGrid(g₁, g₄, g₂)) == [@SVector[x,1,2,y] for x ∈ range(0,1,length=11), y ∈ range(2,3,length=6)] | 110 @test collect(TensorGrid(g₁, g₄, g₂)) == [@SVector[x,1,2,y] for x ∈ range(0,1,length=11), y ∈ range(2,3,length=6)] |
115 end | 111 end |
116 | 112 |
113 @testset "Base" begin | |
114 g₁ = EquidistantGrid(range(0,1,length=11)) | |
115 g₂ = EquidistantGrid(range(2,3,length=6)) | |
116 g = TensorGrid(g₁, g₂) | |
117 | |
118 @test axes(g, 1) == 1:11 | |
119 @test axes(g, 2) == 1:6 | |
120 @test axes(g) == (1:11,1:6) | |
121 end | |
122 | |
117 @testset "refine" begin | 123 @testset "refine" begin |
118 g1(n) = EquidistantGrid(range(0,1,length=n)) | 124 g1(n) = EquidistantGrid(range(0,1,length=n)) |
119 g2(n) = EquidistantGrid(range(2,3,length=n)) | 125 g2(n) = EquidistantGrid(range(2,3,length=n)) |
120 | 126 |
121 @test refine(TensorGrid(g1(11), g2(6)),1) == TensorGrid(g1(11), g2(6)) | 127 @test refine(TensorGrid(g1(11), g2(6)),1) == TensorGrid(g1(11), g2(6)) |