aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/aedifex')
-rw-r--r--stdlib/source/test/aedifex/artifact/extension.lux4
-rw-r--r--stdlib/source/test/aedifex/artifact/type.lux4
-rw-r--r--stdlib/source/test/aedifex/hash.lux8
-rw-r--r--stdlib/source/test/aedifex/package.lux64
4 files changed, 72 insertions, 8 deletions
diff --git a/stdlib/source/test/aedifex/artifact/extension.lux b/stdlib/source/test/aedifex/artifact/extension.lux
index e65dd567a..c3da8465c 100644
--- a/stdlib/source/test/aedifex/artifact/extension.lux
+++ b/stdlib/source/test/aedifex/artifact/extension.lux
@@ -23,8 +23,8 @@
(_.with-cover [/.Extension]
($_ _.and
(_.cover [/.lux-library /.jvm-library /.pom
- /.sha1 /.md5]
- (let [options (list /.lux-library /.jvm-library /.pom /.sha1 /.md5)
+ /.sha-1 /.md5]
+ (let [options (list /.lux-library /.jvm-library /.pom /.sha-1 /.md5)
uniques (set.from-list text.hash options)]
(n.= (list.size options)
(set.size uniques))))
diff --git a/stdlib/source/test/aedifex/artifact/type.lux b/stdlib/source/test/aedifex/artifact/type.lux
index cbc6f681b..0d8284d7c 100644
--- a/stdlib/source/test/aedifex/artifact/type.lux
+++ b/stdlib/source/test/aedifex/artifact/type.lux
@@ -21,9 +21,9 @@
(_.with-cover [/.Type]
($_ _.and
(_.cover [/.lux-library /.jvm-library
- /.pom /.md5 /.sha1]
+ /.pom /.md5 /.sha-1]
(let [options (list /.lux-library /.jvm-library
- /.pom /.md5 /.sha1)
+ /.pom /.md5 /.sha-1)
uniques (set.from-list text.hash options)]
(n.= (list.size options)
(set.size uniques))))
diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux
index 21e318be6..bc6bb1b4b 100644
--- a/stdlib/source/test/aedifex/hash.lux
+++ b/stdlib/source/test/aedifex/hash.lux
@@ -40,7 +40,7 @@
(`` ($_ _.and
(_.with-cover [/.equivalence]
($_ _.and
- ($equivalence.spec /.equivalence (..random /.sha1))
+ ($equivalence.spec /.equivalence (..random /.sha-1))
($equivalence.spec /.equivalence (..random /.md5))
))
(_.with-cover [/.data]
@@ -64,14 +64,14 @@
(#try.Failure error)
(exception.match? <exception> error)))))]
- [/.sha1 /.as-sha1 /.not-a-sha1]
+ [/.sha-1 /.as-sha-1 /.not-a-sha-1]
[/.md5 /.as-md5 /.not-a-md5]
))))
(~~ (template [<codec> <hash>]
[(_.with-cover [<codec>]
($codec.spec /.equivalence <codec> (..random <hash>)))]
- [/.sha1-codec /.sha1]
+ [/.sha-1-codec /.sha-1]
[/.md5-codec /.md5]
))
(_.with-cover [/.not-a-hash]
@@ -89,7 +89,7 @@
(#try.Failure error)
(exception.match? /.not-a-hash error))))]
- [/.sha1-codec /.sha1]
+ [/.sha-1-codec /.sha-1]
[/.md5-codec /.md5]
))))
))))
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)))
+ ))))