blob: 214a3c041a1a0a9e1411fab5c30714a3090a1530 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
(.module:
[lux #*
data/text/format
[control/monad (#+ do)]
["r" math/random]
["_" test (#+ Test)]]
{1
["." /]})
(def: #export test
Test
(<| (_.context (%name (name-of /._)))
(do r.monad
[left r.rev
right r.rev]
($_ _.and
(_.test "AND is the minimum."
(let [result (/.and left right)]
(and (r/<= left result)
(r/<= right result))))
(_.test "OR is the maximum."
(let [result (/.or left right)]
(and (r/>= left result)
(r/>= right result))))
(_.test "Double negation results in the original value."
(r/= left (/.not (/.not left))))
(_.test "Every value is equivalent to itself."
(and (r/>= left
(/.= left left))
(r/>= right
(/.= right right))))
))))
|