blob: ad4bb4711b377bbae656bf6ae056f957d78a2959 (
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
|
(.using
[library
[lux (.except)
["_" test (.only Test)]
[abstract
[monad (.only do)]]
[control
["[0]" try]
["[0]" exception]]
[data
["[0]" text (.open: "[1]#[0]" equivalence)]
[collection
["[0]" dictionary]]]
[math
["[0]" random]
[number
["n" nat]]]]]
[\\library
["[0]" / (.only)
["/[1]" // (.open: "[1]#[0]" monad)]]])
(def .public test
Test
(<| (_.covering /._)
(_.for [/.Environment /.Parser])
(all _.and
(_.coverage [/.empty]
(dictionary.empty? /.empty))
(do random.monad
[expected random.nat]
(_.coverage [/.result]
(|> (/.result (//#in expected) /.empty)
(at try.functor each (n.= expected))
(try.else false))))
(do random.monad
[property (random.alphabetic 1)
expected (random.alphabetic 1)]
(_.coverage [/.Property /.property]
(|> /.empty
(dictionary.has property expected)
(/.result (/.property property))
(at try.functor each (text#= expected))
(try.else false))))
(do random.monad
[property (random.alphabetic 1)]
(_.coverage [/.unknown_property]
(case (/.result (/.property property) /.empty)
{try.#Success _}
false
{try.#Failure error}
(exception.match? /.unknown_property error))))
)))
|