Sha256: 70c9f945a554610c7a69689950f23f8f102598dc9e2671a798faa888142e8a0f

Contents?: true

Size: 1.74 KB

Versions: 72

Compression:

Stored size: 1.74 KB

Contents

-- Test/exercise version: "1.0.0"

module Test.Main where

import Prelude
import Control.Monad.Eff (Eff)
import Test.Unit (suite, test)
import Test.Unit.Main (runTest)
import Test.Unit.Assert as Assert
import Data.String as String
import Data.Maybe (Maybe(Just, Nothing))
import Hamming (distance)

main :: Eff _ Unit
main = runTest do
  suite "hamming" do
    test "identical strands" $
      Assert.equal (Just 0) (distance "A" "A")
    test "long identical strands" $
      Assert.equal (Just 0) (distance "GGACTGA" "GGACTGA")
    test "complete distance in single nucleotide strands" $
      Assert.equal (Just 1) (distance "A" "G")
    test "complete distance in small strands" $
      Assert.equal (Just 2) (distance "AG" "CT")
    test "small distance in small strands" $
      Assert.equal (Just 1) (distance "AT" "CT")
    test "small distance" $
      Assert.equal (Just 1) (distance "GGACG" "GGTCG")
    test "small distance in long strands" $
      Assert.equal (Just 2) (distance "ACCAGGG" "ACTATGG")
    test "non-unique character in first strand" $
      Assert.equal (Just 1) (distance "AGA" "AGG")
    test "non-unique character in second strand" $
      Assert.equal (Just 1) (distance "AGG" "AGA")
    test "same nucleotides in different positions" $
      Assert.equal (Just 2) (distance "TAG" "GAT")
    test "large distance" $
      Assert.equal (Just 4) (distance "GATACA" "GCATAA")
    test "large distance in off-by-one strand" $
      Assert.equal (Just 9) (distance "GGACGGATTCTG" "AGGACGGATTCT")
    test "empty strands" $
      Assert.equal (Just 0) (distance "" "")
    test "disallow first strand longer" $
      Assert.equal Nothing (distance "AATG" "AAA")
    test "disallow second strand longer" $
      Assert.equal Nothing (distance "ATA" "AGTG")

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
trackler-2.2.1.37 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.36 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.35 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.34 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.33 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.32 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.31 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.30 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.29 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.28 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.27 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.26 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.25 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.24 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.23 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.22 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.21 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.20 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.19 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.1.18 tracks/purescript/exercises/hamming/test/Main.purs