-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Exercise 1
Nice solution with uncurry.
Exercise 2
parserTest :: Int -> Int -> IO ()
parserTest testsExecuted totalTests = if testsExecuted == totalTests then putStrLn ("\x1b[32m" ++ show totalTests ++ " tests passed\x1b[0m")
else generateActualForm >>= \x -> let resultingForm = parse (show x) in if length resultingForm == 1 && equiv x (head resultingForm) then
do putStrLn ("pass on: " ++ show x)
parserTest (testsExecuted+1) totalTests
else error ("failed test on: " ++ show x)
equiv is not sufficient. Required is: That the forms have the same shape. So
parserTest :: Int -> Int -> IO ()
parserTest testsExecuted totalTests = if testsExecuted == totalTests then putStrLn ("\x1b[32m" ++ show totalTests ++ " tests passed\x1b[0m")
else generateActualForm >>= \x -> let resultingForm = parse (show x) in if length resultingForm == 1 && x == (head resultingForm) then
do putStrLn ("pass on: " ++ show x)
parserTest (testsExecuted+1) totalTests
else error ("failed test on: " ++ show x)
Metadata
Metadata
Assignees
Labels
No labels