comparison test/Grids/tensor_grid_test.jl @ 1387:3d6425c36d32 bugfix/grids/complete_interface_impl

Start adding tests for `firstindex` and `lastindex` on `TensorGrid`
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 15 Aug 2023 21:20:29 +0200
parents 42ecd4b3e215
children c0208286234e
comparison
equal deleted inserted replaced
1384:851d1e4ab3de 1387:3d6425c36d32
56 @test eachindex(TensorGrid(g₁, g₂)) == CartesianIndices((11,6)) 56 @test eachindex(TensorGrid(g₁, g₂)) == CartesianIndices((11,6))
57 @test eachindex(TensorGrid(g₁, g₃)) == CartesianIndices((11,10)) 57 @test eachindex(TensorGrid(g₁, g₃)) == CartesianIndices((11,10))
58 @test eachindex(TensorGrid(g₁, g₂, g₃)) == CartesianIndices((11,6,10)) 58 @test eachindex(TensorGrid(g₁, g₂, g₃)) == CartesianIndices((11,6,10))
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
62
63 @testset "firstindex" begin
64 @test_broken firstindex(TensorGrid(g₁, g₂, g₃), 1) == 1
65 @test_broken firstindex(TensorGrid(g₁, g₂, g₃), 2) == 1
66 @test_broken firstindex(TensorGrid(g₁, g₂, g₃), 3) == 1
67 end
68
69 @testset "lastindex" begin
70 @test_broken lastindex(TensorGrid(g₁, g₂, g₃), 1) == 11
71 @test_broken lastindex(TensorGrid(g₁, g₂, g₃), 2) == 6
72 @test_broken lastindex(TensorGrid(g₁, g₂, g₃), 3) == 10
61 end 73 end
62 end 74 end
63 75
64 @testset "Iterator interface" begin 76 @testset "Iterator interface" begin
65 @test eltype(TensorGrid(g₁, g₂)) == SVector{2,Float64} 77 @test eltype(TensorGrid(g₁, g₂)) == SVector{2,Float64}