blob: 1b6e2af5039cf3e18aeeb7fd6dac5ff377448622 (
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
54
55
56
57
58
59
|
(.using
[library
[lux (.except)
["_" test (.only Test)]
[abstract
[monad (.only do)]
[\\specification
["$[0]" equivalence]]]
[control
["[0]" try (.open: "[1]#[0]" functor)]
[parser
["<[0]>" binary]]]
[data
["[0]" text (.open: "[1]#[0]" equivalence)]
[format
["[0]" binary]]]
[math
["[0]" random (.only Random) (.open: "[1]#[0]" monad)]]]]
[\\library
["[0]" /]])
(def: random_module_state
(Random Module_State)
(all random.or
(random#in [])
(random#in [])
(random#in [])
))
(def: .public (random imports)
(-> Nat (Random /.Descriptor))
(all random.and
(random.lower_case 1)
(random.lower_case 1)
random.nat
..random_module_state
(random.set text.hash imports (random.lower_case 2))
))
(def: .public test
Test
(<| (_.covering /._)
(_.for [/.Descriptor])
(do random.monad
[expected (..random 5)])
(all _.and
(_.for [/.equivalence]
($equivalence.spec /.equivalence (..random 1)))
(_.for [/.Module]
(_.coverage [/.runtime]
(text#= "" /.runtime)))
(_.coverage [/.writer /.parser]
(|> expected
(binary.result /.writer)
(<binary>.result /.parser)
(try#each (|>> (at /.equivalence = (has /.#state {.#Cached} expected))))
(try.else false)))
)))
|