Sha256: 9a5c8b6d2183c92c20296792120a33f4a923f16c1012e373b9b498b03deed60c

Contents?: true

Size: 1.72 KB

Versions: 29

Compression:

Stored size: 1.72 KB

Contents

module Tests exposing (..)

import Test exposing (..)
import Expect
import Hamming exposing (distance)


tests : Test
tests =
    describe "Hamming"
        [ test "identical strands" <|
            \() -> Expect.equal (Just 0) (distance "A" "A")
        , test "long identical strands" <|
            \() -> Expect.equal (Just 0) (distance "GGACTGA" "GGACTGA")
        , test "complete distance in single nucleotide strands" <|
            \() -> Expect.equal (Just 1) (distance "A" "G")
        , test "complete distance in small strands" <|
            \() -> Expect.equal (Just 2) (distance "AG" "CT")
        , test "small distance in small strands" <|
            \() -> Expect.equal (Just 1) (distance "AT" "CT")
        , test "small distance" <|
            \() -> Expect.equal (Just 1) (distance "GGACG" "GGTCG")
        , test "small distance in long strands" <|
            \() -> Expect.equal (Just 2) (distance "ACCAGGG" "ACTATGG")
        , test "non-unique character in first strand" <|
            \() -> Expect.equal (Just 1) (distance "AGA" "AGG")
        , test "non-unique character in second strand" <|
            \() -> Expect.equal (Just 1) (distance "AGG" "AGA")
        , test "large distance" <|
            \() -> Expect.equal (Just 4) (distance "GATACA" "GCATAA")
        , test "large distance in off-by-one strand" <|
            \() -> Expect.equal (Just 9) (distance "GGACGGATTCTG" "AGGACGGATTCT")
        , test "empty strands" <|
            \() -> Expect.equal (Just 0) (distance "" "")
        , test "disallow first strand longer" <|
            \() -> Expect.equal Nothing (distance "AATG" "AAA")
        , test "disallow second strand longer" <|
            \() -> Expect.equal Nothing (distance "ATA" "AGTG")
        ]

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
trackler-2.1.0.53 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.52 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.51 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.50 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.49 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.48 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.47 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.46 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.45 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.44 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.43 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.42 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.41 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.40 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.39 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.38 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.37 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.36 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.34 tracks/elm/exercises/hamming/tests/Tests.elm
trackler-2.1.0.33 tracks/elm/exercises/hamming/tests/Tests.elm