Mercurial > repos > public > sbplib_julia
diff test/Grids/grid_test.jl @ 1397:86026367a9ff feature/grids/scalar_eval_on
Support evaluating scalars on grids
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Tue, 15 Aug 2023 22:55:25 +0200 |
parents | fa3695f634de |
children | 276c38a48aac d50ea06813d5 |
line wrap: on
line diff
--- a/test/Grids/grid_test.jl Thu Jun 08 15:52:22 2023 +0200 +++ b/test/Grids/grid_test.jl Tue Aug 15 22:55:25 2023 +0200 @@ -38,6 +38,9 @@ @test eval_on(ZeroDimGrid(1.), x̄->2x̄) isa LazyArray @test eval_on(ZeroDimGrid(1.), x̄->2x̄) == fill(2.) + @test eval_on(ZeroDimGrid(@SVector[1.,2.]), π) isa LazyArray + @test eval_on(ZeroDimGrid(@SVector[1.,2.]), π) == fill(π) + @test eval_on(EquidistantGrid(range(0,1,length=4)), x->2x) isa LazyArray @test eval_on(EquidistantGrid(range(0,1,length=4)), x->2x) == 2 .* range(0,1,length=4) @@ -49,6 +52,8 @@ @test eval_on(g, x̄ -> sin(x̄[1])*cos(x̄[2])) == map(x̄->sin(x̄[1])*cos(x̄[2]), g) + @test eval_on(g, π) == fill(π, (5,3)) + # Vector valued function @test eval_on(g, x̄ -> @SVector[x̄[2], x̄[1]]) isa LazyArray{SVector{2,Float64}} @test eval_on(g, x̄ -> @SVector[x̄[2], x̄[1]]) == map(x̄ -> @SVector[x̄[2], x̄[1]], g)