comparison test/Grids/parameter_space_test.jl @ 1910:15be190a40cd feature/grids/parameter_spaces

Add boundary_intifiers(::Interval) and boundary_identifiers(::HyperBox)
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 07 Feb 2025 15:29:05 +0100
parents 4209290cb377
children 77ff0a2acbe5
comparison
equal deleted inserted replaced
1909:4209290cb377 1910:15be190a40cd
18 @test limits(unitinterval()) == (0.,1.) 18 @test limits(unitinterval()) == (0.,1.)
19 19
20 @test unitinterval(Int) isa Interval{Int} 20 @test unitinterval(Int) isa Interval{Int}
21 @test unitinterval(Int) == Interval(0,1) 21 @test unitinterval(Int) == Interval(0,1)
22 @test limits(unitinterval(Int)) == (0,1) 22 @test limits(unitinterval(Int)) == (0,1)
23
24 @test boundary_identifiers(unitinterval()) == (LowerBoundary(), UpperBoundary())
23 end 25 end
24 26
25 @testset "HyperBox" begin 27 @testset "HyperBox" begin
26 @test HyperBox{<:Any, 2} <: ParameterSpace{2} 28 @test HyperBox{<:Any, 2} <: ParameterSpace{2}
27 @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2} 29 @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2}
38 @test unitcube() isa HyperBox{Float64,3} 40 @test unitcube() isa HyperBox{Float64,3}
39 @test limits(unitcube()) == ([0,0,0],[1,1,1]) 41 @test limits(unitcube()) == ([0,0,0],[1,1,1])
40 42
41 @test unithyperbox(4) isa HyperBox{Float64,4} 43 @test unithyperbox(4) isa HyperBox{Float64,4}
42 @test limits(unithyperbox(4)) == ([0,0,0,0],[1,1,1,1]) 44 @test limits(unithyperbox(4)) == ([0,0,0,0],[1,1,1,1])
45
46
47 @test boundary_identifiers(unitsquare()) == [
48 CartesianBoundary{1,LowerBoundary}(),
49 CartesianBoundary{1,UpperBoundary}(),
50 CartesianBoundary{2,LowerBoundary}(),
51 CartesianBoundary{2,UpperBoundary}(),
52 ]
53
54 @test boundary_identifiers(unitcube()) == [
55 CartesianBoundary{1,LowerBoundary}(),
56 CartesianBoundary{1,UpperBoundary}(),
57 CartesianBoundary{2,LowerBoundary}(),
58 CartesianBoundary{2,UpperBoundary}(),
59 CartesianBoundary{3,LowerBoundary}(),
60 CartesianBoundary{3,UpperBoundary}(),
61 ]
43 end 62 end
44 63
45 @testset "Simplex" begin 64 @testset "Simplex" begin
46 @test Simplex{<:Any, 3} <: ParameterSpace{3} 65 @test Simplex{<:Any, 3} <: ParameterSpace{3}
47 @test Simplex([1,2], [3,4]) isa Simplex{Int, 2} 66 @test Simplex([1,2], [3,4]) isa Simplex{Int, 2}