aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/lux/data/text.lux3
-rw-r--r--stdlib/source/test/lux/extension.lux6
-rw-r--r--stdlib/source/test/lux/ffi.jvm.lux60
-rw-r--r--stdlib/source/test/lux/tool.lux3
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/synthesis/simple.lux45
5 files changed, 92 insertions, 25 deletions
diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux
index ae6b02e1e..faa8e0f86 100644
--- a/stdlib/source/test/lux/data/text.lux
+++ b/stdlib/source/test/lux/data/text.lux
@@ -266,8 +266,7 @@
(_.for [/.equivalence]
($equivalence.spec /.equivalence (random.ascii 2)))
(_.for [/.hash]
- (|> (random.ascii 1)
- ($hash.spec /.hash)))
+ ($hash.spec /.hash (random.ascii 1)))
(_.for [/.order]
($order.spec /.order (random.ascii 2)))
(_.for [/.monoid]
diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux
index 85b98df02..b2dde4019 100644
--- a/stdlib/source/test/lux/extension.lux
+++ b/stdlib/source/test/lux/extension.lux
@@ -178,15 +178,13 @@
@.python (python.comment commentary
(python.statement (python.string commentary)))
@.lua (lua.comment commentary
- (lua.statement (lua.string commentary)))
+ (lua.statement expressionG))
@.ruby (ruby.comment commentary
(ruby.statement (ruby.string commentary)))]))]
(generation.log! commentary))))]
(in directive.no_requirements)))
- (for [... TODO: No longer skip testing Lua after Rembulan isn't being used anymore.
- @.lua (as_is)]
- (`` ((~~ (static ..directive)) (n.* 2 3))))
+ (`` ((~~ (static ..directive)) (n.* 2 3)))
))
(def: .public test
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux
index 765ea00e3..14f3d201a 100644
--- a/stdlib/source/test/lux/ffi.jvm.lux
+++ b/stdlib/source/test/lux/ffi.jvm.lux
@@ -151,7 +151,9 @@
(# ! each (|>> /.as_double)))
character (# ! each (|>> /.as_int /.int_to_char) random.int)
string (# ! each (|>> /.as_string)
- (random.ascii 1))]
+ (random.ascii 1))
+
+ bit/0 random.bit]
($_ _.and
(_.cover [/.check]
(and (case (/.check java/lang/String sample) {.#Some _} true {.#None} false)
@@ -182,25 +184,45 @@
/.!!!
/.null?
not)))
- (~~ (template [<object> <primitive> <value> <=>]
- [(|> <value>
- (: <object>)
- "jvm object cast"
- (: <primitive>)
- "jvm object cast"
- (: <object>)
- (<=> <value>)
- (_.cover [<object> <primitive>]))]
-
- [/.Boolean /.boolean boolean boolean#=]
- [/.Byte /.byte byte byte#=]
- [/.Short /.short short short#=]
- [/.Integer /.int integer integer#=]
- [/.Long /.long long long#=]
- [/.Float /.float float float#=]
- [/.Double /.double double double#=]
- [/.Character /.char character character#=]
+ (~~ (template [<object> <primitive> <jvm#value> <jvm#=>
+ <lux#value> <as> <of> <lux#=>]
+ [(_.cover [<object> <primitive>]
+ (|> <jvm#value>
+ (: <object>)
+ "jvm object cast"
+ (: <primitive>)
+ "jvm object cast"
+ (: <object>)
+ (<jvm#=> <jvm#value>)))
+ (_.cover [<as> <of>]
+ (|> <lux#value>
+ <as>
+ <of>
+ (<lux#=> <lux#value>)))]
+
+ [/.Boolean /.boolean boolean boolean#=
+ bit/0 /.as_boolean /.of_boolean bit#=]
+ [/.Byte /.byte byte byte#=
+ (/.of_byte byte) /.as_byte /.of_byte i#=]
+ [/.Short /.short short short#=
+ (/.of_short short) /.as_short /.of_short i#=]
+ [/.Integer /.int integer integer#=
+ (/.of_int integer) /.as_int /.of_int i#=]
+ [/.Long /.long long long#=
+ (/.of_long long) /.as_long /.of_long i#=]
+ [/.Float /.float float float#=
+ (/.of_float float) /.as_float /.of_float f#=]
+ [/.Double /.double double double#=
+ (/.of_double double) /.as_double /.of_double f#=]
+ [/.Character /.char character character#=
+ (/.of_char character) /.as_char /.of_char i#=]
))
+ (_.cover [/.as_string /.of_string]
+ (let [it (/.of_string string)]
+ (|> it
+ /.as_string
+ /.of_string
+ (text#= it))))
(_.cover [/.cannot_cast_to_non_object]
(text.contains? (value@ exception.#label /.cannot_cast_to_non_object)
(macro_error (/.:as boolean (: /.Boolean boolean)))))
diff --git a/stdlib/source/test/lux/tool.lux b/stdlib/source/test/lux/tool.lux
index 265f0a0c6..c1b0a83bd 100644
--- a/stdlib/source/test/lux/tool.lux
+++ b/stdlib/source/test/lux/tool.lux
@@ -12,6 +12,8 @@
[lux
... ["[1][0]" syntax]
["[1][0]" analysis]
+ ["[1][0]" synthesis "_"
+ ["[1]/[0]" simple]]
["[1][0]" phase "_"
["[1]/[0]" extension]
["[1]/[0]" analysis]
@@ -34,6 +36,7 @@
/reference.test
/phase.test
/analysis.test
+ /synthesis/simple.test
/meta/archive.test
/meta/cli.test
/meta/export.test
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/synthesis/simple.lux b/stdlib/source/test/lux/tool/compiler/language/lux/synthesis/simple.lux
new file mode 100644
index 000000000..568788a0e
--- /dev/null
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/synthesis/simple.lux
@@ -0,0 +1,45 @@
+(.using
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]
+ [\\specification
+ ["$[0]" equivalence]
+ ["$[0]" hash]]]
+ [data
+ ["[0]" bit ("[1]#[0]" equivalence)]
+ ["[0]" text ("[1]#[0]" equivalence)]]
+ [math
+ ["[0]" random {"+" Random}]
+ [number
+ ["n" nat]]]]]
+ [\\library
+ ["[0]" /]])
+
+(def: .public random
+ (Random /.Simple)
+ ($_ random.or
+ random.bit
+ random.i64
+ random.frac
+ (random.ascii/lower 1)
+ ))
+
+(def: .public test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.Simple])
+ (do [! random.monad]
+ [left ..random
+ right ..random]
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+ (_.for [/.hash]
+ ($hash.spec /.hash ..random))
+
+ (_.cover [/.format]
+ (bit#= (text#= (/.format left) (/.format right))
+ (# /.equivalence = left right)))
+ ))))