Sha256: 2861350cbf0ce587f8e02b937c6429eaeb9bc57d8691a18d9701edfc690fec49

Contents?: true

Size: 972 Bytes

Versions: 395

Compression:

Stored size: 972 Bytes

Contents

;;; nucleotide-count-test.el --- Tests for nucleotide-count (exercism)

;;; Commentary:

;;; Code:

(load-file "nucleotide-count.el")


(defun sort-pairs (lst fn)
  (sort lst (lambda (a b) (funcall fn (car a) (car b)))))


(ert-deftest empty-dna-strand-has-no-nucleotides-test ()
  (should (equal (sort-pairs (nucleotide-count "") #'<)
                 '((?A . 0) (?C . 0) (?G . 0) (?T . 0)))))


(ert-deftest repetitive-sequence-has-only-guanine-test ()
  (should (equal (sort-pairs (nucleotide-count "GGGGGGGG") #'<)
                 '((?A . 0) (?C . 0) (?G . 8) (?T . 0)))))


(ert-deftest count-all-nucleotides-test ()
  (should (equal (sort-pairs (nucleotide-count "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC") #'<)
                 '((?A . 20) (?C . 12) (?G . 17) (?T . 21)))))


(ert-deftest invalid-nucleotide-test ()
  (should-error (nucleotide-count "AGGTCCXGA")))


(provide 'nucleotide-count)
;;; nucleotide-count-test.el ends here

Version data entries

395 entries across 395 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.138 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.137 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.136 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.135 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.134 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.133 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.132 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.131 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.130 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.129 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.128 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.127 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.126 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.125 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.124 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.123 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.122 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.121 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.120 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el