Sha256: 124025e9883f34ad1ebfcfb4d4acd2338090ffd96845902c193c8b1275642e3b
Contents?: true
Size: 1.46 KB
Versions: 343
Compression:
Stored size: 1.46 KB
Contents
(ql:quickload "lisp-unit") #-xlisp-test (load "word-count") (defpackage #:word-count-test (:use #:common-lisp #:lisp-unit)) (in-package #:word-count-test) (defun assert-assoc-equal (expected actual) "The association lists must have the same length and the keys and values of the items must match. But the order is not important. Equality is tested with equal" (assert-equal (sort (copy-seq expected) #'string< :key #'car) (sort (copy-seq actual) #'string< :key #'car))) (define-test count-one-word (assert-assoc-equal '(("word" . 1)) (phrase:word-count "word"))) (define-test count-one-of-each (assert-assoc-equal '(("one" . 1) ("of" . 1) ("each" . 1)) (phrase:word-count "one of each"))) (define-test count-multiple-occurrences (assert-assoc-equal '(("one" . 1) ("fish" . 4) ("two". 1) ("red" . 1) ("blue" . 1)) (phrase:word-count "one fish two fish red fish blue fish"))) (define-test ignore-punctuation (assert-assoc-equal '(("car" . 1) ("carpet" . 1) ("as" . 1) ("java" . 1) ("javascript" . 1)) (phrase:word-count "car : carpet as java : javascript!!&@$%^&"))) (define-test include-numbers (assert-assoc-equal '(("testing" . 2) ("1" . 1) ("2" . 1)) (phrase:word-count "testing, 1, 2 testing"))) (define-test normalize-case (assert-assoc-equal '(("go" . 3) ("on" . 3)) (phrase:word-count "go ON Go On GO on"))) #-xlisp-test (let ((*print-errors* t) (*print-failures* t)) (run-tests :all :word-count-test))
Version data entries
343 entries across 343 versions & 1 rubygems