diff options
| author | 2025-02-13 17:35:22 -0500 | |
|---|---|---|
| committer | 2025-02-13 17:35:22 -0500 | |
| commit | 58ef077b9eefebc7ccacb13159047f038ab847bc (patch) | |
| tree | 4581e700dc9d03f3298c4ed2b6621dc80a272c36 /tests/run.scm | |
| parent | change parameter to CHICKENs SRFI-27 parameter (diff) | |
use CHICKEN SRFI-27 generators whenever possible
Diffstat (limited to 'tests/run.scm')
| -rw-r--r-- | tests/run.scm | 65 |
1 files changed, 27 insertions, 38 deletions
diff --git a/tests/run.scm b/tests/run.scm index 063886b..e0427a1 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -5,41 +5,29 @@ ;;; NOTE: for zipf tests data can be exported, this can be enabled by uncommenting appropriate lines. -(cond-expand - (gambit - ;; Should work for any Gambit no earlier than - ;; v4.9.5-104-g562e58da 20240201212453 - (import (gambit))) - (else - (import (scheme base) - (srfi 133)))) - (import - (scheme inexact) - (scheme complex) - (scheme cxr) - (scheme file) - (scheme write) - (srfi 1) - (srfi 27) - (srfi 194)) - -(cond-expand - ((library (srfi 158)) (import (srfi 158))) - ((library (srfi 121)) (import (srfi 121)))) - -(cond-expand - (chibi (begin - (import (except (chibi test) test-equal)) - (define-syntax test-equal + (scheme base) + (srfi 133) + (scheme inexact) + (scheme complex) + (scheme cxr) + (scheme file) + (scheme write) + (srfi 1) + (srfi 27) + (srfi 194) + (srfi 158) + test) + +(define-syntax test-equal (syntax-rules () ((_ args ...) (test args ...)))) - (define-syntax test-approximate + +(define-syntax test-approximate (syntax-rules () ((_ target value max-delta) (test-assert (and (<= value (+ target max-delta)) - (>= value (- target max-delta))))))))) - (else (import (srfi 64)))) + (>= value (- target max-delta))))))) ;;; syntax just we can plop it at top and still allow internal `define`s (define-syntax reset-source! @@ -351,15 +339,15 @@ (make-random-string-generator 4 "ab")))) (test-group "Test Bernoulli" - (reset-source!) - (define g (make-bernoulli-generator 0.7)) - (define expect 7000) - (define actual (generator-count - (lambda (i) (= i 1)) - (gtake g 10000))) - (define ratio (inexact (/ actual expect))) - (test-assert (> ratio 0.9)) - (test-assert (< ratio 1.1))) + (reset-source!) + (define g (make-bernoulli-generator 0.7)) + (define expect 7000) + (define actual (generator-count + (lambda (i) (= i 1)) + (gtake g 10000))) + (define ratio (inexact (/ actual expect))) + (test-assert (> ratio 0.9)) + (test-assert (< ratio 1.1))) (test-group "Test categorical" (reset-source!) @@ -596,3 +584,4 @@ (test-end "srfi-194") +(test-exit) |
