comparison test/testGrids.jl @ 355:5c9212a8ee4f refactor/remove_dynamic_size_tensormapping

Merge in subgrid function
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 27 Sep 2020 21:08:18 +0200
parents 8257cc75ea6b
children 64ad8ec0eae0
comparison
equal deleted inserted replaced
354:db5f7b51038c 355:5c9212a8ee4f
2 using Test 2 using Test
3 3
4 @testset "Grids" begin 4 @testset "Grids" begin
5 5
6 @testset "EquidistantGrid" begin 6 @testset "EquidistantGrid" begin
7 @test EquidistantGrid(4,0,1) isa EquidistantGrid 7 @test EquidistantGrid(4,0.0,1.0) isa EquidistantGrid
8 @test dimension(EquidistantGrid(4,0,1)) == 1 8 @test EquidistantGrid(4,0.0,8.0) isa EquidistantGrid
9 @test EquidistantGrid(4,0,1) == EquidistantGrid((4,),(0,),(1,)) 9 @test dimension(EquidistantGrid(4,0.0,1.0)) == 1
10 @test EquidistantGrid(4,0.0,1.0) == EquidistantGrid((4,),(0.0,),(1.0,))
11
12 g = EquidistantGrid((5,3), (0.0,0.0), (2.0,1.0))
13 @test subgrid(g, 1) == EquidistantGrid(5,0.0,2.0)
14 @test subgrid(g, 2) == EquidistantGrid(3,0.0,1.0)
15
16 g = EquidistantGrid((2,5,3), (0.0,0.0,0.0), (2.0,1.0,3.0))
17 @test subgrid(g, 1) == EquidistantGrid(2,0.0,2.0)
18 @test subgrid(g, 2) == EquidistantGrid(5,0.0,1.0)
19 @test subgrid(g, 3) == EquidistantGrid(3,0.0,3.0)
20 @test subgrid(g, 1:2) == EquidistantGrid((2,5),(0.0,0.0),(2.0,1.0))
21 @test subgrid(g, 2:3) == EquidistantGrid((5,3),(0.0,0.0),(1.0,3.0))
22 @test subgrid(g, [1,3]) == EquidistantGrid((2,3),(0.0,0.0),(2.0,3.0))
23 @test subgrid(g, [2,1]) == EquidistantGrid((5,2),(0.0,0.0),(1.0,2.0))
10 end 24 end
11 25
12 end 26 end