comparison test/Grids/parameter_space_test.jl @ 1951:6c1bb9bdb092 feature/grids/geometry_functions

Merge feature/grids/manifolds
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 07 Feb 2025 22:38:39 +0100
parents 15be190a40cd
children 77ff0a2acbe5
comparison
equal deleted inserted replaced
1916:6859089b361e 1951:6c1bb9bdb092
1 using Test 1 using Test
2
3 using Diffinitive.Grids
2 4
3 @testset "ParameterSpace" begin 5 @testset "ParameterSpace" begin
4 @test ndims(HyperBox([1,1], [2,2])) == 2 6 @test ndims(HyperBox([1,1], [2,2])) == 2
5 @test ndims(unittetrahedron()) == 3 7 @test ndims(unittetrahedron()) == 3
6 end 8 end
16 @test limits(unitinterval()) == (0.,1.) 18 @test limits(unitinterval()) == (0.,1.)
17 19
18 @test unitinterval(Int) isa Interval{Int} 20 @test unitinterval(Int) isa Interval{Int}
19 @test unitinterval(Int) == Interval(0,1) 21 @test unitinterval(Int) == Interval(0,1)
20 @test limits(unitinterval(Int)) == (0,1) 22 @test limits(unitinterval(Int)) == (0,1)
23
24 @test boundary_identifiers(unitinterval()) == (LowerBoundary(), UpperBoundary())
21 end 25 end
22 26
23 @testset "HyperBox" begin 27 @testset "HyperBox" begin
24 @test HyperBox{<:Any, 2} <: ParameterSpace{2} 28 @test HyperBox{<:Any, 2} <: ParameterSpace{2}
25 @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2} 29 @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2}
36 @test unitcube() isa HyperBox{Float64,3} 40 @test unitcube() isa HyperBox{Float64,3}
37 @test limits(unitcube()) == ([0,0,0],[1,1,1]) 41 @test limits(unitcube()) == ([0,0,0],[1,1,1])
38 42
39 @test unithyperbox(4) isa HyperBox{Float64,4} 43 @test unithyperbox(4) isa HyperBox{Float64,4}
40 @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 ]
41 end 62 end
42 63
43 @testset "Simplex" begin 64 @testset "Simplex" begin
44 @test Simplex{<:Any, 3} <: ParameterSpace{3} 65 @test Simplex{<:Any, 3} <: ParameterSpace{3}
45 @test Simplex([1,2], [3,4]) isa Simplex{Int, 2} 66 @test Simplex([1,2], [3,4]) isa Simplex{Int, 2}