1
exercism fetch racket perfect-numbers

perfect-numbers-test.rkt

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
#lang racket/base

(require "perfect-numbers.rkt")

(module+ test
  (require rackunit rackunit/text-ui)

  (define suite
    (test-suite
     "perfect numbers tests"

     (test-equal? "no perfect numbers in 1 - 5"
                  (perfect-numbers 5)
                  '())

     (test-equal? "return one perfect number for range 1 - 6"
                  (perfect-numbers 6)
                  '(6))

     (test-equal? "return 3 perfect numbers for range 1 - 1000"
                  (perfect-numbers 1000)
                  '(6 28 496))

     (test-equal? "return 4 perfect numbers for range 1 - 10000"
                  (perfect-numbers 10000)
                  '(6 28 496 8128))))

  (run-tests suite))