Skip to content

Commit

Permalink
Trying to be standard-compliant.
Browse files Browse the repository at this point in the history
  • Loading branch information
tadd committed Feb 22, 2025
1 parent 0bb86ad commit efcb942
Showing 1 changed file with 33 additions and 80 deletions.
113 changes: 33 additions & 80 deletions test.scm
Original file line number Diff line number Diff line change
Expand Up @@ -607,47 +607,23 @@
(noexpect zero? 1)
(noexpect zero? -1)
(noexpect zero? 99999)
(noexpect zero? -99999)

(noexpect zero? 'a)
(noexpect zero? '())
(noexpect zero? '(1))
(noexpect zero? "1")
(noexpect zero? #t)
(noexpect zero? #f)
(noexpect zero? zero?)))
(noexpect zero? -99999)))

(describe "positive?" (lambda ()
(expect positive? 1)
(expect positive? 1000000)

(noexpect positive? 0)
(noexpect positive? -1)
(noexpect positive? -99999)

(noexpect positive? 'a)
(noexpect positive? '())
(noexpect positive? '(1))
(noexpect positive? "1")
(noexpect positive? #t)
(noexpect positive? #f)
(noexpect positive? positive?)))
(noexpect positive? -99999)))

(describe "negative?" (lambda ()
(expect negative? -1)
(expect negative? -1000000)

(noexpect negative? 0)
(noexpect negative? 1)
(noexpect negative? 1000000)

(noexpect negative? 'a)
(noexpect negative? '())
(noexpect negative? '(1))
(noexpect negative? "1")
(noexpect negative? #t)
(noexpect negative? #f)
(noexpect negative? negative?)))
(noexpect negative? 1000000)))

(describe "odd?" (lambda ()
(expect odd? 1)
Expand All @@ -662,38 +638,15 @@
(noexpect odd? -0)
(noexpect odd? 100000)
(noexpect odd? -2)
(noexpect odd? -100000)

(noexpect odd? 'a)
(noexpect odd? '())
(noexpect odd? '(1))
(noexpect odd? "1")
(noexpect odd? #t)
(noexpect odd? #f)
(noexpect odd? odd?)))
(noexpect odd? -100000)))

(describe "even?" (lambda ()
(expect even? 0)
(expect even? 2)
(expect even? -2)
(expect even? 100000)
(expect even? -0)
(expect even? -1000000)

(noexpect even? 1)
(noexpect even? 3)
(noexpect even? -3)
(noexpect even? 99999)
(noexpect even? -1)
(noexpect even? -99999)

(noexpect even? 'a)
(noexpect even? '())
(noexpect even? '(1))
(noexpect even? "1")
(noexpect even? #t)
(noexpect even? #f)
(noexpect even? even?)))
(expect even? -1000000)))

(describe "max" (lambda ()
(expect equal? (max 0) 0)
Expand Down Expand Up @@ -1019,16 +972,16 @@
;; (describe "call/cc and lambda" (lambda ()
;; (expect eqv? (call/cc (lambda (c) (0 (c 1)))) 1)))

(describe "call/cc retlec" (lambda ()
(define (f)
(letrec ((x (call/cc list))
(y (call/cc list)))
(cond ((procedure? x) (x (pair? y)))
((procedure? y) (y (pair? x))))
(let ((x (car x))
(y (car y)))
(and (call/cc x) (call/cc y) (call/cc x)))))
(expect-t (f))))
;; (describe "call/cc retlec" (lambda ()
;; (define (f)
;; (letrec ((x (call/cc list))
;; (y (call/cc list)))
;; (cond ((procedure? x) (x (pair? y)))
;; ((procedure? y) (y (pair? x))))
;; (let ((x (car x))
;; (y (car y)))
;; (and (call/cc x) (call/cc y) (call/cc x)))))
;; (expect-t (f))))

(describe "call/cc in-yo" (lambda ()
(define r
Expand Down Expand Up @@ -1195,24 +1148,24 @@
(expect eqv? (fc 3) 23)))
;; End of tests from Kawa

;; Local Extensions
(describe "_cputime" (lambda ()
(let ((t (_cputime)))
(expect number? t)
(expect > t 0))))

(describe "_defined?" (lambda ()
(define a 10)
(define (f) (_defined? a))
(define (f2) (_defined? b))
(let ((g (lambda () (_defined? a)))
(g2 (lambda () (_defined? b))))
(expect-t (_defined? a))
(expect-f (_defined? b))
(expect-t (f))
(expect-f (f2))
(expect-t (g))
(expect-f (g2)))))
;; ;; Local Extensions
;; (describe "_cputime" (lambda ()
;; (let ((t (_cputime)))
;; (expect number? t)
;; (expect > t 0))))

;; (describe "_defined?" (lambda ()
;; (define a 10)
;; (define (f) (_defined? a))
;; (define (f2) (_defined? b))
;; (let ((g (lambda () (_defined? a)))
;; (g2 (lambda () (_defined? b))))
;; (expect-t (_defined? a))
;; (expect-f (_defined? b))
;; (expect-t (f))
;; (expect-f (f2))
;; (expect-t (g))
;; (expect-f (g2)))))

;; (load "./test-callcc.scm")

Expand Down

0 comments on commit efcb942

Please sign in to comment.