Mercurial > repos > public > sbplib_julia
comparison test/Grids/equidistant_grid_test.jl @ 1428:a936b414283a feature/grids/curvilinear
Merge bugfix/grids/complete_interface_impl
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 24 Aug 2023 08:50:10 +0200 |
parents | 1aa8adbf13d5 |
children | e3a80ef08d09 |
comparison
equal
deleted
inserted
replaced
1427:26e168924cf1 | 1428:a936b414283a |
---|---|
17 | 17 |
18 @test g[begin] == 0.0 | 18 @test g[begin] == 0.0 |
19 @test g[end] == 10.0 | 19 @test g[end] == 10.0 |
20 | 20 |
21 @test all(eachindex(g) .== 1:101) | 21 @test all(eachindex(g) .== 1:101) |
22 | |
23 @test firstindex(g) == 1 | |
24 @test lastindex(g) == 101 | |
22 end | 25 end |
23 | 26 |
24 @testset "Iterator interface" begin | 27 @testset "Iterator interface" begin |
25 @test eltype(EquidistantGrid(0:10)) == Int | 28 @test eltype(EquidistantGrid(0:10)) == Int |
26 @test eltype(EquidistantGrid(0:2:10)) == Int | 29 @test eltype(EquidistantGrid(0:2:10)) == Int |
33 @test Base.IteratorSize(EquidistantGrid{Float64, StepRange{Float64}}) == Base.HasShape{1}() | 36 @test Base.IteratorSize(EquidistantGrid{Float64, StepRange{Float64}}) == Base.HasShape{1}() |
34 end | 37 end |
35 | 38 |
36 @testset "Base" begin | 39 @testset "Base" begin |
37 @test ndims(EquidistantGrid(0:10)) == 1 | 40 @test ndims(EquidistantGrid(0:10)) == 1 |
41 | |
42 g = EquidistantGrid(0:0.1:10) | |
43 @test axes(g,1) == 1:101 | |
44 @test axes(g) == (1:101,) | |
38 end | 45 end |
39 | 46 |
40 @testset "spacing" begin | 47 @testset "spacing" begin |
41 @test spacing(EquidistantGrid(0:10)) == 1 | 48 @test spacing(EquidistantGrid(0:10)) == 1 |
42 @test spacing(EquidistantGrid(0:0.1:10)) == 0.1 | 49 @test spacing(EquidistantGrid(0:0.1:10)) == 0.1 |