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.0.4 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.0.3 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.0.2 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.0.1 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.2.0.0 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.55 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.54 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.53 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.52 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.51 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.50 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.49 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.48 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.47 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.46 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.45 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.44 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.43 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.42 tracks/purescript/exercises/hamming/test/Main.purs
trackler-2.1.0.41 tracks/purescript/exercises/hamming/test/Main.purs