comparison test/Grids/grid_test.jl @ 1333:79a2193da5c1 refactor/grids

Implement coordinate_size() and component_type() types
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 03 May 2023 15:39:34 +0200
parents ad31c1022e42
children fa3695f634de
comparison
equal deleted inserted replaced
1332:ad31c1022e42 1333:79a2193da5c1
12 @test ndims(DummyGrid{Int, 2}()) == 2 12 @test ndims(DummyGrid{Int, 2}()) == 2
13 13
14 @test coordinate_size(DummyGrid{Int, 1}()) == 1 14 @test coordinate_size(DummyGrid{Int, 1}()) == 1
15 @test coordinate_size(DummyGrid{SVector{3,Float64}, 2}()) == 3 15 @test coordinate_size(DummyGrid{SVector{3,Float64}, 2}()) == 3
16 16
17 @test coordinate_size(DummyGrid{SVector{3,Float64}, 2}) == 3
18
17 @testset "component_type" begin 19 @testset "component_type" begin
18 @test component_type(DummyGrid{Int,1}()) == Int 20 @test component_type(DummyGrid{Int,1}()) == Int
19 @test component_type(DummyGrid{Float64,1}()) == Float64 21 @test component_type(DummyGrid{Float64,1}()) == Float64
20 @test component_type(DummyGrid{Rational,1}()) == Rational 22 @test component_type(DummyGrid{Rational,1}()) == Rational
21 23
22 @test component_type(DummyGrid{SVector{3,Int},2}()) == Int 24 @test component_type(DummyGrid{SVector{3,Int},2}()) == Int
23 @test component_type(DummyGrid{SVector{2,Float64},3}()) == Float64 25 @test component_type(DummyGrid{SVector{2,Float64},3}()) == Float64
24 @test component_type(DummyGrid{SVector{4,Rational},4}()) == Rational 26 @test component_type(DummyGrid{SVector{4,Rational},4}()) == Rational
27
28 @test component_type(DummyGrid{Float64,1}) == Float64
29 @test component_type(DummyGrid{SVector{2,Float64},3}) == Float64
25 end 30 end
26 end 31 end
27 32
28 @testset "eval_on" begin 33 @testset "eval_on" begin
29 @test eval_on(ZeroDimGrid(@SVector[1.,2.]), x̄->x̄[1]+x̄[2]) isa LazyArray 34 @test eval_on(ZeroDimGrid(@SVector[1.,2.]), x̄->x̄[1]+x̄[2]) isa LazyArray