aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/package.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-11-01 22:56:30 -0400
committerEduardo Julian2020-11-01 22:56:30 -0400
commit3e67e244ad1f58a7bab0094967a86be72aae2482 (patch)
tree5e8677dd7401134cac932c423a766bcff69c41e2 /stdlib/source/test/aedifex/package.lux
parent69272f598d831e89da83bdc8c9290d5607dfb14d (diff)
Improved the design of actors.
Diffstat (limited to 'stdlib/source/test/aedifex/package.lux')
-rw-r--r--stdlib/source/test/aedifex/package.lux64
1 files changed, 64 insertions, 0 deletions
diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux
new file mode 100644
index 000000000..b85f6ce4a
--- /dev/null
+++ b/stdlib/source/test/aedifex/package.lux
@@ -0,0 +1,64 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." try]
+ [concurrency
+ [promise (#+ Promise)]]]
+ [data
+ ["." text]
+ [collection
+ ["." set (#+ Set)]]
+ [number
+ ["n" nat]]]
+ [math
+ ["." random (#+ Random)]]
+ [world
+ ["." file]]]
+ [//
+ ["@." profile]
+ [//
+ [lux
+ [data
+ ["_." binary]]]]]
+ {#program
+ ["." /
+ ["/#" // #_
+ ["#" profile]
+ ["#." dependency (#+ Dependency)]
+ ["#." pom]
+ ["#." hash]]]})
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.with-cover [/.Package])
+ (do {! random.monad}
+ [content-size (:: ! map (n.% 100) random.nat)
+ content (_binary.random content-size)
+ [profile pom] (random.one (function (_ profile)
+ (try.to-maybe
+ (do try.monad
+ [pom (//pom.write profile)]
+ (wrap [profile pom]))))
+ @profile.random)]
+ ($_ _.and
+ (_.cover [/.local]
+ (let [package (/.local pom content)]
+ (and (:: //hash.equivalence =
+ (//hash.sha-1 content)
+ (get@ #/.sha-1 package))
+ (:: //hash.equivalence =
+ (//hash.md5 content)
+ (get@ #/.md5 package)))))
+ (_.cover [/.dependencies]
+ (let [expected (get@ #//.dependencies profile)]
+ (case (/.dependencies (/.local pom content))
+ (#try.Success actual)
+ (:: set.equivalence = expected actual)
+
+ (#try.Failure error)
+ false)))
+ ))))