From 2fce6d44e0b4ada7ea270ff9a890504edbf8e3a3 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 23 Oct 2022 19:10:49 -0400 Subject: New Delay type with associated constants + compile-time warning for undefined computations. --- .../source/test/lux/control/concurrency/thread.lux | 15 ++++++++++ stdlib/source/test/lux/world/net.lux | 4 ++- stdlib/source/test/lux/world/net/uri/path.lux | 35 ++++++++++++++++++++++ .../test/lux/world/output/video/resolution.lux | 25 ++++++++++------ 4 files changed, 69 insertions(+), 10 deletions(-) create mode 100644 stdlib/source/test/lux/world/net/uri/path.lux (limited to 'stdlib/source/test') 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 [ ] + [(_.coverage [] + (i.= (duration.millis ) + (.int )))] + + [/.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 [] - (n.= (list.size ..listing) - (set.size ..catalogue))) - )))) + (_.coverage [] + (n.= (list.size ..listing) + (set.size ..catalogue))) + (,, (with_template [] + [(_.coverage [] + (list.every? (|>> (the ) (n.> 0)) ..listing))] + + [/.#width] + [/.#height] + )) + ))))) -- cgit v1.2.3