Sha256: ced4c3f59f99d9134f883563976569928c16dae9a4efcf9bc5352487eb2cdb36

Contents?: true

Size: 1.57 KB

Versions: 42

Compression:

Stored size: 1.57 KB

Contents

;;; hamming-test.el --- Tests for hamming (exercism)

;;; Commentary:
;; Common test data version: 2.0.1 f79dfd7

;;; Code:

(load-file "hamming.el")

(declare-function hamming-distance "hamming.el")

(ert-deftest empty-strands ()
  (should (= 0 (hamming-distance "" ""))))

(ert-deftest identical-strands ()
  (should (= 0 (hamming-distance "A" "A"))))

(ert-deftest long-identical-strands ()
  (should (= 0 (hamming-distance "GGACTGA" "GGACTGA"))))

(ert-deftest complete-distance-in-single-nucleotide-strands ()
  (should (= 1 (hamming-distance "A" "G"))))

(ert-deftest complete-distance-in-small-strands ()
  (should (= 2 (hamming-distance "AG" "CT"))))

(ert-deftest small-distance-in-small-strands ()
  (should (= 1 (hamming-distance "AT" "CT"))))

(ert-deftest small-distance ()
  (should (= 1 (hamming-distance "GGACG" "GGTCG"))))

(ert-deftest small-distance-in-long-strands ()
  (should (= 2 (hamming-distance "ACCAGGG" "ACTATGG"))))

(ert-deftest non-unique-character-in-first-strand ()
  (should (= 1 (hamming-distance "AAA" "AAG"))))

(ert-deftest same-nucleotides-in-different-positions ()
  (should (= 2 (hamming-distance "TAG" "GAT"))))

(ert-deftest large-distance ()
  (should (= 4 (hamming-distance "GATACA" "GCATAA"))))

(ert-deftest large-distance-in-off-by-one-strand ()
  (should (= 9 (hamming-distance "GGACGGATTCTG" "AGGACGGATTCT"))))

(ert-deftest disallow-first-strand-longer ()
  (should-error (hamming-distance "AATG" "AAA")))

(ert-deftest disallow-second-strand-longer ()
  (should-error (hamming-distance "ATA" "AGTG")))

(provide 'hamming-test)
;;; hamming-test.el ends here

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.158 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.157 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.156 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.155 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.154 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.153 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.152 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.151 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.150 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.149 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.148 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.147 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.146 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.145 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.144 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.143 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.142 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.141 tracks/elisp/exercises/hamming/hamming-test.el
trackler-2.2.1.140 tracks/elisp/exercises/hamming/hamming-test.el