Sha256: 160b7e5f26a2d7814a8d62c01a644d121c08bf4e758c2f07e5aa8f35678aa873
Contents?: true
Size: 1.84 KB
Versions: 23
Compression:
Stored size: 1.84 KB
Contents
{-# LANGUAGE RecordWildCards #-} import Data.Foldable (for_) import Test.Hspec (Spec, describe, it, shouldBe) import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith) import Acronym (abbreviate) main :: IO () main = hspecWith defaultConfig {configFastFail = True} specs specs :: Spec specs = describe "acronym" $ describe "abbreviate" $ for_ cases test where test Case {..} = it description $ abbreviate input `shouldBe` expected -- Adapted from -- Source: exercism/x-common/exercises/acronym/canonical-data.json -- Version: 1.0.0 -- Date: 2017-03-31 data Case = Case { description :: String , input :: String , expected :: String } cases :: [Case] cases = [ Case { description = "basic" , input = "Portable Network Graphics" , expected = "PNG" } , Case { description = "lowercase words" , input = "Ruby on Rails" , expected = "ROR" } , Case { description = "camelcase" , input = "HyperText Markup Language" , expected = "HTML" } , Case { description = "punctuation" , input = "First In, First Out" , expected = "FIFO" } , Case { description = "all caps words" , input = "PHP: Hypertext Preprocessor" , expected = "PHP" } , Case { description = "non-acronym all caps word" , input = "GNU Image Manipulation Program" , expected = "GIMP" } , Case { description = "hyphenated" , input = "Complementary metal-oxide semiconductor" , expected = "CMOS" } ]
Version data entries
23 entries across 23 versions & 1 rubygems