comparison test/Grids/equidistant_grid_test.jl @ 1414:1aa8adbf13d5 bugfix/grids/complete_interface_impl

Move tests for axes out of indexing interface testset
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 23 Aug 2023 09:36:05 +0200
parents 410bc321242c
children e3a80ef08d09
comparison
equal deleted inserted replaced
1413:410bc321242c 1414:1aa8adbf13d5
20 20
21 @test all(eachindex(g) .== 1:101) 21 @test all(eachindex(g) .== 1:101)
22 22
23 @test firstindex(g) == 1 23 @test firstindex(g) == 1
24 @test lastindex(g) == 101 24 @test lastindex(g) == 101
25
26 @test axes(g,1) == 1:101
27 @test axes(g) == (1:101,)
28 end 25 end
29 26
30 @testset "Iterator interface" begin 27 @testset "Iterator interface" begin
31 @test eltype(EquidistantGrid(0:10)) == Int 28 @test eltype(EquidistantGrid(0:10)) == Int
32 @test eltype(EquidistantGrid(0:2:10)) == Int 29 @test eltype(EquidistantGrid(0:2:10)) == Int
39 @test Base.IteratorSize(EquidistantGrid{Float64, StepRange{Float64}}) == Base.HasShape{1}() 36 @test Base.IteratorSize(EquidistantGrid{Float64, StepRange{Float64}}) == Base.HasShape{1}()
40 end 37 end
41 38
42 @testset "Base" begin 39 @testset "Base" begin
43 @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,)
44 end 45 end
45 46
46 @testset "spacing" begin 47 @testset "spacing" begin
47 @test spacing(EquidistantGrid(0:10)) == 1 48 @test spacing(EquidistantGrid(0:10)) == 1
48 @test spacing(EquidistantGrid(0:0.1:10)) == 0.1 49 @test spacing(EquidistantGrid(0:0.1:10)) == 0.1