comparison test/Grids/grid_test.jl @ 1511:d50ea06813d5 refactor/component_type

Move and extend tests to reflect that component_type is more general than before
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 21 Mar 2024 07:59:53 +0100
parents 86026367a9ff
children 0cd6cf62af93
comparison
equal deleted inserted replaced
1510:606975cdb1f3 1511:d50ea06813d5
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 17 @test coordinate_size(DummyGrid{SVector{3,Float64}, 2}) == 3
18 end
18 19
19 @testset "component_type" begin 20 @testset "component_type" begin
20 @test component_type(DummyGrid{Int,1}()) == Int 21 @test component_type(DummyGrid{Int,1}()) == Int
21 @test component_type(DummyGrid{Float64,1}()) == Float64 22 @test component_type(DummyGrid{Float64,1}()) == Float64
22 @test component_type(DummyGrid{Rational,1}()) == Rational 23 @test component_type(DummyGrid{Rational,1}()) == Rational
23 24
24 @test component_type(DummyGrid{SVector{3,Int},2}()) == Int 25 @test component_type(DummyGrid{SVector{3,Int},2}()) == Int
25 @test component_type(DummyGrid{SVector{2,Float64},3}()) == Float64 26 @test component_type(DummyGrid{SVector{2,Float64},3}()) == Float64
26 @test component_type(DummyGrid{SVector{4,Rational},4}()) == Rational 27 @test component_type(DummyGrid{SVector{4,Rational},4}()) == Rational
27 28
28 @test component_type(DummyGrid{Float64,1}) == Float64 29 @test component_type(DummyGrid{Float64,1}) == Float64
29 @test component_type(DummyGrid{SVector{2,Float64},3}) == Float64 30 @test component_type(DummyGrid{SVector{2,Float64},3}) == Float64
30 end 31
32 @test component_type(fill(@SVector[1,2], 4,2)) == Int
31 end 33 end
32 34
33 @testset "eval_on" begin 35 @testset "eval_on" begin
34 @test eval_on(ZeroDimGrid(@SVector[1.,2.]), x̄->x̄[1]+x̄[2]) isa LazyArray 36 @test eval_on(ZeroDimGrid(@SVector[1.,2.]), x̄->x̄[1]+x̄[2]) isa LazyArray
35 @test eval_on(ZeroDimGrid(@SVector[1.,2.]), x̄->x̄[1]+x̄[2]) == fill(3.) 37 @test eval_on(ZeroDimGrid(@SVector[1.,2.]), x̄->x̄[1]+x̄[2]) == fill(3.)