Skip to content

Commit 5cd2536

Browse files
committed
Add test for exercise 2-28
1 parent 3524d8b commit 5cd2536

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

chapter2/exercise2-28.scm

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
(if (not (pair? items))
44
items
55
(if (pair? (car items))
6-
(append (fringe (car items)) (fringe (cdr items)))
7-
(append (list (car items)) (fringe (cdr items))))))
6+
(append (fringe (car items)) (fringe (cdr items)))
7+
(append (list (car items)) (fringe (cdr items))))))
88

9-
;;;
109
(define x (list (list 1 2) (list 3 4)))
11-
(fringe x) ; => (1 2 3 4)
12-
(fringe (list x x)) ; => (1 2 3 4 1 2 3 4)
10+
(module+ test
11+
(require rackunit)
12+
13+
(test-case "Test for fringe"
14+
(check-equal? (fringe x) '(1 2 3 4))
15+
(check-equal? (fringe (list x x)) '(1 2 3 4 1 2 3 4))
16+
)
17+
)

0 commit comments

Comments
 (0)