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.180 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.179 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.178 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.177 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.176 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.175 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.174 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.173 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.172 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.171 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.170 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.169 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.167 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.166 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.165 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.164 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.163 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.162 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.161 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el
trackler-2.2.1.160 tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el