blob: f3c6c8fc3082959645a9ac2d81a6c25083d62632 (
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
|
(.module:
[lux #*
[control
[monad (#+ do)]
pipe]
[data
["." error]
[bit ("bit/." Equivalence<Bit>)]
["." number]
[text ("text/." Equivalence<Text>)
format]]
[math
["r" random]]
[compiler
[default
[phase
["." synthesis]]]]
test]
[test
[luxc
common]])
(def: (f/=' reference subject)
(-> Frac Frac Bit)
(or (f/= reference subject)
(and (number.not-a-number? reference)
(number.not-a-number? subject))))
(def: (spec run)
(-> Runner Test)
(do r.Monad<Random>
[|bit| r.bit
|i64| r.i64
|f64| r.frac
|text| (r.ascii 5)]
(`` ($_ seq
(~~ (template [<desc> <type> <synthesis> <sample> <test>]
[(test (format "Can translate " <desc> ".")
(|> (run (<synthesis> <sample>))
(case> (#error.Success valueT)
(<test> <sample> (:coerce <type> valueT))
(#error.Error error)
false)))]
["bit" Bit synthesis.bit |bit| bit/=]
["int" Int synthesis.i64 |i64| i/=]
["frac" Frac synthesis.f64 |f64| f/=']
["text" Text synthesis.text |text| text/=]
))
))))
(context: "[JVM] Primitives."
(<| (times 100)
(spec run-jvm)))
## (context: "[JS] Primitives."
## (<| (times 100)
## (spec run-js)))
## (context: "[Lua] Primitives."
## (<| (times 100)
## (spec run-lua)))
## (context: "[Ruby] Primitives."
## (<| (times 100)
## (spec run-ruby)))
## (context: "[Python] Primitives."
## (<| (times 100)
## (spec run-python)))
## (context: "[R] Primitives."
## (<| (times 100)
## (spec run-r)))
## (context: "[Scheme] Primitives."
## (<| (times 100)
## (spec run-scheme)))
## (context: "[Common Lisp] Primitives."
## (<| (times 100)
## (spec run-common-lisp)))
## (context: "[PHP] Primitives."
## (<| (times 100)
## (spec run-php)))
|