|
15 | 15 | ;; Define and enter a new FiveAM test-suite
|
16 | 16 | (def-suite* nucleotide-count-suite)
|
17 | 17 |
|
18 |
| -(defun make-hash (kvs) |
19 |
| - (reduce #'(lambda (h kv) (setf (gethash (first kv) h) (second kv)) h) kvs |
20 |
| - :initial-value (make-hash-table))) |
21 |
| - |
22 |
| -(test empty-dna-strand-has-no-adenine |
23 |
| - (is (equal 0 (nucleotide-count:dna-count #\A "")))) |
24 |
| - |
25 |
| -(test empty-dna-strand-has-no-nucleotides |
26 |
| - (is |
27 |
| - (equalp (make-hash '((#\A 0) (#\T 0) (#\C 0) (#\G 0))) |
28 |
| - (nucleotide-count:nucleotide-counts "")))) |
29 |
| - |
30 |
| -(test repetitive-cytosine-gets-counted |
31 |
| - (is (equal 5 (nucleotide-count:dna-count #\C "CCCCC")))) |
32 |
| - |
33 |
| -(test repetitive-sequence-has-only-guanine |
34 |
| - (is |
35 |
| - (equalp (make-hash '((#\A 0) (#\T 0) (#\C 0) (#\G 8))) |
36 |
| - (nucleotide-count:nucleotide-counts "GGGGGGGG")))) |
37 |
| - |
38 |
| -(test counts-only-thymine |
39 |
| - (is (equal 1 (nucleotide-count:dna-count #\T "GGGGGTAACCCGG")))) |
40 |
| - |
41 |
| -(test validates-nucleotides |
42 |
| - (signals nucleotide-count:invalid-nucleotide |
43 |
| - (nucleotide-count:dna-count #\X "GACT"))) |
44 |
| - |
45 |
| -(test counts-all-nucleotides |
46 |
| - (is |
47 |
| - (equalp (make-hash '((#\A 20) (#\T 21) (#\G 17) (#\C 12))) |
48 |
| - (nucleotide-count:nucleotide-counts |
49 |
| - "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC")))) |
| 18 | +(test empty-strand |
| 19 | + (let ((strand "") |
| 20 | + (result '((#\A . 0) (#\C . 0) (#\G . 0) (#\T . 0)))) |
| 21 | + (is (equal result (nucleotide-count:nucleotide-counts strand))))) |
| 22 | + |
| 23 | +(test can-count-one-nucleotide-in-single-character-input |
| 24 | + (let ((strand "G") |
| 25 | + (result '((#\A . 0) (#\C . 0) (#\G . 1) (#\T . 0)))) |
| 26 | + (is (equal result (nucleotide-count:nucleotide-counts strand))))) |
| 27 | + |
| 28 | +(test strand-with-repeated-nucleotide |
| 29 | + (let ((strand "GGGGGGG") |
| 30 | + (result '((#\A . 0) (#\C . 0) (#\G . 7) (#\T . 0)))) |
| 31 | + (is (equal result (nucleotide-count:nucleotide-counts strand))))) |
| 32 | + |
| 33 | +(test strand-with-multiple-nucleotides |
| 34 | + (let ((strand "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC") |
| 35 | + (result '((#\A . 20) (#\C . 12) (#\G . 17) (#\T . 21)))) |
| 36 | + (is (equal result (nucleotide-count:nucleotide-counts strand))))) |
| 37 | + |
| 38 | +(test strand-with-invalid-nucleotides |
| 39 | + (let ((strand "AGXXACT")) |
| 40 | + (is (equal NIL (nucleotide-count:nucleotide-counts strand))))) |
50 | 41 |
|
51 | 42 | (defun run-tests (&optional (test-or-suite 'nucleotide-count-suite))
|
52 | 43 | "Provides human readable results of test run. Default to entire suite."
|
|
0 commit comments