Mercurial > repos > public > sbplib_julia
comparison test/Grids/parameter_space_test.jl @ 1902:f93ba5832146 feature/grids/parameter_spaces
Copy changes related to ParameterSpace from feature/grids/manifolds
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 01 Feb 2025 22:12:53 +0100 |
parents | |
children | 4209290cb377 |
comparison
equal
deleted
inserted
replaced
1900:418566cdd689 | 1902:f93ba5832146 |
---|---|
1 using Test | |
2 | |
3 @testset "ParameterSpace" begin | |
4 @test ndims(HyperBox([1,1], [2,2])) == 2 | |
5 @test ndims(unittetrahedron()) == 3 | |
6 end | |
7 | |
8 @testset "Interval" begin | |
9 @test Interval <: ParameterSpace{1} | |
10 | |
11 @test Interval(0,1) isa Interval{Int} | |
12 @test Interval(0,1.) isa Interval{Float64} | |
13 | |
14 @test unitinterval() isa Interval{Float64} | |
15 @test unitinterval() == Interval(0.,1.) | |
16 @test limits(unitinterval()) == (0.,1.) | |
17 | |
18 @test unitinterval(Int) isa Interval{Int} | |
19 @test unitinterval(Int) == Interval(0,1) | |
20 @test limits(unitinterval(Int)) == (0,1) | |
21 end | |
22 | |
23 @testset "HyperBox" begin | |
24 @test HyperBox{<:Any, 2} <: ParameterSpace{2} | |
25 @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2} | |
26 | |
27 @test HyperBox([1,2], [1.,2.]) isa HyperBox{Float64,2} | |
28 | |
29 @test limits(HyperBox([1,2], [3,4])) == ([1,2], [3,4]) | |
30 @test limits(HyperBox([1,2], [3,4]), 1) == (1,3) | |
31 @test limits(HyperBox([1,2], [3,4]), 2) == (2,4) | |
32 | |
33 @test unitsquare() isa HyperBox{Float64,2} | |
34 @test limits(unitsquare()) == ([0,0],[1,1]) | |
35 | |
36 @test unitcube() isa HyperBox{Float64,3} | |
37 @test limits(unitcube()) == ([0,0,0],[1,1,1]) | |
38 | |
39 @test unithyperbox(4) isa HyperBox{Float64,4} | |
40 @test limits(unithyperbox(4)) == ([0,0,0,0],[1,1,1,1]) | |
41 end | |
42 | |
43 @testset "Simplex" begin | |
44 @test Simplex{<:Any, 3} <: ParameterSpace{3} | |
45 @test Simplex([1,2], [3,4]) isa Simplex{Int, 2} | |
46 @test Simplex([1,2,3], [4,5,6],[1,1,1]) isa Simplex{Int, 3} | |
47 | |
48 @test Simplex([1,2], [3.,4.]) isa Simplex{Float64, 2} | |
49 | |
50 @test verticies(Simplex([1,2], [3,4])) == ([1,2], [3,4]) | |
51 | |
52 @test unittriangle() isa Simplex{Float64,2} | |
53 @test verticies(unittriangle()) == ([0,0], [1,0], [0,1]) | |
54 | |
55 @test unittetrahedron() isa Simplex{Float64,3} | |
56 @test verticies(unittetrahedron()) == ([0,0,0], [1,0,0], [0,1,0],[0,0,1]) | |
57 | |
58 @test unitsimplex(4) isa Simplex{Float64,4} | |
59 end |