diff test/Grids/manifolds_test.jl @ 1779:2a8a2b52a112 feature/grids/manifolds

Refactor Interval to its own type. This allows the user better control of the coordinate type of 1d grids
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 16 Sep 2024 08:33:43 +0200
parents 03894fd7b132
children 8ecdc5bb46be
line wrap: on
line diff
--- a/test/Grids/manifolds_test.jl	Sun Sep 15 23:27:04 2024 +0200
+++ b/test/Grids/manifolds_test.jl	Mon Sep 16 08:33:43 2024 +0200
@@ -11,6 +11,21 @@
     @test ndims(unittetrahedron()) == 3
 end
 
+@testset "Interval" begin
+    @test Interval <: ParameterSpace{1}
+
+    @test Interval(0,1) isa Interval{Int}
+    @test Interval(0,1.) isa Interval{Float64}
+
+    @test unitinterval() isa Interval{Float64}
+    @test unitinterval() == Interval(0.,1.)
+    @test limits(unitinterval()) == (0.,1.)
+
+    @test unitinterval(Int) isa Interval{Int}
+    @test unitinterval(Int) == Interval(0,1)
+    @test limits(unitinterval(Int)) == (0,1)
+end
+
 @testset "HyperBox" begin
     @test HyperBox{<:Any, 2} <: ParameterSpace{2}
     @test HyperBox([1,1], [2,2]) isa HyperBox{Int, 2}
@@ -19,12 +34,6 @@
     @test limits(HyperBox([1,2], [3,4]), 1) == (1,3)
     @test limits(HyperBox([1,2], [3,4]), 2) == (2,4)
 
-    @test unitinterval() isa HyperBox{Float64,1}
-    @test limits(unitinterval()) == ([0], [1])
-
-    @test unitinterval(Int) isa HyperBox{Int,1}
-    @test limits(unitinterval(Int)) == ([0], [1])
-
     @test unitsquare() isa HyperBox{Float64,2}
     @test limits(unitsquare()) == ([0,0],[1,1])