Guest User

Untitled

a guest
Sep 19th, 2014
218
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Test (doTest) where
  2.  
  3. import Control.Monad
  4.  
  5. test :: (String -> String -> Bool) -> (String, [String], [String]) -> IO ()
  6. test f (rows, truthy, falsy) = do
  7.   forM_ truthy $ \w -> do
  8.     unless (f rows w) $ error $ "Fail truthy test: " ++ w
  9.   forM_ falsy $ \w -> do
  10.     when (f rows w) $ error $ "Fail falsy test: " ++ w
  11.  
  12. doTest :: (String -> String -> Bool) -> IO ()
  13. doTest f = mapM_ (test f) allCases
  14.  
  15. case1 = (
  16.     "WVERTICALL\n\
  17.    \ROOAFFLSAB\n\
  18.    \ACRILIATOA\n\
  19.    \NDODKONWDC\n\
  20.    \DRKESOODDK\n\
  21.    \OEEPZEGLIW\n\
  22.    \MSIIHOAERA\n\
  23.    \ALRKRRIRER\n\
  24.    \KODIDEDRCD\n\
  25.    \HELWSLEUTH"
  26.   , ["RANDOM", "VERTICAL", "HORIZONTAL", "WORDSEARCH", "WIKIPEDIA", "TAIL"]
  27.   , ["WordSearch", "CODEGOLF", "UNICORN"]
  28.   )
  29.  
  30. case2 = (
  31.     "Lorem ipsum dolor sit amet consectetu\n\
  32.    \r adipisicing elit sed do eiusmod tem\n\
  33.    \por incididunt ut labore et dolore ma\n\
  34.    \gna aliqua. Ut enim ad minim veniam, \n\
  35.    \quis nostrud exercitation ullamco lab\n\
  36.    \oris nisi ut aliquip ex ea commodo co\n\
  37.    \nsequat. Duis aute irure dolor in rep\n\
  38.    \rehenderit in voluptate velit esse ci\n\
  39.    \llum dolore eu fugiat nulla pariatur."
  40.   , ["Lorem", "mine", "uma bop", "tuetdod", "snol,a", "texas", "pii.d  v", "vexta"]
  41.   , ["lorem", "wordsearch", "pii.d v", "mute"]
  42.   )
  43.  
  44. case3 = (
  45.     "abcd\nefgh\nijkl\nmnop"
  46.   , ["abcd", "efgh", "aeim", "miea", "afkp", "dgjm"]
  47.   , ["ABCF"]
  48.   )
  49.  
  50. allCases = [case1, case2, case3]
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×