comparison test/Grids/parameter_space_test.jl @ 1990:8cf1764ba124 feature/grids/parameter_spaces/in

Implement Base.in(x, ::HyperBox)
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 23 Apr 2025 15:42:38 +0200
parents 77ff0a2acbe5
children ca6d898d3a38
comparison
equal deleted inserted replaced
1989:77ff0a2acbe5 1990:8cf1764ba124
1 using Test 1 using Test
2 2
3 using Diffinitive.Grids 3 using Diffinitive.Grids
4 using StaticArrays
4 5
5 @testset "ParameterSpace" begin 6 @testset "ParameterSpace" begin
6 @test ndims(HyperBox([1,1], [2,2])) == 2 7 @test ndims(HyperBox([1,1], [2,2])) == 2
7 @test ndims(unittetrahedron()) == 3 8 @test ndims(unittetrahedron()) == 3
8 end 9 end
64 CartesianBoundary{2,LowerBoundary}(), 65 CartesianBoundary{2,LowerBoundary}(),
65 CartesianBoundary{2,UpperBoundary}(), 66 CartesianBoundary{2,UpperBoundary}(),
66 CartesianBoundary{3,LowerBoundary}(), 67 CartesianBoundary{3,LowerBoundary}(),
67 CartesianBoundary{3,UpperBoundary}(), 68 CartesianBoundary{3,UpperBoundary}(),
68 ] 69 ]
70
71 @test @SVector[1.5, 3.5] ∈ HyperBox([1,2], [3,4])
72 @test @SVector[1, 2] ∈ HyperBox([1,2], [3,4])
73 @test @SVector[3, 4] ∈ HyperBox([1,2], [3,4])
74
75 @test @SVector[0.5, 3.5] ∉ HyperBox([1,2], [3,4])
76 @test @SVector[1.5, 4.5] ∉ HyperBox([1,2], [3,4])
69 end 77 end
70 78
71 @testset "Simplex" begin 79 @testset "Simplex" begin
72 @test Simplex{<:Any, 3} <: ParameterSpace{3} 80 @test Simplex{<:Any, 3} <: ParameterSpace{3}
73 @test Simplex([1,2], [3,4]) isa Simplex{Int, 2} 81 @test Simplex([1,2], [3,4]) isa Simplex{Int, 2}