diff options
author | Akshay <[email protected]> | 2020-10-15 17:07:00 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2020-10-15 17:07:00 +0100 |
commit | 684e09298b8453ee56571d8a225e11d7c57e3746 (patch) | |
tree | c2365f2b72f351ac166af60e9fcca0fbb334eb2e /tests | |
parent | da70b8021ff08d2f994597a9f01289cf4cc04adb (diff) |
add basic list primitives
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Properties.hs | 4 |
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) | |||
10 | import Parser (Expr (..), parseLispValue, parseQuote) | 10 | import Parser (Expr (..), parseLispValue, parseQuote) |
11 | import Test.QuickCheck | 11 | import Test.QuickCheck |
12 | 12 | ||
13 | addition = fromJust $ lookup "+" primitives | ||
14 | multiplication = fromJust $ lookup "*" primitives | ||
15 | 13 | ||
16 | prop_commutativeAdd :: [Integer] -> Property | 14 | prop_commutativeAdd :: [Integer] -> Property |
17 | prop_commutativeAdd xs = | 15 | prop_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 | ||
23 | prop_commutativeMul :: [Integer] -> Property | 22 | prop_commutativeMul :: [Integer] -> Property |
24 | prop_commutativeMul xs = | 23 | prop_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 | ||
30 | return [] | 30 | return [] |
31 | runTests = $quickCheckAll | 31 | runTests = $quickCheckAll |