Sha256: c1a5ed9135f9b31f541c106189557b051a84c573ae1f1d237478a47fe9267ce7

Contents?: true

Size: 1.91 KB

Versions: 96

Compression:

Stored size: 1.91 KB

Contents

{-# LANGUAGE RecordWildCards #-}

import Data.Foldable     (for_)
import Test.Hspec        (Spec, describe, it, shouldBe)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)

import DNA (toRNA)

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

specs :: Spec
specs = describe "toRNA" $ for_ cases test
  where
    test Case{..} = it description $ toRNA dna `shouldBe` expected

data Case = Case { description ::       String
                 , dna         ::       String
                 , expected    :: Maybe String
                 }

cases :: [Case]
cases = [ Case { description = "rna complement of cytosine is guanine"
               , dna         =      "C"
               , expected    = Just "G"
               }
        , Case { description = "rna complement of guanine is cytosine"
               , dna         =      "G"
               , expected    = Just "C"
               }
        , Case { description = "rna complement of thymine is adenine"
               , dna         =      "T"
               , expected    = Just "A"
               }
        , Case { description = "rna complement of adenine is uracil"
               , dna         =      "A"
               , expected    = Just "U"
               }
        , Case { description = "rna complement"
               , dna         =      "ACGTGGTCTTAA"
               , expected    = Just "UGCACCAGAAUU"
               }
        , Case { description = "dna correctly handles invalid input"
               , dna         = "U"
               , expected    = Nothing
               }
        , Case { description = "dna correctly handles completely invalid input"
               , dna         = "XXX"
               , expected    = Nothing
               }
        , Case { description = "dna correctly handles partially invalid input"
               , dna         = "ACGTXXXCTTAA"
               , expected    = Nothing
               }
        ]

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
trackler-2.2.1.45 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.44 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.43 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.42 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.41 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.40 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.39 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.38 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.37 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.36 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.35 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.34 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.33 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.32 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.31 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.30 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.29 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.28 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.27 tracks/haskell/exercises/rna-transcription/test/Tests.hs
trackler-2.2.1.26 tracks/haskell/exercises/rna-transcription/test/Tests.hs