Skip to content

Commit 3b36926

Browse files
committed
added tests
1 parent c563791 commit 3b36926

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/display_tests/display.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,26 @@ setprecision(Interval, Float64)
177177
setformat(:full)
178178
@test string(X) == "IntervalBox(Interval(-Inf, Inf), 2)"
179179

180+
181+
setformat(:standard)
182+
a = IntervalBox(1..2, 2..3)
183+
@test string(a) == "[1, 2] × [2, 3]"
184+
185+
b = IntervalBox(emptyinterval(), 2)
186+
@test string(b) == "∅²"
187+
188+
c = IntervalBox(1..2, 1)
189+
@test string(c) == "[1, 2]¹"
190+
191+
setformat(:full)
192+
@test string(a) == "IntervalBox(Interval(1.0, 2.0), Interval(2.0, 3.0))"
193+
@test string(b) == "IntervalBox(∅, 2)"
194+
@test string(c) == "IntervalBox(Interval(1.0, 2.0), 1)"
195+
196+
setformat(:midpoint)
197+
@test string(a) == "(1.5 ± 0.5) × (2.5 ± 0.5)"
198+
@test string(b) == "∅²"
199+
@test string(c) == "(1.5 ± 0.5)¹"
180200
end
181201
end
182202

@@ -203,6 +223,14 @@ end
203223
setformat(decorations=true)
204224
@test string(x) == "[0, 1]₁₂₈_def"
205225

226+
a = IntervalBox(1..2, 2..3)
227+
b = IntervalBox(emptyinterval(), 2)
228+
c = IntervalBox(1..2, 1)
229+
230+
@test sprint(showfull, a) == "IntervalBox(Interval(1.0, 2.0), Interval(2.0, 3.0))"
231+
@test sprint(showfull, b) == "IntervalBox(∅, 2)"
232+
@test sprint(showfull, c) == "IntervalBox(Interval(1.0, 2.0), 1)"
233+
206234
end
207235

208236
@testset "@format tests" begin

0 commit comments

Comments
 (0)