blob: 2e99fe3b643047877ed0768620f862dbb8f78328 (
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
60
61
62
|
;; -*- compile-command: "guile -L . cp-test.scm"; -*-
(use-modules (srfi srfi-64)
(cp))
(test-begin "harness")
(test-equal "rotate list empty"
'()
(list-rotate '()))
(test-equal "rotate list singleton"
'(1)
(list-rotate '(1)))
(test-equal "rotate list switch"
'(2 1)
(list-rotate '(1 2)))
(test-equal "rotate list three"
'(2 3 1)
(list-rotate '(1 2 3)))
(test-equal "rotate list four"
'(2 3 4 1)
(list-rotate '(1 2 3 4)))
(test-equal "number->circular-list 1"
'(1)
(number->circular-list 1))
(test-equal "number->circular-list 12"
'(21 12)
(number->circular-list 12))
(test-equal "number->circular-list 123"
'(312 231 123)
(number->circular-list 123))
(test-equal "number->circular-list 1234"
'(4123 3412 2341 1234)
(number->circular-list 1234))
(test-equal "circular-primes to zero"
'()
(generate-circular-primes-to 0))
(test-equal "circular-primes to 2"
'(2)
(generate-circular-primes-to 2))
(test-equal "circular-primes to 3"
'(2 3)
(generate-circular-primes-to 3))
(test-equal "circular-primes to 100"
'(2 3 5 7 11 13 17 31 37 71 73 79 97)
(generate-circular-primes-to 100))
(test-end "harness")
|