blob: 0a21ad67b2b77ecc9398d83d7def0619eeca3c35 (
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
|
(.require
[lux (.except)
["_" test (.only Test)]
[abstract
[monad (.only do)]]
[control
["[0]" pipe]
["[0]" try]]
[data
["[0]" bit (.use "[1]#[0]" equivalence)]
[number
["f" frac]]
["[0]" text (.use "[1]#[0]" equivalence)
["%" \\format (.only format)]]]
[math
["r" random]]
[tool
[compiler
["[0]" synthesis]]]]
[///
[common (.only Runner)]])
(def (f/=' reference subject)
(-> Frac Frac Bit)
(or (f.= reference subject)
(and (f.not_a_number? reference)
(f.not_a_number? subject))))
(def .public (spec run)
(-> Runner Test)
(`` (all _.and
(~~ (with_template [<evaluation_name> <synthesis> <gen> <test>]
[(do r.monad
[expected <gen>]
(_.property (%.symbol (symbol <synthesis>))
(|> (run <evaluation_name> (<synthesis> expected))
(pipe.case
{try.#Success actual}
(<test> expected (as_expected actual))
{try.#Failure _}
false))))]
["bit" synthesis.bit r.bit bit#=]
["i64" synthesis.i64 r.i64 "lux i64 ="]
["f64" synthesis.f64 r.frac f.=']
["text" synthesis.text (r.ascii 5) text#=]
))
)))
|