ref: ca106d4158299de02db7168b9d1015cc9a5660d8
parent: 23c4e98fd9dea207b1c62e46e2af56f58dca3861
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Thu Aug 24 09:22:01 EDT 2023
Add test
--- /dev/null
+++ b/tests/Guard.hs
@@ -1,0 +1,15 @@
+module Guard(main) where
+import Prelude
+
+f :: [Int] -> Int
+f [x] | x < 0 = 0-x
+ | x < 10 = x+1
+ | otherwise = 99
+f [x,y] = x+y
+f xs | l < 4 = 0
+ | otherwise = l
+ where { l = length xs }+
+main :: IO ()
+main = do
+ putStrLn $ showList showInt [f [0-7], f [5], f [20], f [2,3], f [1,2,3], f[1,2,3,4]]
--- /dev/null
+++ b/tests/Guard.ref
@@ -1,0 +1,1 @@
+[7,6,99,5,0,4]
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -10,6 +10,7 @@
$(MHS) Misc && $(EVAL) > Misc.out && diff Misc.ref Misc.out
$(MHS) Case && $(EVAL) > Case.out && diff Case.ref Case.out
$(MHS) Arith && $(EVAL) > Arith.out && diff Arith.ref Arith.out
+ $(MHS) Guard && $(EVAL) > Guard.out && diff Guard.ref Guard.out
time:
@echo Expect about 10s runtime
--
⑨