Add remaining haskell book exercises
This commit is contained in:
14
Haskell-book/24/ParserExercises/test/LogTest/Main.hs
Normal file
14
Haskell-book/24/ParserExercises/test/LogTest/Main.hs
Normal file
@@ -0,0 +1,14 @@
|
||||
module Main where
|
||||
|
||||
import LogParser
|
||||
import Test.QuickCheck
|
||||
import Text.Trifecta
|
||||
|
||||
maybeSuccess :: Text.Trifecta.Result a -> Maybe a
|
||||
maybeSuccess (Text.Trifecta.Success a) = Just a
|
||||
maybeSuccess _ = Nothing
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
quickCheck ((\s -> (maybeSuccess $ parseString parseStatement mempty (show s)) == (Just s)) :: Statement -> Bool)
|
||||
quickCheck ((\s -> (maybeSuccess $ parseString parseLogEntry mempty (show s)) == (Just s)) :: LogEntry -> Bool)
|
||||
Reference in New Issue
Block a user