blob: 34289885ddfd28df66e1a447e2cb91f2d14b0ed5 (
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
88
89
90
91
92
93
94
95
96
97
|
(.require
[library
[lux (.except)
[abstract
[monad (.only do)]
[\\specification
["$[0]" equivalence]]]
[control
["<>" parser]
["[0]" try]
["[0]" exception]]
[math
["[0]" random (.only Random)]]
[meta
["[0]" location]
["[0]" code (.use "[1]#[0]" equivalence)
["<[1]>" \\parser]]]
[test
["_" property (.only Test)]]]]
[\\library
["[0]" /]]
["$[0]"//
["[1][0]" check]
["[1]//" ///
["[1][0]" code]]])
(def .public random
(Random /.Definition)
(all random.and
(random.alphabetic 5)
(random.or $//check.random
$////code.random)
random.bit
))
(def compiler
[.#info [.#target "FAKE"
.#version "0.0.0"
.#mode {.#Build}
.#configuration (list)]
.#source [location.dummy 0 ""]
.#location location.dummy
.#current_module {.#None}
.#modules (list)
.#scopes (list)
.#type_context [.#ex_counter 0
.#var_counter 0
.#var_bindings (list)]
.#expected {.#None}
.#seed 0
.#scope_type_vars (list)
.#extensions []
.#eval (as (-> Type Code (Meta Any)) [])
.#host []])
(def .public test
Test
(<| (_.covering /._)
(_.for [/.Definition])
(all _.and
(_.for [/.equivalence]
($equivalence.spec /.equivalence ..random))
(do random.monad
[expected ..random
type $////code.random
untyped_value $////code.random]
(all _.and
(_.coverage [/.format /.parser]
(when (<code>.result (/.parser compiler)
(list (/.format expected)))
{try.#Failure error}
false
{try.#Success actual}
(of /.equivalence = expected actual)))
(_.coverage [/.typed]
(let [expected (has /.#value {.#Left [type untyped_value]} expected)]
(when (<code>.result (/.typed compiler)
(list (/.format expected)))
{try.#Failure error}
false
{try.#Success actual}
(of /.equivalence = expected actual))))
(_.coverage [/.lacks_type]
(let [expected (has /.#value {.#Right untyped_value} expected)]
(when (<code>.result (/.typed compiler)
(list (/.format expected)))
{try.#Failure error}
(exception.match? /.lacks_type error)
{try.#Success actual}
false)))
)))
))
|