summaryrefslogtreecommitdiff
path: root/coin-sums/cs-test.scm
blob: 30fe65c803fa20cf991c58517b9d1c66464f12ec (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
;; -*- compile-command: "guile -L . cs-test.scm"; -*-
(use-modules (srfi srfi-64)
             (cs))


(test-begin "harness")

(define den '(1))

(test-equal "make one from ones"
  '(1)
  (cs 1 den))

(test-equal "make two from ones"
  '(1 1)
  (cs 2 den))

(set! den '(1 2))

(test-equal "make one from ones, twos"
  '(1)
  (cs 1 den))

(test-equal "make two from ones, twos"
  '(1 2)
  (cs 2 den))

(set! den '(2 3 5))

(test-equal "make 3 from twos, threes, fives"
  '(0 1 1)
  (cs 3 den))

(test-equal "make 5 from twos, threes, fives"
  '(0 1 1 1 2)
  (cs 5 den))

(set! den '(1 2 5 10 20 50 100 200))

(test-equal "make 8 from pence"
  '(1 2 2 3 4 5 6 7 8 11 12 15 16)
  (cs 13 den))


(test-end "harness")