(.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))) ))))