(.module: [lux #* ["_" test (#+ Test)] [abstract [monad (#+ do)] [hash (#+ Hash)] {[0 #spec] [/ ["$." equivalence] ["$." monoid]]}] [control [pipe (#+ case>)] ["." try] [parser ["." cli]]] [data ["." text] [number ["n" nat]] [collection ["." set (#+ Set)] ["." dictionary (#+ Dictionary)]]] [math ["." random (#+ Random) ("#\." monad)]]] [// ["@." artifact] ["@." dependency]] {#program ["." / ["/#" // #_ [repository (#+ Address)] ["#." dependency (#+ Dependency)] ["#." format]]]}) (def: distribution (Random /.Distribution) (random.or (random\wrap []) (random\wrap []))) (def: license (Random /.License) ($_ random.and (random.ascii/alpha 1) (random.ascii/alpha 1) ..distribution)) (def: scm (Random /.SCM) (random.ascii/alpha 1)) (def: organization (Random /.Organization) ($_ random.and (random.ascii/alpha 1) (random.ascii/alpha 1))) (def: email (Random /.Email) (random.ascii/alpha 1)) (def: developer (Random /.Developer) ($_ random.and (random.ascii/alpha 1) (random.ascii/alpha 1) (random.maybe organization))) (def: contributor (Random /.Contributor) ..developer) (def: (list-of random) (All [a] (-> (Random a) (Random (List a)))) (do {! random.monad} [size (\ ! map (n.% 5) random.nat)] (random.list size random))) (def: (set-of hash random) (All [a] (-> (Hash a) (Random a) (Random (Set a)))) (\ random.functor map (set.from-list hash) (..list-of random))) (def: (dictionary-of key-hash key-random value-random) (All [k v] (-> (Hash k) (Random k) (Random v) (Random (Dictionary k v)))) (\ random.functor map (dictionary.from-list key-hash) (..list-of (random.and key-random value-random)))) (def: info (Random /.Info) ($_ random.and (random.maybe (random.ascii/alpha 1)) (random.maybe ..scm) (random.maybe (random.ascii/alpha 1)) (..list-of ..license) (random.maybe ..organization) (..list-of ..developer) (..list-of ..contributor) )) (def: name (Random /.Name) (random.ascii/alpha 1)) (def: repository (Random Address) (random.ascii/alpha 1)) (def: source (Random /.Source) (random.ascii/alpha 1)) (def: target (Random /.Target) (random.ascii/alpha 1)) (def: #export random (Random /.Profile) ($_ random.and (..list-of ..name) (random.maybe @artifact.random) (random.maybe ..info) (..set-of text.hash ..repository) (..set-of //dependency.hash @dependency.random) (..set-of text.hash ..source) (random.maybe ..target) (random.maybe (random.ascii/alpha 1)) (random.maybe (random.ascii/alpha 1)) (..dictionary-of text.hash (random.ascii/alpha 1) ..repository) )) (def: #export test Test (<| (_.covering /._) (_.with-cover [/.Distribution /.License /.SCM /.Organization /.Email /.Developer /.Contributor /.Info /.Source /.Target /.Name /.Profile] ($_ _.and (_.with-cover [/.equivalence] ($equivalence.spec /.equivalence ..random)) (_.with-cover [/.monoid] ($monoid.spec /.equivalence /.monoid ..random)) ))))