blob: 782b20204d2f251381c993f377c3d2a2968a3675 (
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
|
(.module:
[library
[lux #*
["_" test (#+ Test)]
[abstract
[monad (#+ do)]
[\\specification
["$." equivalence]]]
[control
["." maybe ("#\." functor)]]
[data
["." text ("#\." equivalence)]
[collection
["." list ("#\." functor)]
["." set]]]
[math
["." random (#+ Random) ("#\." monad)]
[number
["n" nat]]]]]
[\\program
["." /]])
(def: .public random
(Random /.Runtime)
($_ random.either
(random\in /.default_java)
(random\in /.default_js)
(random\in /.default_python)
(random\in /.default_lua)
(random\in /.default_ruby)
))
(def: .public test
Test
(<| (_.covering /._)
(_.for [/.Runtime])
(do random.monad
[path (random.ascii/alpha 5)
runtime ..random]
(`` ($_ _.and
(_.for [/.equivalence]
($equivalence.spec /.equivalence ..random))
(~~ (template [<command>]
[(_.cover [/.default_java /.default_js /.default_python /.default_lua /.default_ruby]
(let [listing (|> (list /.default_java /.default_js /.default_python /.default_lua /.default_ruby)
(list\map (value@ #/.program)))
unique (set.of_list text.hash listing)]
(n.= (list.size listing)
(set.size unique))))]
[/.default_java]
[/.default_js]
[/.default_python]
[/.default_lua]
[/.default_ruby]
))
(_.cover [/.for]
(let [runtime' (/.for runtime path)]
(and (text\= (value@ #/.program runtime)
(value@ #/.program runtime'))
(|> runtime'
(value@ #/.parameters)
list.last
(maybe\map (text\= path))
(maybe.else false)))))
)))))
|