aboutsummaryrefslogtreecommitdiffstats
path: root/tests/run.scm
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-10-26 13:26:34 -0400
committerGravatar Peter McGoron 2025-10-26 13:26:34 -0400
commita2b1d33a61bc134b46ecf2e8b4e3e34023cf4d6d (patch)
tree038144c881ca0b6c97f553004cf37ae3b318e5ed /tests/run.scm
parent0.1.0 (diff)
tests, chibi support
Diffstat (limited to '')
-rw-r--r--tests/run.scm45
1 files changed, 7 insertions, 38 deletions
diff --git a/tests/run.scm b/tests/run.scm
index f9c5c26..5c02052 100644
--- a/tests/run.scm
+++ b/tests/run.scm
@@ -1,44 +1,13 @@
-(import r7rs
- (prefix (hascheme base) ha:)
- (hascheme eager)
- (srfi 64))
+(cond-expand
+ (chicken-5 (import r7rs (srfi 64))
+ (load "../lib/tests/hascheme/base.sld"))
+ (chibi (import (chibi test)))
+ (else (import (srfi 64))))
(cond-expand
(chicken-5 (test-runner-current (test-runner-create)))
(else))
-(ha:define
- (hascheme-natural-numbers)
- (ha:let loop ((i 0)) (ha:seq i (ha:cons i (loop (ha:+ i 1))))))
-
-(ha:define (square-of-list list) (ha:map ha:square list))
-
-(test-group "lists"
- (test-assert
- "cons is lazy, car"
- (force (ha:car (ha:cons #t (ha:error "boom")))))
- (test-assert
- "cons is lazy, cdr"
- (guard (x ((equal? (force (error-object-message x)) "boom") #t)
- (else #f))
- (force (ha:cdr (ha:cons #f (ha:error "boom"))))
- #f))
- (test-equal
- 1000
- (force (ha:list-ref (hascheme-natural-numbers) 1000)))
- (let ((flag '()))
- (test-equal
- "map is lazy"
- '(1000)
- (begin
- (force (ha:list-ref (ha:map (ha:lambda (x) (set! flag
- (cons (force x) flag)))
- (hascheme-natural-numbers))
- 1000))
- flag)))
- (test-equal "runs in bounded space"
- (square 1000)
- (force (ha:list-ref (square-of-list (hascheme-natural-numbers))
- 1000))))
-
+(import (tests hascheme base))
+(test-group "base" (test-base))