Mercurial > repos > public > sbplib_julia
comparison test/Grids/grid_test.jl @ 1474:276c38a48aac feature/grids/componentview
Start implementing componentview
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 01 Dec 2023 13:34:03 +0100 |
parents | 86026367a9ff |
children | 62f9d0387a2a |
comparison
equal
deleted
inserted
replaced
1473:869a40cda18c | 1474:276c38a48aac |
---|---|
61 # Multi-argument functions | 61 # Multi-argument functions |
62 f(x,y) = sin(x)*cos(y) | 62 f(x,y) = sin(x)*cos(y) |
63 @test eval_on(g, f) == map(x̄->f(x̄...), g) | 63 @test eval_on(g, f) == map(x̄->f(x̄...), g) |
64 end | 64 end |
65 | 65 |
66 @testset "componentview" begin | |
67 v = [@SMatrix[1 3; 2 4] .+ 100*i .+ 10*j for i ∈ 1:3, j∈ 1:4] | |
68 | |
69 @test componentview(v, 1, 1) == [1 .+ 100*i .+ 10*j for i ∈ 1:3, j∈ 1:4] | |
70 @test componentview(v, 1, 2) == [3 .+ 100*i .+ 10*j for i ∈ 1:3, j∈ 1:4] | |
71 @test componentview(v, 2, 1) == [2 .+ 100*i .+ 10*j for i ∈ 1:3, j∈ 1:4] | |
72 | |
73 # should work with colon | |
74 # should return a view which can be index like the grid function | |
75 end | |
76 | |
66 @testset "_ncomponents" begin | 77 @testset "_ncomponents" begin |
67 @test Grids._ncomponents(Int) == 1 | 78 @test Grids._ncomponents(Int) == 1 |
68 @test Grids._ncomponents(Float64) == 1 | 79 @test Grids._ncomponents(Float64) == 1 |
69 @test Grids._ncomponents(Rational) == 1 | 80 @test Grids._ncomponents(Rational) == 1 |
70 | 81 |