Sha256: ae2088aba96f6e404045bbd13187282a7b0e210a5dd2367fd16e1a006a6ba798

Contents?: true

Size: 1.79 KB

Versions: 119

Compression:

Stored size: 1.79 KB

Contents

{-# OPTIONS_GHC -fno-warn-type-defaults #-}

import Data.Either       (isLeft)
import Data.Map          (fromList)
import Test.Hspec        (Spec, describe, it, shouldBe, shouldSatisfy)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)

import DNA (nucleotideCounts)

main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} specs

specs :: Spec
specs = do

          let x `matchesMap` y = x `shouldBe` (Right . fromList) y

          describe "nucleotideCounts" $ do

            it "empty dna strand has no nucleotides" $
              nucleotideCounts "" `matchesMap` [ ('A', 0)
                                               , ('C', 0)
                                               , ('G', 0)
                                               , ('T', 0) ]

            it "can count one nucleotide in single-character input" $
              nucleotideCounts "G" `matchesMap` [ ('A', 0)
                                                , ('C', 0)
                                                , ('G', 1)
                                                , ('T', 0) ]

            it "repetitive-sequence-has-only-guanosine" $
              nucleotideCounts "GGGGGGGG" `matchesMap` [ ('A', 0)
                                                       , ('C', 0)
                                                       , ('G', 8)
                                                       , ('T', 0) ]

            it "counts all nucleotides" $
              nucleotideCounts "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"
              `matchesMap` [ ('A', 20)
                           , ('C', 12)
                           , ('G', 17)
                           , ('T', 21) ]

            it "validates strand" $
              nucleotideCounts "AGXXACT" `shouldSatisfy` isLeft

Version data entries

119 entries across 119 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.138 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.137 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.136 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.135 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.134 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.133 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.132 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.131 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.130 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.129 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.128 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.127 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.126 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.125 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.124 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.123 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.122 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.121 tracks/haskell/exercises/nucleotide-count/test/Tests.hs
trackler-2.2.1.120 tracks/haskell/exercises/nucleotide-count/test/Tests.hs