Created
March 14, 2014 05:25
-
-
Save oropon/9542555 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Test.Hspec (Spec, hspec, describe, it, shouldBe) | |
import Control.Monad (forM_) | |
samplef :: String -> String | |
samplef = concat . replicate 2 | |
main :: IO () | |
main = test | |
test :: IO () | |
test = hspec spec | |
spec :: Spec | |
spec = do | |
describe "samplef" $ do | |
forM_ testSet $ \(n,input,expect) -> | |
it (show n ++ ": " ++ input ++ " -> " ++ expect) $ | |
samplef input `shouldBe` expect | |
testSet :: [(Int, String, String)] | |
testSet = let f n (inp,exp) = (n,inp,exp) in zipWith f [1..] [ | |
("hoge", "hogehoge") | |
,("fuga", "fugafuga")] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment