comparison test/Grids/equidistant_grid_test.jl @ 1128:dfbd62c7eb09 feature/grids

Rename dim to ndims in Grids.jl
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 05 Oct 2022 22:00:30 +0200
parents b9c6b0d8f0fa
children 9275d95e2d90 102ebdaf7c11
comparison
equal deleted inserted replaced
1127:5490d0a38007 1128:dfbd62c7eb09
15 @testset "Base" begin 15 @testset "Base" begin
16 @test eltype(EquidistantGrid(4,0.0,1.0)) == Float64 16 @test eltype(EquidistantGrid(4,0.0,1.0)) == Float64
17 @test eltype(EquidistantGrid((4,3),(0,0),(1,3))) == Int 17 @test eltype(EquidistantGrid((4,3),(0,0),(1,3))) == Int
18 @test size(EquidistantGrid(4,0.0,1.0)) == (4,) 18 @test size(EquidistantGrid(4,0.0,1.0)) == (4,)
19 @test size(EquidistantGrid((5,3), (0.0,0.0), (2.0,1.0))) == (5,3) 19 @test size(EquidistantGrid((5,3), (0.0,0.0), (2.0,1.0))) == (5,3)
20 @test ndims(EquidistantGrid(4,0.0,1.0)) == 1
21 @test ndims(EquidistantGrid((5,3), (0.0,0.0), (2.0,1.0))) == 2
20 end 22 end
21
22 # dim
23 @test dim(EquidistantGrid(4,0.0,1.0)) == 1
24 @test dim(EquidistantGrid((5,3), (0.0,0.0), (2.0,1.0))) == 2
25 23
26 @testset "spacing" begin 24 @testset "spacing" begin
27 @test [spacing(EquidistantGrid(4,0.0,1.0))...] ≈ [(1. /3,)...] atol=5e-13 25 @test [spacing(EquidistantGrid(4,0.0,1.0))...] ≈ [(1. /3,)...] atol=5e-13
28 @test [spacing(EquidistantGrid((5,3), (0.0,-1.0), (2.0,1.0)))...] ≈ [(0.5, 1.)...] atol=5e-13 26 @test [spacing(EquidistantGrid((5,3), (0.0,-1.0), (2.0,1.0)))...] ≈ [(0.5, 1.)...] atol=5e-13
29 end 27 end