aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world
diff options
context:
space:
mode:
authorEduardo Julian2022-10-20 15:11:05 -0400
committerEduardo Julian2022-10-20 15:11:05 -0400
commit3525998c8fa9768dfeb333c553ccd71f38ac5311 (patch)
tree43007cbe3d6710d70cd006762384d937b6e21c36 /stdlib/source/test/lux/world
parent820ffc0a87d7960e62508fc451d9df7a94a6afa7 (diff)
Migrating default extensions to the new format [Part 3]
Diffstat (limited to 'stdlib/source/test/lux/world')
-rw-r--r--stdlib/source/test/lux/world/net.lux4
-rw-r--r--stdlib/source/test/lux/world/net/http/version.lux48
2 files changed, 51 insertions, 1 deletions
diff --git a/stdlib/source/test/lux/world/net.lux b/stdlib/source/test/lux/world/net.lux
index a6d74f5c6..29427d6c3 100644
--- a/stdlib/source/test/lux/world/net.lux
+++ b/stdlib/source/test/lux/world/net.lux
@@ -12,7 +12,8 @@
["[0]" /
["[1][0]" http
["[1]/[0]" client]
- ["[1]/[0]" status]]])
+ ["[1]/[0]" status]
+ ["[1]/[0]" version]]])
(def .public test
Test
@@ -31,4 +32,5 @@
/http/client.test
/http/status.test
+ /http/version.test
)))
diff --git a/stdlib/source/test/lux/world/net/http/version.lux b/stdlib/source/test/lux/world/net/http/version.lux
new file mode 100644
index 000000000..f005e944b
--- /dev/null
+++ b/stdlib/source/test/lux/world/net/http/version.lux
@@ -0,0 +1,48 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]
+ [\\specification
+ ["$[0]" equivalence]
+ ["$[0]" hash]]]
+ [data
+ [collection
+ ["[0]" list]
+ ["[0]" set]]]
+ [math
+ ["[0]" random (.only Random) (.use "[1]#[0]" monad)]
+ [number
+ ["n" nat]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(def .public random
+ (Random /.Version)
+ (all random.or
+ (random#in /.v0_9)
+ (random#in /.v1_0)
+ (random#in /.v1_1)
+ (random#in /.v2_0)
+ ))
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [])
+ (_.for [/.Version])
+ (all _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+ (_.for [/.hash]
+ ($hash.spec /.hash ..random))
+
+ (_.coverage [/.v0_9 /.v1_0 /.v1_1 /.v2_0]
+ (let [options (list /.v0_9 /.v1_0 /.v1_1 /.v2_0)
+ uniques (set.empty /.hash options)]
+ (n.= (list.size options)
+ (set.size uniques))))
+ )))