aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world/net/uri/query.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/world/net/uri/query.lux43
1 files changed, 43 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/world/net/uri/query.lux b/stdlib/source/test/lux/world/net/uri/query.lux
new file mode 100644
index 000000000..ecdd3c2c4
--- /dev/null
+++ b/stdlib/source/test/lux/world/net/uri/query.lux
@@ -0,0 +1,43 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]
+ [\\specification
+ ["[0]S" equivalence]
+ ["[0]S" codec]]]
+ [data
+ [collection
+ ["[0]" dictionary]]]
+ [math
+ ["[0]" random (.only Random) (.use "[1]#[0]" monad)]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(def .public (random size)
+ (-> Nat (Random /.Query))
+ (when size
+ 0 (random#in /.empty)
+ _ (do random.monad
+ [key (random.alphabetic size)
+ value (random.unicode size)
+ query (random (-- size))]
+ (in (dictionary.has key value query)))))
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [])
+ (_.for [/.Query])
+ (all _.and
+ (_.for [/.equivalence]
+ (equivalenceS.spec /.equivalence (..random 2)))
+ (_.for [/.codec]
+ (codecS.spec /.equivalence /.codec (..random 3)))
+
+ (_.coverage [/.empty]
+ (dictionary.empty? /.empty))
+ )))