blob: 4b028a9cc5a3133c9747a4ccf6bc2a900f44f15a (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
(.module:
[library
[lux {"-" Variant Record}
["_" test {"+" Test}]
["@" target]
["[0]" debug]
[abstract
codec
[monad {"+" do}]
["[0]" equivalence {"+" Equivalence}
["poly/[1]" \\poly]]
[\\specification
["$[0]" equivalence]
["$[0]" codec]]]
[control
pipe
["[0]" try]
["p" parser
... TODO: Get rid of this import ASAP
[json {"+"}]]]
[data
["[0]" bit]
["[0]" text]
[format
[json {"+" JSON}
[\\poly
["[0]" /]]]]
[collection
[row {"+" row}]
["d" dictionary]
["[0]" list]]]
[type
["[0]" unit]]
[math
["[0]" random {"+" Random}]
[number
["n" nat]
["[0]" frac]]]
[time
["ti" instant]
["tda" date]
... ["tdu" duration]
]]]
[test
[lux
[time
["_[0]" instant]
... ["_[0]" duration]
]]])
(type: Variant
(.Variant
{#Bit Bit}
{#Text Text}
{#Frac Frac}))
(type: Recursive
(Rec Recursive
(.Variant
{#Number Frac}
{#Addition Frac Recursive})))
(type: Record
(.Record
[#bit Bit
#frac Frac
#text Text
#maybe (Maybe Frac)
#list (List Frac)
#dictionary (d.Dictionary Text Frac)
#variant Variant
#tuple [Bit Text Frac]
#recursive Recursive
... #instant ti.Instant
... #duration tdu.Duration
#date tda.Date
#grams (unit.Qty unit.Gram)]))
(def: gen_recursive
(Random Recursive)
(random.rec
(function (_ gen_recursive)
(random.or random.safe_frac
(random.and random.safe_frac
gen_recursive)))))
(def: qty
(All (_ unit) (Random (unit.Qty unit)))
(# random.monad each (debug.private unit.in') random.int))
(def: gen_record
(Random Record)
(do [! random.monad]
[size (# ! each (n.% 2) random.nat)]
($_ random.and
random.bit
random.safe_frac
(random.unicode size)
(random.maybe random.safe_frac)
(random.list size random.safe_frac)
(random.dictionary text.hash size (random.unicode size) random.safe_frac)
($_ random.or random.bit (random.unicode size) random.safe_frac)
($_ random.and random.bit (random.unicode size) random.safe_frac)
..gen_recursive
... _instant.instant
... _duration.duration
random.date
..qty
)))
(for [@.old (as_is)]
(as_is (def: equivalence
(Equivalence Record)
(poly/equivalence.equivalence Record))
(def: codec
(Codec JSON Record)
(/.codec Record))))
(def: .public test
Test
(<| (_.covering /._)
(_.for [/.codec]
(for [@.old (_.test "PLACEHOLDER" true)]
($codec.spec ..equivalence ..codec ..gen_record)))))
|