aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux')
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux64
1 files changed, 64 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux
new file mode 100644
index 000000000..f54f596cd
--- /dev/null
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/value.lux
@@ -0,0 +1,64 @@
+(.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]
+ ))))
+ ))))