Skip to content

Commit

Permalink
Added multidim_tests.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
dpsanders committed Feb 21, 2016
1 parent 19370b2 commit dfd3fb0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/multidim_tests/multidim_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using FactCheck

facts("Operations on boxes") do
A = IntervalBox(1..2, 3..4)
B = IntervalBox(0..2, 3..6)

@fact 2*A --> IntervalBox(2..4, 6..8)
@fact A + B --> IntervalBox(1..4, 6..10)
@fact dot(A, B) --> @interval(9, 28)

@fact A B --> true

X = IntervalBox(1..2, 3..4)
Y = IntervalBox(3..4, 3..4)

@fact isempty(X Y) --> true

v = [@interval(i, i+1) for i in 1:10]
V = IntervalBox(v...)

@fact length(V) --> 10

end

facts("@box tests") do
@box f(x, y) = (x + y, x - y)

X = IntervalBox(1..1, 2..2)
@fact f(X) --> IntervalBox(3..3, -1 .. -1)

end

0 comments on commit dfd3fb0

Please sign in to comment.