aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world
diff options
context:
space:
mode:
authorEduardo Julian2021-06-14 18:33:54 -0400
committerEduardo Julian2021-06-14 18:33:54 -0400
commit519c0c0c71cdf7ce3dfc64b9781ab826760b3d94 (patch)
tree75fa0672afceff129e5e75afb7a5fed197ce1773 /stdlib/source/test/lux/world
parentaf3e6e2cb011dc2ad9204440990731a2f272716d (diff)
Extracted Licentia out of the standard library.
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/world.lux6
-rw-r--r--stdlib/source/test/lux/world/output/video/resolution.lux63
2 files changed, 68 insertions, 1 deletions
diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux
index 0405ef7ee..8b560ca40 100644
--- a/stdlib/source/test/lux/world.lux
+++ b/stdlib/source/test/lux/world.lux
@@ -5,7 +5,10 @@
["#." file]
["#." shell]
["#." console]
- ["#." program]])
+ ["#." program]
+ ["#." output #_
+ ["#/." video #_
+ ["#/." resolution]]]])
(def: #export test
Test
@@ -14,4 +17,5 @@
/shell.test
/console.test
/program.test
+ /output/video/resolution.test
))
diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux
new file mode 100644
index 000000000..f5dcf5380
--- /dev/null
+++ b/stdlib/source/test/lux/world/output/video/resolution.lux
@@ -0,0 +1,63 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]
+ {[0 #spec]
+ [/
+ ["$." equivalence]
+ ["$." hash]]}]
+ [data
+ ["." maybe]
+ [collection
+ ["." list]
+ ["." set (#+ Set)]]]
+ [math
+ ["." random (#+ Random)]
+ [number
+ ["n" nat]]]]
+ {1
+ ["." /]})
+
+(with_expansions [<resolutions> (as_is /.svga
+ /.wsvga
+ /.xga
+ /.xga+
+ /.wxga/16:9
+ /.wxga/5:3
+ /.wxga/16:10
+ /.sxga
+ /.wxga+
+ /.hd+
+ /.wsxga+
+ /.fhd
+ /.wuxga
+ /.wqhd
+ /.uhd-4k)]
+ (def: catalogue
+ (Set /.Resolution)
+ (set.from_list /.hash (list <resolutions>)))
+
+ (def: #export random
+ (Random /.Resolution)
+ (let [listing (set.to_list catalogue)
+ count (list.size listing)]
+ (do {! random.monad}
+ [choice (\ ! map (n.% count) random.nat)]
+ (wrap (maybe.assume (list.nth choice listing))))))
+
+ (def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.Resolution])
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+ (_.for [/.hash]
+ ($hash.spec /.hash ..random))
+
+ (_.cover [<resolutions>]
+ (let [listing (set.to_list catalogue)]
+ (n.= (list.size listing)
+ (set.size catalogue))))
+ ))))