aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
authorEduardo Julian2022-10-23 19:10:49 -0400
committerEduardo Julian2022-10-23 19:10:49 -0400
commit2fce6d44e0b4ada7ea270ff9a890504edbf8e3a3 (patch)
tree7fa035dd99c38400a354d61afb866bca1f4f8a2c /stdlib/source/test
parent8c63a525089597af1f9282c76daf97bf2b6058e0 (diff)
New Delay type with associated constants + compile-time warning for undefined computations.
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/control/concurrency/thread.lux15
-rw-r--r--stdlib/source/test/lux/world/net.lux4
-rw-r--r--stdlib/source/test/lux/world/net/uri/path.lux35
-rw-r--r--stdlib/source/test/lux/world/output/video/resolution.lux25
4 files changed, 69 insertions, 10 deletions
diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux
index 1dccae97f..8b2280e69 100644
--- a/stdlib/source/test/lux/control/concurrency/thread.lux
+++ b/stdlib/source/test/lux/control/concurrency/thread.lux
@@ -52,4 +52,19 @@
(n.= expected actual)]
(and expected_delay!
correct_value!)))))
+ (_.for [/.Delay]
+ (`` (all _.and
+ (,, (with_template [<delay> <duration>]
+ [(_.coverage [<delay>]
+ (i.= (duration.millis <duration>)
+ (.int <delay>)))]
+
+ [/.milli_second duration.milli_second]
+ [/.second duration.second]
+ [/.minute duration.minute]
+ [/.hour duration.hour]
+ [/.day duration.day]
+ [/.week duration.week]
+ ))
+ )))
))))
diff --git a/stdlib/source/test/lux/world/net.lux b/stdlib/source/test/lux/world/net.lux
index 252c6e077..53788fd79 100644
--- a/stdlib/source/test/lux/world/net.lux
+++ b/stdlib/source/test/lux/world/net.lux
@@ -16,7 +16,8 @@
["[1]/[0]" status]
["[1]/[0]" version]]
["[1][0]" uri
- ["[1]/[0]" scheme]]])
+ ["[1]/[0]" scheme]
+ ["[1]/[0]" path]]])
(def .public test
Test
@@ -39,4 +40,5 @@
/http/version.test
/uri/scheme.test
+ /uri/path.test
)))
diff --git a/stdlib/source/test/lux/world/net/uri/path.lux b/stdlib/source/test/lux/world/net/uri/path.lux
new file mode 100644
index 000000000..1a6c15a53
--- /dev/null
+++ b/stdlib/source/test/lux/world/net/uri/path.lux
@@ -0,0 +1,35 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]]
+ [data
+ ["[0]" text]
+ [collection
+ ["[0]" list]]]
+ [math
+ ["[0]" random (.only Random)]
+ [number
+ ["n" nat]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [segments (at ! each (n.% 10) random.nat)
+ segments (random.list segments (random.lower_case 1))])
+ (_.for [/.Path])
+ (all _.and
+ (_.coverage [/.path /.Segment /.separator]
+ (let [path (/.path segments)]
+ (when (list.size segments)
+ 0 (text.empty? path)
+ _ (and (list.every? (function (_ it)
+ (text.contains? it path))
+ segments)
+ (text.contains? /.separator path)))))
+ )))
diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux
index 80add1ed7..c5444497e 100644
--- a/stdlib/source/test/lux/world/output/video/resolution.lux
+++ b/stdlib/source/test/lux/world/output/video/resolution.lux
@@ -55,13 +55,20 @@
Test
(<| (_.covering /._)
(_.for [/.Resolution])
- (all _.and
- (_.for [/.equivalence]
- ($equivalence.spec /.equivalence ..random))
- (_.for [/.hash]
- ($hash.spec /.hash ..random))
+ (`` (all _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+ (_.for [/.hash]
+ ($hash.spec /.hash ..random))
- (_.coverage [<resolutions>]
- (n.= (list.size ..listing)
- (set.size ..catalogue)))
- ))))
+ (_.coverage [<resolutions>]
+ (n.= (list.size ..listing)
+ (set.size ..catalogue)))
+ (,, (with_template [<slot>]
+ [(_.coverage [<slot>]
+ (list.every? (|>> (the <slot>) (n.> 0)) ..listing))]
+
+ [/.#width]
+ [/.#height]
+ ))
+ )))))