blob: 1190b7eac4a0b34ddead66efc15e8769d34f4f57 (
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
|
... 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]]
[data
["[0]" bit (.use "[1]#[0]" equivalence)]
["[0]" text]]
[math
["[0]" random (.only Random)]
[number
["[0]" int (.use "[1]#[0]" equivalence)]
["[0]" frac (.use "[1]#[0]" equivalence)]]]
[meta
[compiler
[target
[jvm
["//" bytecode]
["[0]" type]]]]]
[test
["_" property (.only Test)]]]]
[\\library
["[0]" / (.only)
[//
["[0]" host]
["[0]" primitive]]]])
(def .public test
Test
(<| (_.covering /._)
(do [! random.monad]
[expected_bit random.bit
expected_i64 random.i64
expected_f64 random.frac
expected_text (random.lower_cased 1)
.let [$unit [0 0]]])
(`` (all _.and
(_.coverage [/.field]
(not (text.empty? /.field)))
(_.coverage [/.boxed /.primitive]
(and (,, (with_template [<constructor> <expected> <lux_type> <=> <jvm_type>]
[(io.run! (do io.monad
[[class_loader host] host.host]
(in (when (of host evaluate $unit [{.#None}
(all //.composite
(<constructor> <expected>)
(/.primitive <jvm_type>)
(/.boxed <jvm_type>)
)])
{try.#Success actual}
(<=> <expected> (as <lux_type> actual))
{try.#Failure error}
false))))]
[primitive.bit expected_bit Bit bit#= type.boolean]
[primitive.i64 expected_i64 Int int#= type.long]
[primitive.f64 expected_f64 Frac frac#= type.double]
))))
))))
|