(.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 random (Random [//.Profile /.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)] (wrap [profile (/.local pom content)]))) (def: #export test Test (<| (_.covering /._) (_.with-cover [/.Package]) (do {! random.monad} [[profile package] ..random] ($_ _.and (_.cover [/.local] (and (\ //hash.equivalence = (//hash.sha-1 (get@ #/.library package)) (get@ #/.sha-1 package)) (\ //hash.equivalence = (//hash.md5 (get@ #/.library package)) (get@ #/.md5 package)))) (_.cover [/.dependencies] (let [expected (get@ #//.dependencies profile)] (case (/.dependencies package) (#try.Success actual) (\ set.equivalence = expected actual) (#try.Failure error) false))) ))))