blob: 18205a5609a446c40396cee4b7703b7c8d413da6 (
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
|
(.module:
[lux #*
[control
[monad (#+ do)]
pipe]
[data
["." number]]
[compiler
[default
["." reference]
[phase
["." synthesis]]]]
[math
["r" random (#+ Random)]]
test]
[test
[luxc
["." common (#+ Runner Definer)]]]
[//
["&" function]])
(def: name
(Random Name)
(let [name-part (r.ascii/upper-alpha 5)]
[(r.and name-part name-part)]))
(def: (definitions-spec define)
(-> Definer Test)
(do r.Monad<Random>
[name ..name
value &.safe-frac]
(test "Can refer to definitions."
(|> (define name (synthesis.f64 value))
(&.check value)))))
(def: (variables-spec run)
(-> Runner Test)
(do r.Monad<Random>
[register (|> r.nat (:: @ map (n/% 100)))
value &.safe-frac]
(test "Can refer to local variables/registers."
(|> (run (synthesis.branch/let [(synthesis.f64 value)
register
(synthesis.variable/local register)]))
(&.check value)))))
(def: (references-spec run define)
(-> Runner Definer Test)
(seq (definitions-spec define)
(variables-spec run)))
(context: "[JVM] References."
(<| (times 100)
(references-spec common.run-jvm common.def-jvm)))
## (context: "[JS] References."
## (<| (times 100)
## (references-spec common.run-js common.def-js)))
## (context: "[Lua] References."
## (<| (times 100)
## (references-spec common.run-lua common.def-lua)))
## (context: "[Ruby] References."
## (<| (times 100)
## (references-spec common.run-ruby common.def-ruby)))
## (context: "[Python] References."
## (<| (times 100)
## (references-spec common.run-python common.def-python)))
## (context: "[R] References."
## (<| (times 100)
## (references-spec common.run-r common.def-r)))
## (context: "[Scheme] References."
## (<| (times 100)
## (references-spec common.run-scheme common.def-scheme)))
## (context: "[Common Lisp] References."
## (<| (times 100)
## (references-spec common.run-common-lisp common.def-common-lisp)))
## (context: "[PHP] References."
## (<| (times 100)
## (references-spec common.run-php common.def-php)))
|