Mercurial > repos > public > sbplib_julia
comparison test/Grids/equidistant_grid_test.jl @ 1594:d68d02dd882f feature/boundary_conditions
Merge with default
author | Vidar Stiernström <vidar.stiernstrom@gmail.com> |
---|---|
date | Sat, 25 May 2024 16:07:10 -0700 |
parents | efe1fc4cb6b0 |
children | 611ae2308aa1 |
comparison
equal
deleted
inserted
replaced
1591:615eeb6e662e | 1594:d68d02dd882f |
---|---|
103 end | 103 end |
104 end | 104 end |
105 | 105 |
106 | 106 |
107 @testset "equidistant_grid" begin | 107 @testset "equidistant_grid" begin |
108 @test equidistant_grid(4,0.0,1.0) isa EquidistantGrid | 108 @test equidistant_grid(0.0,1.0, 4) isa EquidistantGrid |
109 @test equidistant_grid((4,3),(0.0,0.0),(8.0,5.0)) isa TensorGrid | 109 @test equidistant_grid((0.0,0.0),(8.0,5.0), 4, 3) isa TensorGrid |
110 | 110 |
111 # constuctor | 111 # constuctor |
112 @test_throws DomainError equidistant_grid(0,0.0,1.0) | 112 @test_throws DomainError equidistant_grid(0.0, 1.0, 0) |
113 @test_throws DomainError equidistant_grid(1,1.0,1.0) | 113 @test_throws DomainError equidistant_grid(1.0, 1.0, 1) |
114 @test_throws DomainError equidistant_grid(1,1.0,-1.0) | 114 @test_throws DomainError equidistant_grid(1.0, -1.0, 1) |
115 | 115 |
116 @test_throws DomainError equidistant_grid((0,0),(0.0,0.0),(1.0,1.0)) | 116 @test_throws DomainError equidistant_grid((0.0,0.0),(1.0,1.0), 0, 0) |
117 @test_throws DomainError equidistant_grid((1,1),(1.0,1.0),(1.0,1.0)) | 117 @test_throws DomainError equidistant_grid((1.0,1.0),(1.0,1.0), 1, 1) |
118 @test_throws DomainError equidistant_grid((1,1),(1.0,1.0),(-1.0,-1.0)) | 118 @test_throws DomainError equidistant_grid((1.0,1.0),(-1.0,-1.0), 1, 1) |
119 | |
120 @test_throws ArgumentError equidistant_grid((0.0,),(8.0,5.0), 4, 3, 4) | |
119 | 121 |
120 @testset "Base" begin | 122 @testset "Base" begin |
121 @test eltype(equidistant_grid(4,0.0,1.0)) == Float64 | 123 @test eltype(equidistant_grid(0.0, 1.0, 4)) == Float64 |
122 @test eltype(equidistant_grid((4,3),(0,0),(1,3))) <: AbstractVector{Float64} | 124 @test eltype(equidistant_grid((0,0),(1,3), 4, 3)) <: AbstractVector{Float64} |
123 | 125 |
124 @test size(equidistant_grid(4,0.0,1.0)) == (4,) | 126 @test size(equidistant_grid(0.0, 1.0, 4)) == (4,) |
125 @test size(equidistant_grid((5,3), (0.0,0.0), (2.0,1.0))) == (5,3) | 127 @test size(equidistant_grid((0.0,0.0), (2.0,1.0), 5, 3)) == (5,3) |
126 | 128 |
127 @test size(equidistant_grid((5,3), (0.0,0.0), (2.0,1.0)),1) == 5 | 129 @test size(equidistant_grid((0.0,0.0), (2.0,1.0), 5, 3), 1) == 5 |
128 @test size(equidistant_grid((5,3), (0.0,0.0), (2.0,1.0)),2) == 3 | 130 @test size(equidistant_grid((0.0,0.0), (2.0,1.0), 5, 3), 2) == 3 |
129 | 131 |
130 @test ndims(equidistant_grid(4,0.0,1.0)) == 1 | 132 @test ndims(equidistant_grid(0.0, 1.0, 4)) == 1 |
131 @test ndims(equidistant_grid((5,3), (0.0,0.0), (2.0,1.0))) == 2 | 133 @test ndims(equidistant_grid((0.0,0.0), (2.0,1.0), 5, 3)) == 2 |
132 end | 134 end |
133 | 135 |
134 @testset "getindex" begin | 136 @testset "getindex" begin |
135 g = equidistant_grid((5,3), (-1.0,0.0), (0.0,7.11)) | 137 g = equidistant_grid((-1.0,0.0), (0.0,7.11), 5, 3) |
136 gp = collect(g); | 138 gp = collect(g); |
137 p = [(-1.,0.) (-1.,7.11/2) (-1.,7.11); | 139 p = [(-1.,0.) (-1.,7.11/2) (-1.,7.11); |
138 (-0.75,0.) (-0.75,7.11/2) (-0.75,7.11); | 140 (-0.75,0.) (-0.75,7.11/2) (-0.75,7.11); |
139 (-0.5,0.) (-0.5,7.11/2) (-0.5,7.11); | 141 (-0.5,0.) (-0.5,7.11/2) (-0.5,7.11); |
140 (-0.25,0.) (-0.25,7.11/2) (-0.25,7.11); | 142 (-0.25,0.) (-0.25,7.11/2) (-0.25,7.11); |