Sha256: dc8ce34d5278a1288c2760d8b0499f5edd21581bdf446444cb89cc30bd3cc488

Contents?: true

Size: 1.77 KB

Versions: 343

Compression:

Stored size: 1.77 KB

Contents

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

(defpackage #:allergies-test
  (:use #:common-lisp #:lisp-unit))

(in-package #:allergies-test)

(define-test no-allergies-at-all
  (assert-equalp '() (allergies:list 0)))

(define-test allergic-to-just-eggs
  (assert-equalp '("eggs") (allergies:list 1)))

(define-test allergic-to-just-peanuts
  (assert-equalp '("peanuts") (allergies:list 2)))

(define-test allergic-to-just-strawberries
  (assert-equalp '("strawberries") (allergies:list 8)))

(define-test allergic-to-eggs-and-peanuts
  (assert-equalp '("eggs" "peanuts") (allergies:list 3)))

(define-test allergic-to-more-than-eggs-but-not-peanuts
  (assert-equalp '("eggs" "shellfish") (allergies:list 5)))

(define-test allergic-to-lots-of-stuff
  (assert-equalp
   '("strawberries" "tomatoes" "chocolate" "pollen" "cats")
   (allergies:list 248)))

(define-test allergic-to-everything
  (assert-equalp
   '("eggs" "peanuts" "shellfish" "strawberries" "tomatoes"
     "chocolate" "pollen" "cats")
   (allergies:list 255)))

(define-test no-allergies-means-not-allergic
  (assert-false (allergies:allergic-to-p 0 "peanuts"))
  (assert-false (allergies:allergic-to-p 0 "cats"))
  (assert-false (allergies:allergic-to-p 0 "strawberries")))

(define-test is-allergic-to-eggs
  (assert-true (allergies:allergic-to-p 1 "eggs")))

(define-test allergic-to-eggs-in-addition-to-other-stuff
  (assert-true (allergies:allergic-to-p 5 "eggs")))

(define-test case-insensitive
  (assert-true (allergies:allergic-to-p 1 "EGGS")))

(define-test ignore-non-allergen-score-parts
  (assert-equalp
   '("eggs" "shellfish" "strawberries" "tomatoes" "chocolate" "pollen"
     "cats")
   (allergies:list 509)))

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

Version data entries

343 entries across 343 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.179 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.178 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.177 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.176 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.175 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.174 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.173 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.172 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.171 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.170 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.169 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.167 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.166 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.165 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.164 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.163 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.162 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.161 tracks/common-lisp/exercises/allergies/allergies-test.lisp
trackler-2.2.1.160 tracks/common-lisp/exercises/allergies/allergies-test.lisp