aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
authorEduardo Julian2022-01-07 20:29:29 -0400
committerEduardo Julian2022-01-07 20:29:29 -0400
commitef847d54cc6ac57bb2d470c1164ca7daeaa241b1 (patch)
treee031837ea0e6a76588378471dd7a4724d1035c53 /stdlib/source/test
parent0983f62269154f4ba607e6809b8d8ae7ebd96d21 (diff)
Now explicitly optimizing "exec".
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux11
-rw-r--r--stdlib/source/test/lux/tool.lux2
-rw-r--r--stdlib/source/test/lux/tool/compiler/version.lux41
3 files changed, 54 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index 06218dbb8..458b447e4 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -174,6 +174,17 @@
{.#None}
false))
(/.enumeration sample)))
+ (do !
+ [index (case size
+ 0 random.nat
+ _ (# ! each (n.% size) random.nat))
+ .let [changed? (/#= sample (/.revised index ++ sample))
+ same? (/#= sample (/.revised size ++ sample))]]
+ (_.cover [/.revised]
+ (case size
+ 0 (and changed?
+ same?)
+ _ (not changed?))))
))))
(def: slice
diff --git a/stdlib/source/test/lux/tool.lux b/stdlib/source/test/lux/tool.lux
index f7734328b..e2cbc50b6 100644
--- a/stdlib/source/test/lux/tool.lux
+++ b/stdlib/source/test/lux/tool.lux
@@ -5,6 +5,7 @@
["[0]" / "_"
[compiler
["[1][0]" arity]
+ ["[1][0]" version]
["[1][0]" reference]
[language
[lux
@@ -21,6 +22,7 @@
Test
($_ _.and
/arity.test
+ /version.test
/reference.test
/analysis/primitive.test
... /syntax.test
diff --git a/stdlib/source/test/lux/tool/compiler/version.lux b/stdlib/source/test/lux/tool/compiler/version.lux
new file mode 100644
index 000000000..01fc124a1
--- /dev/null
+++ b/stdlib/source/test/lux/tool/compiler/version.lux
@@ -0,0 +1,41 @@
+(.using
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]]
+ [data
+ ["[0]" bit ("[1]#[0]" equivalence)]
+ ["[0]" text ("[1]#[0]" equivalence)
+ ["%" format {"+" format}]]]
+ [math
+ ["[0]" random {"+" Random}]
+ [number
+ ["n" nat]]]]]
+ [\\library
+ ["[0]" /]])
+
+(def: .public random
+ (Random /.Version)
+ random.nat)
+
+(def: .public test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.Version])
+ (do [! random.monad]
+ [this ..random
+ that ..random]
+ (`` ($_ _.and
+ (_.cover [/.format]
+ (bit#= (n.= this that)
+ (text#= (/.format this) (/.format that))))
+ (~~ (template [<level>]
+ [(_.cover [<level>]
+ (text.contains? (%.nat (<level> this))
+ (/.format this)))]
+
+ [/.patch]
+ [/.minor]
+ [/.major]))
+ )))))