(.module: [lux #* ["_" test (#+ Test)] [abstract [equivalence (#+ Equivalence)] [hash (#+ Hash)] ["." monad (#+ do)]] [control ["." io] ["." try] ["." exception (#+ exception:)]] [data ["." product] ["." binary (#+ Binary)] ["." text ["%" format (#+ format)]] [collection ["." dictionary (#+ Dictionary)]]] [math ["." random (#+ Random)]] [world [net ["." uri (#+ URI)]]]] ["." / #_ ["#." identity] ["#." origin] [// ["@." artifact]]] {#spec ["$." /]} {#program ["." / ["/#" // #_ ["#." artifact (#+ Version Artifact) ["#/." extension (#+ Extension)]]]]}) (def: artifact (-> Version Artifact) (|>> ["com.github.luxlang" "test-artifact"])) (exception: (not_found {uri URI}) (exception.report ["URI" (%.text uri)])) (type: Store (Dictionary URI Binary)) (def: #export empty Store (dictionary.new text.hash)) (structure: #export simulation (/.Simulation Store) (def: (on_download uri state) (case (dictionary.get uri state) (#.Some content) (exception.return [state content]) #.None (exception.throw ..not_found [uri]))) (def: (on_upload uri content state) (exception.return (dictionary.put uri content state)))) (def: #export test Test (<| (_.covering /._) ($_ _.and (_.for [/.mock /.Simulation] ($/.spec (..artifact "1.2.3-YES") (..artifact "4.5.6-NO") (/.mock ..simulation ..empty))) /identity.test /origin.test )))