blob: ae10b671eb4613a20b69c7bbe5eb2a3d99b3d5bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
;; -*- compile-command: "guile -L . closure-test.scm"; -*-
(use-modules (srfi srfi-64)
(closure))
(define iterative-add-generator-1
(iterative-add))
(define iterative-add-generator-2
(iterative-add))
(test-begin "harness")
(test-equal "add 0 to 1"
1
(iterative-add-generator-1 1))
(test-equal "add 1 to 2"
3
(iterative-add-generator-1 2))
(test-equal "add 2 to 6"
8
(iterative-add-generator-1 6))
(test-equal "add 6 to 5"
11
(iterative-add-generator-1 5))
(test-equal "add 0 to 2"
2
(iterative-add-generator-2 2))
(test-equal "add 2 to 2"
4
(iterative-add-generator-2 2))
(set-store (string->list "abcdefghijklmnopqrstuvwxyz"))
;;; never returns, but manual validation shows
;;; the function works. Bug in testing library?
;; (test-equal "peek-char first"
;; #\a
;; (peek-char))
(test-equal "advance-char first"
#\a
(advance-char))
(test-equal "advance-char second"
#\b
(advance-char))
;; (test-equal "peek-char second"
;; #\c
;; (peek-char))
(test-end "harness")
|