(define assert-inexact
(predicate-assertion inexact? "inexact"))
+(define (assert-flo-error procedure)
+ (if (flo:have-trap-enable/disable?)
+ (assert-error procedure)
+ (expect-failure (lambda () (assert-error procedure)))))
+
(define (assert-no-except/yes-traps procedure)
(assert-eqv
(flo:preserving-environment
(let ((x (identity-procedure (flo:snan 4321)))
(x* (flo:qnan 4321)))
(assert-eqv-nan (no-traps (lambda () (sqrt x))) x*)
- (assert-error (lambda () (yes-traps (lambda () (sqrt x)))))
+ (assert-flo-error (lambda () (yes-traps (lambda () (sqrt x)))))
(assert-only-except/no-traps (flo:exception:invalid-operation)
(lambda () (sqrt x)))
(let ((x+0i (make-rectangular x +0.))
(assert-eqv-nan (no-traps (lambda () (real-part (sqrt x-0i)))) x*)
(assert-eqv-nan (no-traps (lambda () (real-part (sqrt xi+0)))) x*)
(assert-eqv-nan (no-traps (lambda () (real-part (sqrt xi-0)))) x*)
- (assert-error (lambda () (yes-traps (lambda () (sqrt x+0i)))))
- (assert-error (lambda () (yes-traps (lambda () (sqrt x-0i)))))
- (assert-error (lambda () (yes-traps (lambda () (sqrt xi+0)))))
- (assert-error (lambda () (yes-traps (lambda () (sqrt xi-0)))))
+ (assert-flo-error (lambda () (yes-traps (lambda () (sqrt x+0i)))))
+ (assert-flo-error (lambda () (yes-traps (lambda () (sqrt x-0i)))))
+ (assert-flo-error (lambda () (yes-traps (lambda () (sqrt xi+0)))))
+ (assert-flo-error (lambda () (yes-traps (lambda () (sqrt xi-0)))))
(assert-only-except/no-traps (flo:exception:invalid-operation)
(lambda () (sqrt x+0i)))
(assert-only-except/no-traps (flo:exception:invalid-operation)
(lambda ()
(if (infinite? y)
(begin
- (assert-error
+ (assert-flo-error
(lambda ()
(yes-traps (lambda () (exact->inexact x)))))
(assert-except/no-traps (flo:exception:overflow)