aboutsummaryrefslogtreecommitdiff
path: root/tests/Properties.hs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-10-15 17:07:00 +0100
committerAkshay <[email protected]>2020-10-15 17:07:00 +0100
commit684e09298b8453ee56571d8a225e11d7c57e3746 (patch)
treec2365f2b72f351ac166af60e9fcca0fbb334eb2e /tests/Properties.hs
parentda70b8021ff08d2f994597a9f01289cf4cc04adb (diff)
add basic list primitives
Diffstat (limited to 'tests/Properties.hs')
-rw-r--r--tests/Properties.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/Properties.hs b/tests/Properties.hs
index b9550c0..03a7e9a 100644
--- a/tests/Properties.hs
+++ b/tests/Properties.hs
@@ -10,8 +10,6 @@ import Operators (primitives)
10import Parser (Expr (..), parseLispValue, parseQuote) 10import Parser (Expr (..), parseLispValue, parseQuote)
11import Test.QuickCheck 11import Test.QuickCheck
12 12
13addition = fromJust $ lookup "+" primitives
14multiplication = fromJust $ lookup "*" primitives
15 13
16prop_commutativeAdd :: [Integer] -> Property 14prop_commutativeAdd :: [Integer] -> Property
17prop_commutativeAdd xs = 15prop_commutativeAdd xs =
@@ -19,6 +17,7 @@ prop_commutativeAdd xs =
19 where rhs = (unwrap . addition) exprs 17 where rhs = (unwrap . addition) exprs
20 lhs = (unwrap . addition . reverse) exprs 18 lhs = (unwrap . addition . reverse) exprs
21 exprs = map IntLiteral xs 19 exprs = map IntLiteral xs
20 addition = fromJust $ lookup "+" primitives
22 21
23prop_commutativeMul :: [Integer] -> Property 22prop_commutativeMul :: [Integer] -> Property
24prop_commutativeMul xs = 23prop_commutativeMul xs =
@@ -26,6 +25,7 @@ prop_commutativeMul xs =
26 where rhs = (unwrap . multiplication) exprs 25 where rhs = (unwrap . multiplication) exprs
27 lhs = (unwrap . multiplication . reverse) exprs 26 lhs = (unwrap . multiplication . reverse) exprs
28 exprs = map IntLiteral xs 27 exprs = map IntLiteral xs
28 multiplication = fromJust $ lookup "*" primitives
29 29
30return [] 30return []
31runTests = $quickCheckAll 31runTests = $quickCheckAll