blob: a8d780b3e28e85e05e8faf484243b293564610c1 (
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
|
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
(.require
[library
[lux (.except)
[abstract
[monad (.only do)]]
[control
["[0]" io]
["[0]" try (.use "[1]#[0]" functor)]]
[data
[collection
["[0]" list (.use "[1]#[0]" monoid)]]]
[math
["[0]" random (.only Random)]
[number
["[0]" i64 (.use "[1]#[0]" equivalence)]
["n" nat]]]
[meta
["[0]" location]
[compiler
[meta
["[0]" archive]]]]
[test
["_" property (.only Test)]]]]
[\\library
["[0]" / (.only)
["[0]" // (.only)
["[0]" host]
["[0]" runtime]
["[0]" function]
[///
["[0]" extension]
[//
["[0]" phase]
["[0]" synthesis]
["[0]" translation]]]]]]
[//
["[0]T" complex]])
(def .public test
Test
(<| (_.covering /._)
(do [! random.monad]
[module (random.lower_cased 1)
expected random.i64
dummy (random.only (|>> (i64#= expected) not) random.i64)
.let [extender (is extension.Extender
(function (_ _)
(undefined)))
next (//.translate extender complexT.lux)
@ [module 0 0]
$unit [(-- 0) (-- 0)]]
before (of ! each (n.% 8) random.nat)
after (of ! each (n.% 8) random.nat)
.let [arity (++ (n.+ before after))
local (++ before)]])
(all _.and
(_.coverage [/.variable]
(|> (do try.monad
[[_ archive] (archive.reserve "" archive.empty)
[_ archive] (archive.reserve module archive)
.let [[_ host] (io.run! host.host)
state (is runtime.State
(translation.state host module))]]
(<| (phase.result state)
(do phase.monad
[_ (translation.set_buffer translation.empty_buffer)
it (next archive (<| (synthesis.function/apply @)
[(<| (synthesis.function/abstraction @)
[(list) arity (synthesis.variable/local @ local)])
(all list#composite
(list.repeated before (synthesis.i64 @ dummy))
(list (synthesis.i64 @ expected))
(list.repeated after (synthesis.i64 @ dummy)))]))]
(in (|> it
[{.#None}]
(of host evaluate $unit)
(try#each (|>> (as I64)
(i64#= expected)))
(try.else false))))))
(try.else false)))
)))
|