Mercurial > repos > public > sbplib_julia
comparison test/Grids/grid_test.jl @ 1288:7de1df0aad6a refactor/grids
Add component_type function to Grid
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Fri, 03 Mar 2023 15:42:05 +0100 |
| parents | 1157f889bf50 |
| children | 3b7ebd135918 |
comparison
equal
deleted
inserted
replaced
| 1287:014d365c18de | 1288:7de1df0aad6a |
|---|---|
| 12 @test ndims(DummyGrid{Int, 2}()) == 2 | 12 @test ndims(DummyGrid{Int, 2}()) == 2 |
| 13 @test dims(DummyGrid{Int, 2}()) == 1:2 | 13 @test dims(DummyGrid{Int, 2}()) == 1:2 |
| 14 | 14 |
| 15 @test target_manifold_dim(DummyGrid{Int, 1}()) == 1 | 15 @test target_manifold_dim(DummyGrid{Int, 1}()) == 1 |
| 16 @test target_manifold_dim(DummyGrid{SVector{3,Float64}, 2}()) == 3 | 16 @test target_manifold_dim(DummyGrid{SVector{3,Float64}, 2}()) == 3 |
| 17 | |
| 18 @testset "component_type" begin | |
| 19 @test component_type(DummyGrid{Int,1}()) == Int | |
| 20 @test component_type(DummyGrid{Float64,1}()) == Float64 | |
| 21 @test component_type(DummyGrid{Rational,1}()) == Rational | |
| 22 | |
| 23 @test component_type(DummyGrid{SVector{3,Int},2}()) == Int | |
| 24 @test component_type(DummyGrid{SVector{2,Float64},3}()) == Float64 | |
| 25 @test component_type(DummyGrid{SVector{4,Rational},4}()) == Rational | |
| 26 end | |
| 17 end | 27 end |
| 18 | 28 |
| 19 @testset "eval_on" begin | 29 @testset "eval_on" begin |
| 20 @test eval_on(ZeroDimGrid(@SVector[1.,2.]), x̄->x̄[1]+x̄[2]) isa LazyArray | 30 @test eval_on(ZeroDimGrid(@SVector[1.,2.]), x̄->x̄[1]+x̄[2]) isa LazyArray |
| 21 @test eval_on(ZeroDimGrid(@SVector[1.,2.]), x̄->x̄[1]+x̄[2]) == fill(3.) | 31 @test eval_on(ZeroDimGrid(@SVector[1.,2.]), x̄->x̄[1]+x̄[2]) == fill(3.) |
