From d08b5bf8259bcd458beec17ba65a7b85f454edda Mon Sep 17 00:00:00 2001 From: Raymond Toy <toy.raymond@gmail.com> Date: Wed, 27 Aug 2014 21:22:18 -0700 Subject: [PATCH] Add some tests for ROUND. Two tests currently fail. --- tests/srctran.lisp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/srctran.lisp b/tests/srctran.lisp index f88e97712..e3cba34e3 100644 --- a/tests/srctran.lisp +++ b/tests/srctran.lisp @@ -80,3 +80,25 @@ (c::ceiling-rem-bound (c::make-interval :low '(-1.3) :high 10.3))) (assert-equalp (c::make-interval :low '(-20.3) :high '(20.3)) (c::ceiling-rem-bound (c::make-interval :low '(-20.3) :high 10.3)))) + +(define-test round-quotient-bound + "Test the first value of ROUND returns the correct interval" + (assert-equalp (c::make-interval :low 0 :high 10) + (c::round-quotient-bound (c::make-interval :low 0.3 :high 10.5))) + (assert-equalp (c::make-interval :low 0 :high 12) + (c::round-quotient-bound (c::make-interval :low 0.3 :high 11.5))) + (assert-equalp (c::make-interval :low 0 :high 10) + (c::round-quotient-bound (c::make-interval :low 0.3 :high '(10.5)))) + ;; Known failure: returns high limit of 12 instead of 11 + (assert-equalp (c::make-interval :low 0 :high 11) + (c::round-quotient-bound (c::make-interval :low 0.3 :high '(11.5)))) + (assert-equalp (c::make-interval :low 2 :high 10) + (c::round-quotient-bound (c::make-interval :low 1.5 :high 10.5))) + (assert-equalp (c::make-interval :low 2 :high 10) + (c::round-quotient-bound (c::make-interval :low '(1.5) :high 10.5))) + ;; Known failure: returns high limit of 0 instead of 1 + (assert-equalp (c::make-interval :low 1 :high 10) + (c::round-quotient-bound (c::make-interval :low '(0.5) :high 10.5))) + ) + + \ No newline at end of file -- GitLab