Mercurial > repos > public > sbplib_julia
annotate test/Grids/tensor_grid_test.jl @ 1268:dbddd0f61bde refactor/grids
Add refine, coarsen, boundary_identifiers, and boundary_grid methods to ZeroDimGrid
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 24 Feb 2023 21:54:39 +0100 |
parents | a4ddae8b5d49 |
children | 279179677040 |
rev | line source |
---|---|
1266
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
1 using Test |
1245 | 2 using Sbplib.Grids |
1266
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
3 using StaticArrays |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
4 using Sbplib.RegionIndices |
1245 | 5 |
6 @testset "TensorGrid" begin | |
1266
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
7 g₁ = EquidistantGrid(range(0,1,length=11)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
8 g₂ = EquidistantGrid(range(2,3,length=6)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
9 g₃ = EquidistantGrid(1:10) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
10 g₄ = ZeroDimGrid(@SVector[1,2]) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
11 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
12 @test TensorGrid(g₁, g₂) isa TensorGrid |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
13 @test TensorGrid(g₁, g₂) isa Grid{SVector{2,Float64}, 2} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
14 @test TensorGrid(g₃, g₃) isa Grid{SVector{2,Int}, 2} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
15 @test TensorGrid(g₁, g₂, g₃) isa Grid{SVector{3,Float64}, 3} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
16 @test TensorGrid(g₁, g₄) isa Grid{SVector{3,Float64}, 1} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
17 @test TensorGrid(g₁, g₄, g₂) isa Grid{SVector{4,Float64}, 2} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
18 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
19 @testset "Indexing Interface" begin |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
20 @test TensorGrid(g₁, g₂)[1,1] isa SVector{2,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
21 @test TensorGrid(g₁, g₂)[1,1] == [0.0,2.0] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
22 @test TensorGrid(g₁, g₂)[3,5] == [0.2,2.8] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
23 @test TensorGrid(g₁, g₂)[10,6] == [0.9,3.0] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
24 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
25 @test TensorGrid(g₁, g₃)[1,1] isa SVector{2,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
26 @test TensorGrid(g₁, g₃)[1,1] == [0.0,1.0] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
27 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
28 @test TensorGrid(g₁, g₂, g₃)[3,4,5] isa SVector{3,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
29 @test TensorGrid(g₁, g₂, g₃)[3,4,5] == [0.2, 2.6, 5.0] |
1252
c150eabaf656
Fix or mark tests broken where needed
Jonatan Werpers <jonatan@werpers.com>
parents:
1245
diff
changeset
|
30 |
1266
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
31 @test TensorGrid(g₁, g₄)[3] isa SVector{3,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
32 @test TensorGrid(g₁, g₄)[3] == [0.2, 1., 2.] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
33 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
34 @test TensorGrid(g₁, g₄, g₂)[3,2] isa SVector{4,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
35 @test TensorGrid(g₁, g₄, g₂)[3,2] == [0.2, 1., 2., 2.2] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
36 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
37 @test eachindex(TensorGrid(g₁, g₂)) == CartesianIndices((11,6)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
38 @test eachindex(TensorGrid(g₁, g₃)) == CartesianIndices((11,10)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
39 @test eachindex(TensorGrid(g₁, g₂, g₃)) == CartesianIndices((11,6,10)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
40 @test eachindex(TensorGrid(g₁, g₄)) == CartesianIndices((11,)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
41 @test eachindex(TensorGrid(g₁, g₄, g₂)) == CartesianIndices((11,6)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
42 end |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
43 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
44 @testset "Iterator interface" begin |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
45 @test eltype(TensorGrid(g₁, g₂)) == SVector{2,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
46 @test eltype(TensorGrid(g₁, g₃)) == SVector{2,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
47 @test eltype(TensorGrid(g₁, g₂, g₃)) == SVector{3,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
48 @test eltype(TensorGrid(g₁, g₄)) == SVector{3,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
49 @test eltype(TensorGrid(g₁, g₄, g₂)) == SVector{4,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
50 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
51 @test size(TensorGrid(g₁, g₂)) == (11,6) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
52 @test size(TensorGrid(g₁, g₃)) == (11,10) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
53 @test size(TensorGrid(g₁, g₂, g₃)) == (11,6,10) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
54 @test size(TensorGrid(g₁, g₄)) == (11,) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
55 @test size(TensorGrid(g₁, g₄, g₂)) == (11,6) |
1252
c150eabaf656
Fix or mark tests broken where needed
Jonatan Werpers <jonatan@werpers.com>
parents:
1245
diff
changeset
|
56 |
1266
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
57 @test Base.IteratorSize(TensorGrid(g₁, g₂)) == Base.HasShape{2}() |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
58 @test Base.IteratorSize(TensorGrid(g₁, g₃)) == Base.HasShape{2}() |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
59 @test Base.IteratorSize(TensorGrid(g₁, g₂, g₃)) == Base.HasShape{3}() |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
60 @test Base.IteratorSize(TensorGrid(g₁, g₄)) == Base.HasShape{1}() |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
61 @test Base.IteratorSize(TensorGrid(g₁, g₄, g₂)) == Base.HasShape{2}() |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
62 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
63 @test iterate(TensorGrid(g₁, g₂))[1] isa SVector{2,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
64 @test iterate(TensorGrid(g₁, g₃))[1] isa SVector{2,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
65 @test iterate(TensorGrid(g₁, g₂, g₃))[1] isa SVector{3,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
66 @test iterate(TensorGrid(g₁, g₄))[1] isa SVector{3,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
67 @test iterate(TensorGrid(g₁, g₄, g₂))[1] isa SVector{4,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
68 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
69 @test collect(TensorGrid(g₁, g₂)) == [@SVector[x,y] for x ∈ range(0,1,length=11), y ∈ range(2,3,length=6)] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
70 @test collect(TensorGrid(g₁, g₃)) == [@SVector[x,y] for x ∈ range(0,1,length=11), y ∈ 1:10] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
71 @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] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
72 @test collect(TensorGrid(g₁, g₄)) == [@SVector[x,1,2] for x ∈ range(0,1,length=11)] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
73 @test collect(TensorGrid(g₁, g₄, g₂)) == [@SVector[x,1,2,y] for x ∈ range(0,1,length=11), y ∈ range(2,3,length=6)] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
74 end |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
75 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
76 @testset "refine" begin |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
77 g1(n) = EquidistantGrid(range(0,1,length=n)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
78 g2(n) = EquidistantGrid(range(2,3,length=n)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
79 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
80 @test refine(TensorGrid(g1(11), g2(6)),1) == TensorGrid(g1(11), g2(6)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
81 @test refine(TensorGrid(g1(11), g2(6)),2) == TensorGrid(g1(21), g2(11)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
82 @test refine(TensorGrid(g1(11), g2(6)),3) == TensorGrid(g1(31), g2(16)) |
1268
dbddd0f61bde
Add refine, coarsen, boundary_identifiers, and boundary_grid methods to ZeroDimGrid
Jonatan Werpers <jonatan@werpers.com>
parents:
1266
diff
changeset
|
83 @test refine(TensorGrid(g1(11), g₄), 1) == TensorGrid(g1(11), g₄) |
dbddd0f61bde
Add refine, coarsen, boundary_identifiers, and boundary_grid methods to ZeroDimGrid
Jonatan Werpers <jonatan@werpers.com>
parents:
1266
diff
changeset
|
84 @test refine(TensorGrid(g1(11), g₄), 2) == TensorGrid(g1(21), g₄) |
1266
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
85 end |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
86 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
87 @testset "coarsen" begin |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
88 g1(n) = EquidistantGrid(range(0,1,length=n)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
89 g2(n) = EquidistantGrid(range(2,3,length=n)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
90 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
91 @test coarsen(TensorGrid(g1(11), g2(6)),1) == TensorGrid(g1(11), g2(6)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
92 @test coarsen(TensorGrid(g1(21), g2(11)),2) == TensorGrid(g1(11), g2(6)) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
93 @test coarsen(TensorGrid(g1(31), g2(16)),3) == TensorGrid(g1(11), g2(6)) |
1268
dbddd0f61bde
Add refine, coarsen, boundary_identifiers, and boundary_grid methods to ZeroDimGrid
Jonatan Werpers <jonatan@werpers.com>
parents:
1266
diff
changeset
|
94 @test coarsen(TensorGrid(g1(11), g₄), 1) == TensorGrid(g1(11), g₄) |
dbddd0f61bde
Add refine, coarsen, boundary_identifiers, and boundary_grid methods to ZeroDimGrid
Jonatan Werpers <jonatan@werpers.com>
parents:
1266
diff
changeset
|
95 @test coarsen(TensorGrid(g1(21), g₄), 2) == TensorGrid(g1(11), g₄) |
1266
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
96 end |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
97 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
98 @testset "boundary_identifiers" begin |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
99 @test boundary_identifiers(TensorGrid(g₁, g₂)) == map((n,id)->TensorGridBoundary{n,id}(), (1,1,2,2), (Lower,Upper,Lower,Upper)) |
1268
dbddd0f61bde
Add refine, coarsen, boundary_identifiers, and boundary_grid methods to ZeroDimGrid
Jonatan Werpers <jonatan@werpers.com>
parents:
1266
diff
changeset
|
100 @test boundary_identifiers(TensorGrid(g₁, g₄)) == (TensorGridBoundary{1,Lower}(),TensorGridBoundary{1,Upper}()) |
1266
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
101 end |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
102 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
103 @testset "boundary_grid" begin |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
104 @test boundary_grid(TensorGrid(g₁, g₂), TensorGridBoundary{1, Upper}()) == TensorGrid(ZeroDimGrid(g₁[end]), g₂) |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
105 @test boundary_grid(TensorGrid(g₁, g₄), TensorGridBoundary{1, Upper}()) == TensorGrid(ZeroDimGrid(g₁[end]), g₄) |
1252
c150eabaf656
Fix or mark tests broken where needed
Jonatan Werpers <jonatan@werpers.com>
parents:
1245
diff
changeset
|
106 end |
1245 | 107 end |
1266
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
108 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
109 @testset "combined_coordinate_vector_type" begin |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
110 @test Grids.combined_coordinate_vector_type(Float64) == Float64 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
111 @test Grids.combined_coordinate_vector_type(Float64, Int) == SVector{2,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
112 @test Grids.combined_coordinate_vector_type(Float32, Int16, Int32) == SVector{3,Float32} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
113 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
114 @test Grids.combined_coordinate_vector_type(SVector{2,Float64}) == SVector{2,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
115 @test Grids.combined_coordinate_vector_type(SVector{2,Float64}, SVector{1,Float64}) == SVector{3,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
116 @test Grids.combined_coordinate_vector_type(SVector{2,Float64}, SVector{1,Int}, SVector{3, Float32}) == SVector{6,Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
117 end |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
118 |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
119 @testset "combine_coordinates" begin |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
120 @test Grids.combine_coordinates(1,2,3) isa SVector{3, Int} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
121 @test Grids.combine_coordinates(1,2,3) == [1,2,3] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
122 @test Grids.combine_coordinates(1,2.,3) isa SVector{3, Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
123 @test Grids.combine_coordinates(1,2.,3) == [1,2,3] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
124 @test Grids.combine_coordinates(1,@SVector[2.,3]) isa SVector{3, Float64} |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
125 @test Grids.combine_coordinates(1,@SVector[2.,3]) == [1,2,3] |
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1252
diff
changeset
|
126 end |