2017-05-27 17:56:31 +00:00
|
|
|
module Tests exposing (..)
|
2016-03-12 02:09:38 +00:00
|
|
|
|
2016-08-17 11:14:17 +00:00
|
|
|
import Test exposing (..)
|
|
|
|
import Expect
|
2016-03-12 02:09:38 +00:00
|
|
|
import Hamming exposing (distance)
|
|
|
|
|
|
|
|
|
|
|
|
tests : Test
|
|
|
|
tests =
|
2016-08-17 11:14:17 +00:00
|
|
|
describe "Hamming"
|
|
|
|
[ test "identical strands" <|
|
|
|
|
\() -> Expect.equal (Just 0) (distance "A" "A")
|
2017-07-05 20:35:15 +00:00
|
|
|
, skip <|
|
|
|
|
test "long identical strands" <|
|
|
|
|
\() -> Expect.equal (Just 0) (distance "GGACTGA" "GGACTGA")
|
|
|
|
, skip <|
|
|
|
|
test "complete distance in single nucleotide strands" <|
|
|
|
|
\() -> Expect.equal (Just 1) (distance "A" "G")
|
|
|
|
, skip <|
|
|
|
|
test "complete distance in small strands" <|
|
|
|
|
\() -> Expect.equal (Just 2) (distance "AG" "CT")
|
|
|
|
, skip <|
|
|
|
|
test "small distance in small strands" <|
|
|
|
|
\() -> Expect.equal (Just 1) (distance "AT" "CT")
|
|
|
|
, skip <|
|
|
|
|
test "small distance" <|
|
|
|
|
\() -> Expect.equal (Just 1) (distance "GGACG" "GGTCG")
|
|
|
|
, skip <|
|
|
|
|
test "small distance in long strands" <|
|
|
|
|
\() -> Expect.equal (Just 2) (distance "ACCAGGG" "ACTATGG")
|
|
|
|
, skip <|
|
|
|
|
test "non-unique character in first strand" <|
|
|
|
|
\() -> Expect.equal (Just 1) (distance "AGA" "AGG")
|
|
|
|
, skip <|
|
|
|
|
test "non-unique character in second strand" <|
|
|
|
|
\() -> Expect.equal (Just 1) (distance "AGG" "AGA")
|
|
|
|
, skip <|
|
|
|
|
test "large distance" <|
|
|
|
|
\() -> Expect.equal (Just 4) (distance "GATACA" "GCATAA")
|
|
|
|
, skip <|
|
|
|
|
test "large distance in off-by-one strand" <|
|
|
|
|
\() -> Expect.equal (Just 9) (distance "GGACGGATTCTG" "AGGACGGATTCT")
|
|
|
|
, skip <|
|
|
|
|
test "empty strands" <|
|
|
|
|
\() -> Expect.equal (Just 0) (distance "" "")
|
|
|
|
, skip <|
|
|
|
|
test "disallow first strand longer" <|
|
|
|
|
\() -> Expect.equal Nothing (distance "AATG" "AAA")
|
|
|
|
, skip <|
|
|
|
|
test "disallow second strand longer" <|
|
|
|
|
\() -> Expect.equal Nothing (distance "ATA" "AGTG")
|
2016-06-19 21:46:13 +00:00
|
|
|
]
|