;; -*- 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")