From da4909907f4169e7582f35b3c3c898ad4b342cda Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Thu, 1 Nov 2012 21:40:21 +0900 Subject: [PATCH] Fixing test handling of inexact complex numbers. --- lib/chibi/test.scm | 10 +++++++--- lib/chibi/test.sld | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/chibi/test.scm b/lib/chibi/test.scm index 6322fde2..50ee849f 100644 --- a/lib/chibi/test.scm +++ b/lib/chibi/test.scm @@ -632,9 +632,13 @@ (define (test-equal? expect res) (or (equal? expect res) - (and (number? expect) - (inexact? expect) - (approx-equal? expect res (current-test-epsilon))))) + (if (real? expect) + (and (inexact? expect) + (real? res) + (approx-equal? expect res (current-test-epsilon))) + (and (complex? res) + (test-equal? (real-part expect) (real-part res)) + (test-equal? (imag-part expect) (imag-part res)))))) ;;> Begin testing a new group until the closing @scheme{(test-end)}. diff --git a/lib/chibi/test.sld b/lib/chibi/test.sld index 2073911e..e72bffc4 100644 --- a/lib/chibi/test.sld +++ b/lib/chibi/test.sld @@ -11,6 +11,7 @@ current-test-epsilon current-test-comparator) (import (scheme base) (scheme write) + (scheme complex) (scheme process-context) (scheme time) (only (srfi 1) every))