blob: bba85385acea877304611f8a72d167d78c4eabc8 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
(.require
[library
[lux (.except)
[abstract
[monad (.only do)]
[\\specification
["$[0]" functor (.only Injection Comparison)]
["$[0]" monad]]]
[math
["[0]" random]
[number
["n" nat]]]
[test
["_" property (.only Test)]]]]
[\\library
["[0]" /]])
(def injection
(Injection /.Trampoline)
(|>> /.return))
(def comparison
(Comparison /.Trampoline)
(function (_ == left right)
(== (/.result left) (/.result right))))
(def .public test
Test
(<| (_.covering /._)
(_.for [/.Trampoline])
(do [! random.monad]
[expected random.nat
left random.nat
right random.nat])
(all _.and
(_.for [/.functor]
($functor.spec ..injection ..comparison /.functor))
(_.for [/.monad]
($monad.spec ..injection ..comparison /.monad))
(_.for [/.result]
(all _.and
(_.coverage [/.#Return /.return]
(|> (/.return expected)
/.result
(same? expected)))
(_.coverage [/.#Jump /.jump]
(with_expansions [<expected> (n.+ left right)]
(|> (/.jump (/.return <expected>))
/.result
(n.= <expected>))))
))
)))
|