comparison test/Grids/manifolds_test.jl @ 1779:2a8a2b52a112 feature/grids/manifolds

Refactor Interval to its own type. This allows the user better control of the coordinate type of 1d grids
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 16 Sep 2024 08:33:43 +0200
parents 03894fd7b132
children 8ecdc5bb46be
comparison
equal deleted inserted replaced
1778:a93d2b668446 1779:2a8a2b52a112
9 @testset "ParameterSpace" begin 9 @testset "ParameterSpace" begin
10 @test ndims(HyperBox([1,1], [2,2])) == 2 10 @test ndims(HyperBox([1,1], [2,2])) == 2
11 @test ndims(unittetrahedron()) == 3 11 @test ndims(unittetrahedron()) == 3
12 end 12 end
13 13
14 @testset "Interval" begin
15 @test Interval <: ParameterSpace{1}
16
17 @test Interval(0,1) isa Interval{Int}
18 @test Interval(0,1.) isa Interval{Float64}
19
20 @test unitinterval() isa Interval{Float64}
21 @test unitinterval() == Interval(0.,1.)
22 @test limits(unitinterval()) == (0.,1.)
23
24 @test unitinterval(Int) isa Interval{Int}
25 @test unitinterval(Int) == Interval(0,1)
26 @test limits(unitinterval(Int)) == (0,1)
27 end
28
14 @testset "HyperBox" begin 29 @testset "HyperBox" begin
15 @test HyperBox{<:Any, 2} <: ParameterSpace{2} 30 @test HyperBox{<:Any, 2} <: ParameterSpace{2}
16 @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2} 31 @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2}
17 32
18 @test limits(HyperBox([1,2], [3,4])) == ([1,2], [3,4]) 33 @test limits(HyperBox([1,2], [3,4])) == ([1,2], [3,4])
19 @test limits(HyperBox([1,2], [3,4]), 1) == (1,3) 34 @test limits(HyperBox([1,2], [3,4]), 1) == (1,3)
20 @test limits(HyperBox([1,2], [3,4]), 2) == (2,4) 35 @test limits(HyperBox([1,2], [3,4]), 2) == (2,4)
21
22 @test unitinterval() isa HyperBox{Float64,1}
23 @test limits(unitinterval()) == ([0], [1])
24
25 @test unitinterval(Int) isa HyperBox{Int,1}
26 @test limits(unitinterval(Int)) == ([0], [1])
27 36
28 @test unitsquare() isa HyperBox{Float64,2} 37 @test unitsquare() isa HyperBox{Float64,2}
29 @test limits(unitsquare()) == ([0,0],[1,1]) 38 @test limits(unitsquare()) == ([0,0],[1,1])
30 39
31 @test unitcube() isa HyperBox{Float64,3} 40 @test unitcube() isa HyperBox{Float64,3}