From 25b45d6af0134ac99f2ea57f1bbbd8450515f329 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Sun, 6 Sep 2009 09:04:46 -0500 Subject: [PATCH] test fp traps --- basis/math/floats/env/env-tests.factor | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/basis/math/floats/env/env-tests.factor b/basis/math/floats/env/env-tests.factor index 65662e72d7..048e12453a 100644 --- a/basis/math/floats/env/env-tests.factor +++ b/basis/math/floats/env/env-tests.factor @@ -13,12 +13,12 @@ IN: math.floats.env.tests ] unit-test [ t ] [ - [ 2.0 100000.0 ^ drop ] collect-fp-exceptions + [ 2.0 100,000.0 ^ drop ] collect-fp-exceptions { +fp-inexact+ +fp-overflow+ } set= ] unit-test [ t ] [ - [ 2.0 -100000.0 ^ drop ] collect-fp-exceptions + [ 2.0 -100,000.0 ^ drop ] collect-fp-exceptions { +fp-inexact+ +fp-underflow+ } set= ] unit-test @@ -121,3 +121,11 @@ IN: math.floats.env.tests ] with-denormal-mode ] unit-test +[ { +fp-zero-divide+ } [ 1.0 0.0 /f ] with-fp-traps ] must-fail +[ { +fp-inexact+ } [ 1.0 3.0 /f ] with-fp-traps ] must-fail +[ { +fp-invalid-operation+ } [ -1.0 fsqrt ] with-fp-traps ] must-fail +[ { +fp-overflow+ } [ 2.0 100,000.0 ^ ] with-fp-traps ] must-fail +[ { +fp-underflow+ } [ 2.0 -100,000.0 ^ ] with-fp-traps ] must-fail + +! Ensure traps get cleared +[ 1/0. ] [ 1.0 0.0 /f ] unit-test