comparison test/Grids/manifolds_test.jl @ 1780:8ecdc5bb46be feature/grids/manifolds

Allow mixed types in constructors for HyperBox and Simplex
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 16 Sep 2024 08:58:12 +0200
parents 2a8a2b52a112
children a73838c9ef94
comparison
equal deleted inserted replaced
1779:2a8a2b52a112 1780:8ecdc5bb46be
28 28
29 @testset "HyperBox" begin 29 @testset "HyperBox" begin
30 @test HyperBox{<:Any, 2} <: ParameterSpace{2} 30 @test HyperBox{<:Any, 2} <: ParameterSpace{2}
31 @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2} 31 @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2}
32 32
33 @test HyperBox([1,2], [1.,2.]) isa HyperBox{Float64,2}
34
33 @test limits(HyperBox([1,2], [3,4])) == ([1,2], [3,4]) 35 @test limits(HyperBox([1,2], [3,4])) == ([1,2], [3,4])
34 @test limits(HyperBox([1,2], [3,4]), 1) == (1,3) 36 @test limits(HyperBox([1,2], [3,4]), 1) == (1,3)
35 @test limits(HyperBox([1,2], [3,4]), 2) == (2,4) 37 @test limits(HyperBox([1,2], [3,4]), 2) == (2,4)
36 38
37 @test unitsquare() isa HyperBox{Float64,2} 39 @test unitsquare() isa HyperBox{Float64,2}
46 48
47 @testset "Simplex" begin 49 @testset "Simplex" begin
48 @test Simplex{<:Any, 3} <: ParameterSpace{3} 50 @test Simplex{<:Any, 3} <: ParameterSpace{3}
49 @test Simplex([1,2], [3,4]) isa Simplex{Int, 2} 51 @test Simplex([1,2], [3,4]) isa Simplex{Int, 2}
50 @test Simplex([1,2,3], [4,5,6],[1,1,1]) isa Simplex{Int, 3} 52 @test Simplex([1,2,3], [4,5,6],[1,1,1]) isa Simplex{Int, 3}
53
54 @test Simplex([1,2], [3.,4.]) isa Simplex{Float64, 2}
51 55
52 @test verticies(Simplex([1,2], [3,4])) == ([1,2], [3,4]) 56 @test verticies(Simplex([1,2], [3,4])) == ([1,2], [3,4])
53 57
54 @test unittriangle() isa Simplex{Float64,2} 58 @test unittriangle() isa Simplex{Float64,2}
55 @test verticies(unittriangle()) == ([0,0], [1,0], [0,1]) 59 @test verticies(unittriangle()) == ([0,0], [1,0], [0,1])