comparison test/Grids/tensor_grid_test.jl @ 1390:47931bef8471 bugfix/grids/complete_interface_impl

Implement `firstindex` and `lastindex` for `TensorGrid`
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 15 Aug 2023 22:39:34 +0200
parents c0208286234e
children a7afba63adb5
comparison
equal deleted inserted replaced
1389:d2219cc8316b 1390:47931bef8471
59 @test eachindex(TensorGrid(g₁, g₄)) == CartesianIndices((11,)) 59 @test eachindex(TensorGrid(g₁, g₄)) == CartesianIndices((11,))
60 @test eachindex(TensorGrid(g₁, g₄, g₂)) == CartesianIndices((11,6)) 60 @test eachindex(TensorGrid(g₁, g₄, g₂)) == CartesianIndices((11,6))
61 end 61 end
62 62
63 @testset "firstindex" begin 63 @testset "firstindex" begin
64 @test_broken firstindex(TensorGrid(g₁, g₂, g₃), 1) == 1 64 @test firstindex(TensorGrid(g₁, g₂, g₃), 1) == 1
65 @test_broken firstindex(TensorGrid(g₁, g₂, g₃), 2) == 1 65 @test firstindex(TensorGrid(g₁, g₂, g₃), 2) == 1
66 @test_broken firstindex(TensorGrid(g₁, g₂, g₃), 3) == 1 66 @test firstindex(TensorGrid(g₁, g₂, g₃), 3) == 1
67 end 67 end
68 68
69 @testset "lastindex" begin 69 @testset "lastindex" begin
70 @test_broken lastindex(TensorGrid(g₁, g₂, g₃), 1) == 11 70 @test lastindex(TensorGrid(g₁, g₂, g₃), 1) == 11
71 @test_broken lastindex(TensorGrid(g₁, g₂, g₃), 2) == 6 71 @test lastindex(TensorGrid(g₁, g₂, g₃), 2) == 6
72 @test_broken lastindex(TensorGrid(g₁, g₂, g₃), 3) == 10 72 @test lastindex(TensorGrid(g₁, g₂, g₃), 3) == 10
73 end 73 end
74 end 74 end
75 75
76 @testset "Iterator interface" begin 76 @testset "Iterator interface" begin
77 @test eltype(TensorGrid(g₁, g₂)) == SVector{2,Float64} 77 @test eltype(TensorGrid(g₁, g₂)) == SVector{2,Float64}