Mercurial > repos > public > sbplib_julia
comparison test/Grids/tensor_grid_test.jl @ 1400:a7afba63adb5 bugfix/grids/complete_interface_impl
Add tests for `begin` and `end` indexing for `TensorGrid`s
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 22 Aug 2023 09:05:53 +0200 |
parents | 47931bef8471 |
children | c7c5bc2a1ce2 |
comparison
equal
deleted
inserted
replaced
1399:adbdbf1c3480 | 1400:a7afba63adb5 |
---|---|
32 @test TensorGrid(g₁, g₄)[3] isa SVector{3,Float64} | 32 @test TensorGrid(g₁, g₄)[3] isa SVector{3,Float64} |
33 @test TensorGrid(g₁, g₄)[3] == [0.2, 1., 2.] | 33 @test TensorGrid(g₁, g₄)[3] == [0.2, 1., 2.] |
34 | 34 |
35 @test TensorGrid(g₁, g₄, g₂)[3,2] isa SVector{4,Float64} | 35 @test TensorGrid(g₁, g₄, g₂)[3,2] isa SVector{4,Float64} |
36 @test TensorGrid(g₁, g₄, g₂)[3,2] == [0.2, 1., 2., 2.2] | 36 @test TensorGrid(g₁, g₄, g₂)[3,2] == [0.2, 1., 2., 2.2] |
37 | |
38 g = TensorGrid(g₁, g₂) | |
39 @test g[begin, begin] == g[1,1] | |
40 @test g[begin, end] == g[1,6] | |
41 @test g[end, end] == g[11,6] | |
37 end | 42 end |
38 | 43 |
39 @testset "cartesian indexing" begin | 44 @testset "cartesian indexing" begin |
40 cases = [ | 45 cases = [ |
41 (TensorGrid(g₁, g₂), (1,1) ), | 46 (TensorGrid(g₁, g₂), (1,1) ), |