blob: 2ae784312f1f9e4b8d5515d3d78c524133279818 (
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
33
34
35
36
37
|
(.module:
[lux #*
["_" test (#+ Test)]
["." function]
[control
[monad (#+ do)]
{[0 #test]
[/
["$." equivalence]
["$." monoid]
["$." codec]]}]
data/text/format
[math
["r" random]]]
{1
["." /]})
(def: #export test
Test
(<| (_.context (%name (name-of .Bit)))
(do r.monad
[value r.bit]
($_ _.and
($equivalence.spec /.equivalence r.bit)
($codec.spec /.equivalence /.codec r.bit)
(<| (_.context "Disjunction.")
($monoid.spec /.equivalence /.disjunction r.bit))
(<| (_.context "Conjunction.")
($monoid.spec /.equivalence /.conjunction r.bit))
(_.test "A value cannot be true and false at the same time."
(not (and value (not value))))
(_.test "A value must be either true or false at any time."
(or value (not value)))
(_.test "Can create the complement of a predicate."
(and (not (:: /.equivalence = value ((/.complement function.identity) value)))
(:: /.equivalence = value ((/.complement not) value))))
))))
|