-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync hamming tests and update stub (#368)
- Loading branch information
Showing
2 changed files
with
27 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,50 @@ | ||
;;; hamming-test.el --- Tests for hamming (exercism) -*- lexical-binding: t; -*- | ||
;;; hamming-test.el --- Hamming (exercism) -*- lexical-binding: t; -*- | ||
|
||
;;; Commentary: | ||
;; Common test data version: 2.0.1 f79dfd7 | ||
|
||
;;; Code: | ||
|
||
|
||
(load-file "hamming.el") | ||
(declare-function hamming-distance "hamming.el" (dna1 dna2)) | ||
|
||
|
||
(ert-deftest empty-strands () | ||
(should (= 0 (hamming-distance "" "")))) | ||
|
||
(ert-deftest identical-strands () | ||
|
||
(ert-deftest single-letter-identical-strands () | ||
(should (= 0 (hamming-distance "A" "A")))) | ||
|
||
|
||
(ert-deftest single-letter-different-strands () | ||
(should (= 1 (hamming-distance "G" "T")))) | ||
|
||
|
||
(ert-deftest long-identical-strands () | ||
(should (= 0 (hamming-distance "GGACTGA" "GGACTGA")))) | ||
(should (= 0 (hamming-distance "GGACTGAAATCTG" "GGACTGAAATCTG")))) | ||
|
||
(ert-deftest complete-distance-in-single-nucleotide-strands () | ||
(should (= 1 (hamming-distance "A" "G")))) | ||
(ert-deftest long-different-strands () | ||
(should (= 9 (hamming-distance "GGACGGATTCTG" "AGGACGGATTCT")))) | ||
|
||
(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 disallow-first-strand-longer () | ||
(should-error (hamming-distance "AATG" "AAA"))) | ||
|
||
(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 disallow-second-strand-longer () | ||
(should-error (hamming-distance "ATA" "AGTG"))) | ||
|
||
(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 disallow-empty-first-strand () | ||
(should-error (hamming-distance "" "G"))) | ||
|
||
(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-empty-second-strand () | ||
(should-error (hamming-distance "G" ""))) | ||
|
||
(ert-deftest disallow-second-strand-longer () | ||
(should-error (hamming-distance "ATA" "AGTG"))) | ||
|
||
(provide 'hamming-test) | ||
;;; hamming-test.el ends here | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters