diff options
author | Eduardo Julian | 2021-06-14 18:33:54 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-06-14 18:33:54 -0400 |
commit | 519c0c0c71cdf7ce3dfc64b9781ab826760b3d94 (patch) | |
tree | 75fa0672afceff129e5e75afb7a5fed197ce1773 /stdlib/source/test/lux/world | |
parent | af3e6e2cb011dc2ad9204440990731a2f272716d (diff) |
Extracted Licentia out of the standard library.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/world.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/output/video/resolution.lux | 63 |
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)))) + )))) |