Mercurial > repos > public > sbplib_julia
comparison test/Grids/equidistant_grid_test.jl @ 1267:30729cba1095 refactor/grids
Fix some broken tests in equidistant_grid_test.jl
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Fri, 24 Feb 2023 21:48:01 +0100 |
| parents | a4834779cd6d |
| children | 75a65db29be1 |
comparison
equal
deleted
inserted
replaced
| 1266:a4ddae8b5d49 | 1267:30729cba1095 |
|---|---|
| 93 @test_throws DomainError equidistant_grid(1,1.0,-1.0) | 93 @test_throws DomainError equidistant_grid(1,1.0,-1.0) |
| 94 @test equidistant_grid(4,0.0,1.0) == equidistant_grid((4,),(0.0,),(1.0,)) | 94 @test equidistant_grid(4,0.0,1.0) == equidistant_grid((4,),(0.0,),(1.0,)) |
| 95 | 95 |
| 96 @testset "Base" begin | 96 @testset "Base" begin |
| 97 @test eltype(equidistant_grid(4,0.0,1.0)) == Float64 | 97 @test eltype(equidistant_grid(4,0.0,1.0)) == Float64 |
| 98 @test_broken eltype(equidistant_grid((4,3),(0,0),(1,3))) == AbstractVector{Float64} | 98 @test eltype(equidistant_grid((4,3),(0,0),(1,3))) <: AbstractVector{Float64} |
| 99 @test size(equidistant_grid(4,0.0,1.0)) == (4,) | 99 @test size(equidistant_grid(4,0.0,1.0)) == (4,) |
| 100 @test size(equidistant_grid((5,3), (0.0,0.0), (2.0,1.0))) == (5,3) | 100 @test size(equidistant_grid((5,3), (0.0,0.0), (2.0,1.0))) == (5,3) |
| 101 @test ndims(equidistant_grid(4,0.0,1.0)) == 1 | 101 @test ndims(equidistant_grid(4,0.0,1.0)) == 1 |
| 102 @test ndims(equidistant_grid((5,3), (0.0,0.0), (2.0,1.0))) == 2 | 102 @test ndims(equidistant_grid((5,3), (0.0,0.0), (2.0,1.0))) == 2 |
| 103 end | 103 end |
| 104 | 104 |
| 105 @testset "getindex" begin | 105 @testset "getindex" begin |
| 106 g = equidistant_grid((5,3), (-1.0,0.0), (0.0,7.11)) | 106 g = equidistant_grid((5,3), (-1.0,0.0), (0.0,7.11)) |
| 107 # gp = collect(g); | 107 gp = collect(g); |
| 108 gp = rand(size(g)...) | |
| 109 p = [(-1.,0.) (-1.,7.11/2) (-1.,7.11); | 108 p = [(-1.,0.) (-1.,7.11/2) (-1.,7.11); |
| 110 (-0.75,0.) (-0.75,7.11/2) (-0.75,7.11); | 109 (-0.75,0.) (-0.75,7.11/2) (-0.75,7.11); |
| 111 (-0.5,0.) (-0.5,7.11/2) (-0.5,7.11); | 110 (-0.5,0.) (-0.5,7.11/2) (-0.5,7.11); |
| 112 (-0.25,0.) (-0.25,7.11/2) (-0.25,7.11); | 111 (-0.25,0.) (-0.25,7.11/2) (-0.25,7.11); |
| 113 (0.,0.) (0.,7.11/2) (0.,7.11)] | 112 (0.,0.) (0.,7.11/2) (0.,7.11)] |
| 114 for i ∈ eachindex(gp) | 113 for i ∈ eachindex(gp) |
| 115 @test_broken [gp[i]...] ≈ [p[i]...] atol=5e-13 | 114 @test [gp[i]...] ≈ [p[i]...] atol=5e-13 |
| 116 end | 115 end |
| 117 end | 116 end |
| 118 end | 117 end |
