blob: 8eacc827a60d821b10d8f55e1d4686b8ea579d45 (
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
|
(.using
[library
[lux (.except)
[abstract
[monad (.only do)]]
[control
["[0]" maybe]]
[data
[collection
["[0]" list]]]
[math
["[0]" random]
[number
["n" nat]]]
["_" test (.only Test)]]]
[\\library
["[0]" / (.only Apply)]])
(def: .public test
Test
(do random.monad
[left random.nat
right random.nat]
(<| (_.covering /._)
(all _.and
(_.coverage [/.composite]
(let [expected (n.+ left right)]
(case (# (/.composite maybe.monad maybe.apply list.apply) on
{.#Some (list right)}
{.#Some (list (n.+ left))})
(pattern {.#Some (list actual)})
(n.= expected actual)
_
false)))
))))
|