blob: e8484697d080a602fc487999d4a3bb1d4c9c2a01 (
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
|
(;module:
lux
(lux [io]
(control [monad #+ do]
pipe)
(data text/format)
["r" math/random]
test)
(luxc (lang ["la" analysis]
["ls" synthesis])
[analyser]
[synthesizer]))
(context: "Primitives"
(<| (times +100)
(do @
[%bool% r;bool
%nat% r;nat
%int% r;int
%deg% r;deg
%frac% r;frac
%text% (r;text +5)]
(`` ($_ seq
(test (format "Can synthesize unit.")
(|> (synthesizer;synthesize (#la;Unit []))
(case> [_ (#;Tuple #;Nil)]
true
_
false)))
(~~ (do-template [<desc> <analysis> <synthesis> <sample>]
[(test (format "Can synthesize " <desc> ".")
(|> (synthesizer;synthesize (<analysis> <sample>))
(case> [_ (<synthesis> value)]
(is <sample> value)
_
false)))]
["bool" #la;Bool #;Bool %bool%]
["nat" #la;Nat #;Nat %nat%]
["int" #la;Int #;Int %int%]
["deg" #la;Deg #;Deg %deg%]
["frac" #la;Frac #;Frac %frac%]
["text" #la;Text #;Text %text%])))))))
|