change the way multiple-value results are compared in r6rs test suite
svn: r10888
This commit is contained in:
parent
5a5f52d99c
commit
643b24c3b7
|
@ -19,6 +19,9 @@
|
||||||
(define-record-type expected-exception
|
(define-record-type expected-exception
|
||||||
(fields))
|
(fields))
|
||||||
|
|
||||||
|
(define-record-type multiple-results
|
||||||
|
(fields values))
|
||||||
|
|
||||||
(define-syntax test
|
(define-syntax test
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
[(_ expr expected)
|
[(_ expr expected)
|
||||||
|
@ -55,8 +58,8 @@
|
||||||
[(_ expr val ...)
|
[(_ expr val ...)
|
||||||
(test (call-with-values
|
(test (call-with-values
|
||||||
(lambda () expr)
|
(lambda () expr)
|
||||||
list)
|
(lambda results (make-multiple-results results)))
|
||||||
(list val ...))]))
|
(make-multiple-results (list val ...)))]))
|
||||||
|
|
||||||
(define-syntax test/output
|
(define-syntax test/output
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
|
@ -106,14 +109,24 @@
|
||||||
(if (file-exists? "tmp-catch-out")
|
(if (file-exists? "tmp-catch-out")
|
||||||
(delete-file "tmp-catch-out")))))
|
(delete-file "tmp-catch-out")))))
|
||||||
|
|
||||||
|
(define (same-result? got expected)
|
||||||
|
(cond
|
||||||
|
[(and (real? expected) (nan? expected))
|
||||||
|
(and (real? got) (nan? got))]
|
||||||
|
[(expected-exception? expected)
|
||||||
|
(expected-exception? got)]
|
||||||
|
[(multiple-results? expected)
|
||||||
|
(and (multiple-results? got)
|
||||||
|
(= (length (multiple-results-values expected))
|
||||||
|
(length (multiple-results-values got)))
|
||||||
|
(for-all same-result?
|
||||||
|
(multiple-results-values expected)
|
||||||
|
(multiple-results-values got)))]
|
||||||
|
[else (equal? got expected)]))
|
||||||
|
|
||||||
(define (run-test expr got expected)
|
(define (run-test expr got expected)
|
||||||
(set! checked (+ 1 checked))
|
(set! checked (+ 1 checked))
|
||||||
(unless (if (and (real? expected)
|
(unless (same-result? got expected)
|
||||||
(nan? expected))
|
|
||||||
(and (real? got) (nan? got))
|
|
||||||
(or (equal? got expected)
|
|
||||||
(and (expected-exception? expected)
|
|
||||||
(expected-exception? got))))
|
|
||||||
(set! failures
|
(set! failures
|
||||||
(cons (list expr got expected)
|
(cons (list expr got expected)
|
||||||
failures))))
|
failures))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user