Sha256: e6da2da3f53e556d1e40d0c3ce8bd4ed12d5bba22c51383f2572c6154da8b555

Contents?: true

Size: 1.51 KB

Versions: 133

Compression:

Stored size: 1.51 KB

Contents

(ql:quickload "lisp-unit")
#-xlisp-test (load "perfect-numbers")

(defpackage #:perfect-numbers-test
  (:use #:common-lisp #:lisp-unit))

(in-package #:perfect-numbers-test)


;; Perfect numbers tests:
(define-test smallest-perfect-number
  (assert-equal "perfect" (perfect-numbers:classify 6)))

(define-test medium-perfect-number
  (assert-equal "perfect" (perfect-numbers:classify 28)))

(define-test large-perfect-number
  (assert-equal "perfect" (perfect-numbers:classify 33550336)))


;; Abundant numbers tests:
(define-test smallest-abundant-number
  (assert-equal "abundant" (perfect-numbers:classify 12)))

(define-test medium-abundant-number
  (assert-equal "abundant" (perfect-numbers:classify 30)))

(define-test large-abundant-number
  (assert-equal "abundant" (perfect-numbers:classify 33550335)))


;; Deficient numbers tests:
(define-test smallest-prime-deficient-number
  (assert-equal "deficient" (perfect-numbers:classify 2)))

(define-test smallest-non-prime-deficient-number
  (assert-equal "deficient" (perfect-numbers:classify 1)))

(define-test medium-deficient-number
  (assert-equal "deficient" (perfect-numbers:classify 32)))

(define-test large-deficient-number
  (assert-equal "deficient" (perfect-numbers:classify 33550337)))


;; Undefined values of classify tests:
(define-test undefinded-0
  (assert-equal NIL (perfect-numbers:classify 0)))

(define-test undefined-negative
  (assert-equal NIL (perfect-numbers:classify -3)))

#-xlisp-test
(let ((*print-errors* t)
      (*print-failures* t))
  (run-tests :all))

Version data entries

133 entries across 133 versions & 1 rubygems

Version Path
trackler-2.2.1.58 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.57 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.56 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.55 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.54 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.53 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.52 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.51 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.50 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.49 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.48 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.47 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp
trackler-2.2.1.46 tracks/common-lisp/exercises/perfect-numbers/perfect-numbers-test.lisp