From cfe1c7b0162a70a0544167db4eba7f0758721776 Mon Sep 17 00:00:00 2001 From: Arvind Maan Date: Mon, 14 Sep 2020 14:24:01 -0500 Subject: [PATCH] Add tests for new min/max functions --- test/interval.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/interval.jl b/test/interval.jl index 037acb12..431b19e3 100644 --- a/test/interval.jl +++ b/test/interval.jl @@ -125,12 +125,17 @@ isinf(::TimeType) = false end @testset "accessors" begin - for (a, b, _) in test_values + for (a, b, p) in test_values for (L, R) in BOUND_PERMUTATIONS interval = Interval{L, R}(a, b) @test first(interval) == a @test last(interval) == b + # the value we compare to min/max depends on if the bound is open/closed + min_comp = a in interval ? first(interval) : first(interval) + p + max_comp = b in interval ? last(interval) : last(interval) - p + @test min(interval; precision=p) == min_comp + @test max(interval; precision=p) == max_comp @test span(interval) == b - a @test isclosed(interval) == (L === Closed && R === Closed) @test isopen(interval) == (L === Open && R === Open)