--
-- Matchers
--
assert "bool's value pattern"
(match (True, False) as (bool, bool) with
| #(True, False) -> True
| _ -> False)
assert "char's value pattern"
(match 'a' as char with
| #'a' -> True
| _ -> False)
assert "integer's value pattern"
(match 10 as integer with
| #10 -> True
| _ -> False)
assert "float's value pattern"
(match 0.1 as float with
| #0.1 -> True
| _ -> False)
--
-- Utility
--
assertEqual "id" (id 1) 1
assertEqual "fst" (fst (1, 2)) 1
assertEqual "snd" (snd (1, 2)) 2
assertEqual "compose - case 1" ((compose (fst, snd)) ((1, 2), 3)) 2
assertEqual "compose - case 2" ((compose (fst, snd, fst)) ((1, (2, 3)), 4)) 2
assertEqual "eq?/m" (eq?/m integer 1 1) True
--
-- Booleans
--
assertEqual "and"
[True && True, True && False, False && True, False && False]
[True, False, False, False]
assertEqual "or"
[True || True, True || False, False || True, False || False]
[True, True, True, False]
assertEqual "not"
[not True, not False]
[False, True]
--
-- Unordered-Pair
--
assertEqual "unorderedPair matcher"
(match (1, 2) as unorderedPair integer with
| (#2, $x) -> x)
1