blob: daa59d75928aa322ec716fecc9d4347f05886389 (
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
|
(use-modules (srfi srfi-64)
(bubble-sort))
(test-begin "harness")
(test-equal "empty"
'()
(bubble-sort '()))
(test-equal "in-order"
'(0 1)
(bubble-sort '(0 1)))
(test-equal "in-order-large"
'(0 1 2 5 6 9 19 101)
(bubble-sort '(0 1 2 5 6 9 19 101)))
(test-equal "single-swap"
'(0 1)
(bubble-sort '(1 0)))
(test-equal "double-swap"
'(0 1 5 6)
(bubble-sort '(1 0 6 5)))
(test-equal "total-reversal"
'(0 1 2 3 4 5 6 7 8 9)
(bubble-sort '(9 8 7 6 5 4 3 2 1 0)))
(test-equal "random-scramble"
'(-9 -2 0 11 45)
(bubble-sort '(-2 45 0 11 -9)))
(test-end "harness")
|