diff options
Diffstat (limited to 'stdlib/source/test')
42 files changed, 1026 insertions, 298 deletions
diff --git a/stdlib/source/test/aedifex.lux b/stdlib/source/test/aedifex.lux index e3a2717cd..708834481 100644 --- a/stdlib/source/test/aedifex.lux +++ b/stdlib/source/test/aedifex.lux @@ -12,10 +12,12 @@ ["#/." clean] ["#/." pom] ["#/." install] - ["#/." deploy]] + ["#/." deploy] + ["#/." deps]] ["#." local] ["#." cache] - ["#." dependency] + ["#." dependency + ["#/." resolution]] ["#." package] ["#." profile] ["#." project] @@ -34,9 +36,11 @@ /command/pom.test /command/install.test /command/deploy.test + /command/deps.test /local.test /cache.test /dependency.test + /dependency/resolution.test /package.test /profile.test /project.test diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux index 9a4607306..94fd9a5f0 100644 --- a/stdlib/source/test/aedifex/artifact.lux +++ b/stdlib/source/test/aedifex/artifact.lux @@ -11,7 +11,7 @@ [concurrency [promise (#+ Promise)]]] [data - ["." text ("#@." equivalence)]] + ["." text ("#\." equivalence)]] [math ["." random (#+ Random)]] [world @@ -47,7 +47,7 @@ (_.cover [/.uri /.path] (|> (/.path fs sample) (text.replace-all uri.separator (:: fs separator)) - (text@= (/.uri sample))))) + (text\= (/.uri sample))))) /type.test /extension.test diff --git a/stdlib/source/test/aedifex/artifact/extension.lux b/stdlib/source/test/aedifex/artifact/extension.lux index c3da8465c..e098b0f9c 100644 --- a/stdlib/source/test/aedifex/artifact/extension.lux +++ b/stdlib/source/test/aedifex/artifact/extension.lux @@ -4,7 +4,7 @@ [abstract [monad (#+ do)]] [data - ["." text ("#@." equivalence)] + ["." text ("#\." equivalence)] [number ["n" nat]] [collection @@ -30,7 +30,7 @@ (set.size uniques)))) (_.cover [/.extension] (`` (and (~~ (template [<type> <extension>] - [(text@= <extension> + [(text\= <extension> (/.extension <type>))] [//.lux-library /.lux-library] diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index e1b4abfc5..7dff44202 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -18,7 +18,7 @@ ["." set] ["." dictionary]]] [math - ["." random (#+ Random) ("#@." monad)]] + ["." random (#+ Random) ("#\." monad)]] [world ["." file]]] [// @@ -42,8 +42,8 @@ (def: type (Random Type) ($_ random.either - (random@wrap //artifact/type.lux-library) - (random@wrap //artifact/type.jvm-library))) + (random\wrap //artifact/type.lux-library) + (random\wrap //artifact/type.jvm-library))) (def: profile (Random [Artifact Profile XML]) @@ -69,7 +69,7 @@ content ..content] (wrap [{#//dependency.artifact identity #//dependency.type type} - (//package.local pom content)]))) + (set@ #//package.origin #//package.Remote (//package.local pom content))]))) (def: resolution (Random Resolution) @@ -89,7 +89,7 @@ ..profile) content ..content] (wrap [dependency - (//package.local pom content)])))))] + (set@ #//package.origin #//package.Remote (//package.local pom content))])))))] (wrap (dictionary.from-list //dependency.hash (list& [main-dependency main-package] dependencies))))) (def: singular @@ -107,7 +107,7 @@ [_ wrote! actual-package read!] (wrap (:: //package.equivalence = - expected-package + (set@ #//package.origin #//package.Local expected-package) actual-package))))))))) (def: plural @@ -125,7 +125,9 @@ [_ wrote! actual read!] (wrap (:: //dependency/resolution.equivalence = - expected + (:: dictionary.functor map + (set@ #//package.origin #//package.Local) + expected) actual))))))))) (def: #export test diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index b7be4e8bf..5dacd4f16 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -12,9 +12,9 @@ [parser ["." cli]]] [data - ["." text ("#@." equivalence)]] + ["." text ("#\." equivalence)]] [math - ["." random (#+ Random) ("#@." monad)]]] + ["." random (#+ Random) ("#\." monad)]]] {#program ["." / ["/#" // #_ @@ -23,20 +23,20 @@ (def: compilation (Random /.Compilation) - (random.or (random@wrap []) - (random@wrap []))) + (random.or (random\wrap []) + (random\wrap []))) (def: command (Random /.Command) ($_ random.or ## #Clean - (random@wrap []) + (random\wrap []) ## #POM - (random@wrap []) + (random\wrap []) ## #Dependencies - (random@wrap []) + (random\wrap []) ## #Install - (random@wrap []) + (random\wrap []) ## #Deploy ($_ random.and (random.ascii/alpha 1) @@ -73,7 +73,7 @@ ..format (cli.run /.command) (case> (#try.Success [name actual]) - (and (text@= //.default name) + (and (text\= //.default name) (:: /.equivalence = expected actual)) (#try.Failure error) @@ -90,7 +90,7 @@ (list& "with" expected-profile) (cli.run /.command) (case> (#try.Success [actual-profile actual-command]) - (and (text@= expected-profile actual-profile) + (and (text\= expected-profile actual-profile) (:: /.equivalence = expected-command actual-command)) (#try.Failure error) diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index 73207fa14..ba9431b95 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -17,7 +17,7 @@ [number ["n" nat]] [collection - ["." list ("#@." functor)] + ["." list ("#\." functor)] ["." set]]] [math ["." random (#+ Random)]] @@ -45,7 +45,7 @@ [count (:: ! map (n.% 10) random.nat) names (random.set text.hash count ..node-name) contents (random.list count (_binary.random 100))] - (wrap (list.zip/2 (list@map (|>> (format prefix)) (set.to-list names)) + (wrap (list.zip/2 (list\map (|>> (format prefix)) (set.to-list names)) contents)))) (def: (create-file! fs [path content]) @@ -77,7 +77,7 @@ [directory-exists? (..directory-exists? fs directory-path) files-exist? (: (Action (List Bit)) (|> files - (list@map product.left) + (list\map product.left) (monad.map ///action.monad (..file-exists? fs))))] (wrap (and directory-exists? (list.every? (|>>) files-exist?))))) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index 20718f915..b27d3c0a7 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -4,7 +4,7 @@ [abstract ["." monad (#+ do)]] [control - ["." try (#+ Try) ("#@." functor)] + ["." try (#+ Try) ("#\." functor)] ["." exception] [concurrency ["." promise (#+ Promise)]] @@ -13,7 +13,7 @@ [data ["." maybe] ["." binary] - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["%" format (#+ format)] ["." encoding]] ["." format #_ diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux new file mode 100644 index 000000000..c0617188d --- /dev/null +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -0,0 +1,88 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)] + ["." predicate]] + [control + ["." try] + [concurrency + ["." promise]]] + [data + [text + ["%" format (#+ format)]] + [collection + ["." dictionary] + ["." set]]] + [math + ["." random (#+ Random)]] + [world + ["." file]]] + ["$." /// #_ + ["#." package] + ["#." artifact] + ["#." dependency #_ + ["#/." resolution]]] + {#program + ["." / + ["//#" /// #_ + ["#" profile] + ["#." action] + ["#." pom] + ["#." package] + ["#." cache] + ["#." repository] + ["#." artifact + ["#/." type]] + ["#." dependency + ["#/." resolution]]]]}) + +(def: #export test + Test + (<| (_.covering /._) + (do random.monad + [dependee-artifact $///artifact.random + depender-artifact (random.filter (predicate.complement + (:: ///artifact.equivalence = dependee-artifact)) + $///artifact.random) + + [_ dependee-package] $///package.random + [_ depender-package] $///package.random + + #let [dependee {#///dependency.artifact dependee-artifact + #///dependency.type ///artifact/type.lux-library} + depender {#///dependency.artifact depender-artifact + #///dependency.type ///artifact/type.lux-library} + + dependee-pom (|> (:: ///.monoid identity) + (set@ #///.identity (#.Some dependee-artifact)) + ///pom.write + try.assume) + depender-pom (|> (:: ///.monoid identity) + (set@ #///.identity (#.Some depender-artifact)) + (set@ #///.dependencies (set.from-list ///dependency.hash (list dependee))) + ///pom.write + try.assume) + + dependee-package (|> dependee-package + (set@ #///package.origin #///package.Remote) + (set@ #///package.pom dependee-pom)) + depender-package (|> depender-package + (set@ #///package.origin #///package.Remote) + (set@ #///package.pom depender-pom)) + + fs (file.mock (:: file.default separator))]] + (wrap (do promise.monad + [verdict (do ///action.monad + [pre (|> ///dependency/resolution.empty + (dictionary.put dependee dependee-package) + (///cache.write-all fs)) + post (|> (:: ///.monoid identity) + (set@ #///.dependencies (set.from-list ///dependency.hash (list dependee depender))) + (/.do! fs (list (///repository.mock ($///dependency/resolution.single depender-artifact depender-package) []))))] + (wrap (and (and (set.member? pre dependee-artifact) + (not (set.member? pre depender-artifact))) + (and (not (set.member? post dependee-artifact)) + (set.member? post depender-artifact)))))] + (_.claim [/.do!] + (try.default false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index 60a46116d..bcc6bb039 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -4,7 +4,7 @@ [abstract ["." monad (#+ do)]] [control - ["." try (#+ Try) ("#@." functor)] + ["." try (#+ Try)] ["." exception] [concurrency ["." promise (#+ Promise)]] @@ -13,7 +13,7 @@ [data ["." maybe] ["." binary] - ["." text ("#@." equivalence) + ["." text ["%" format (#+ format)] ["." encoding]] [format diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index c973678cc..dc05cced0 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -4,14 +4,14 @@ [abstract [monad (#+ do)]] [control - ["." try (#+ Try) ("#@." functor)] + ["." try (#+ Try) ("#\." functor)] [concurrency ["." promise (#+ Promise)]] [security ["!" capability]]] [data ["." binary] - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["." encoding]] [format ["." xml]]] @@ -41,14 +41,14 @@ (do ! [verdict (do ///action.monad [expected (|> (///pom.write sample) - (try@map (|>> (:: xml.codec encode) encoding.to-utf8)) + (try\map (|>> (:: xml.codec encode) encoding.to-utf8)) (:: ! wrap)) file (: (Promise (Try (File Promise))) (file.get-file promise.monad fs path)) actual (!.use (:: file content) []) #let [expected-path! - (text@= ///pom.file path) + (text\= ///pom.file path) expected-content! (:: binary.equivalence = expected actual)]] diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux new file mode 100644 index 000000000..0b2fbe2e2 --- /dev/null +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -0,0 +1,371 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)] + ["." predicate] + {[0 #spec] + [/ + ["$." equivalence]]}] + [control + ["." try] + ["." exception] + [concurrency + ["." promise]]] + [data + ["." product] + ["." binary] + ["." text ("#\." equivalence) + ["." encoding]] + [format + ["." xml]] + [collection + ["." dictionary] + ["." set]]] + [math + ["." random (#+ Random)]]] + ["$." /// #_ + ["#." package] + ["#." repository] + ["#." artifact] + [// + [lux + [data + ["$." binary]]]]] + {#program + ["." / + ["//#" /// #_ + ["#" profile] + ["#." package (#+ Package)] + ["#." hash] + ["#." repository (#+ Simulation)] + ["#." dependency] + ["#." pom] + ["#." artifact (#+ Artifact) + ["#/." type] + ["#/." extension]]]]}) + +(def: random + (Random /.Resolution) + (do {! random.monad} + [artifact $///artifact.random + [_ package] $///package.random] + (wrap (dictionary.put {#///dependency.artifact artifact + #///dependency.type ///artifact/type.lux-library} + package + /.empty)))) + +(def: #export (single artifact package) + (-> Artifact Package (Simulation Any)) + (structure + (def: (on-download request extension state) + (if (:: ///artifact.equivalence = artifact request) + (cond (text\= extension ///artifact/extension.lux-library) + (#try.Success [state (get@ #///package.library package)]) + + (text\= extension ///artifact/extension.pom) + (#try.Success [state (|> package + (get@ #///package.pom) + (:: xml.codec encode) + encoding.to-utf8)]) + + (text\= extension ///artifact/extension.sha-1) + (#try.Success [state (|> package + (get@ #///package.sha-1) + (:: ///hash.sha-1-codec encode) + encoding.to-utf8)]) + + (text\= extension ///artifact/extension.md5) + (#try.Success [state (|> package + (get@ #///package.md5) + (:: ///hash.md5-codec encode) + encoding.to-utf8)]) + + ## else + (#try.Failure "NOPE")) + (#try.Failure "NOPE"))) + (def: (on-upload identity artifact extension binary state) + (#try.Failure "NOPE")))) + +(def: one + Test + (do {! random.monad} + [expected-artifact $///artifact.random + [_ expected-package] $///package.random + [_ dummy-package] (random.filter (|>> product.right + (set@ #///package.pom (get@ #///package.pom expected-package)) + (:: ///package.equivalence = expected-package) + not) + $///package.random) + #let [good (..single expected-artifact expected-package) + bad-sha-1 (: (Simulation Any) + (structure + (def: (on-download actual-artifact extension state) + (if (:: ///artifact.equivalence = expected-artifact actual-artifact) + (cond (text\= extension ///artifact/extension.lux-library) + (#try.Success [state (get@ #///package.library expected-package)]) + + (text\= extension ///artifact/extension.pom) + (#try.Success [state (|> expected-package + (get@ #///package.pom) + (:: xml.codec encode) + encoding.to-utf8)]) + + (text\= extension ///artifact/extension.sha-1) + (#try.Success [state (|> dummy-package + (get@ #///package.sha-1) + (:: ///hash.sha-1-codec encode) + encoding.to-utf8)]) + + (text\= extension ///artifact/extension.md5) + (#try.Success [state (|> expected-package + (get@ #///package.md5) + (:: ///hash.md5-codec encode) + encoding.to-utf8)]) + + ## else + (#try.Failure "NOPE")) + (#try.Failure "NOPE"))) + (def: (on-upload identity artifact extension binary state) + (#try.Failure "NOPE")))) + bad-md5 (: (Simulation Any) + (structure + (def: (on-download actual-artifact extension state) + (if (:: ///artifact.equivalence = expected-artifact actual-artifact) + (cond (text\= extension ///artifact/extension.lux-library) + (#try.Success [state (get@ #///package.library expected-package)]) + + (text\= extension ///artifact/extension.pom) + (#try.Success [state (|> expected-package + (get@ #///package.pom) + (:: xml.codec encode) + encoding.to-utf8)]) + + (text\= extension ///artifact/extension.sha-1) + (#try.Success [state (|> expected-package + (get@ #///package.sha-1) + (:: ///hash.sha-1-codec encode) + encoding.to-utf8)]) + + (text\= extension ///artifact/extension.md5) + (#try.Success [state (|> dummy-package + (get@ #///package.md5) + (:: ///hash.md5-codec encode) + encoding.to-utf8)]) + + ## else + (#try.Failure "NOPE")) + (#try.Failure "NOPE"))) + (def: (on-upload identity artifact extension binary state) + (#try.Failure "NOPE"))))]] + (`` ($_ _.and + (wrap + (do promise.monad + [actual-package (/.one (///repository.mock good []) + {#///dependency.artifact expected-artifact + #///dependency.type ///artifact/type.lux-library})] + (_.claim [/.one] + (case actual-package + (#try.Success actual-package) + (:: ///package.equivalence = + (set@ #///package.origin #///package.Remote expected-package) + actual-package) + + (#try.Failure _) + false)))) + (~~ (template [<exception> <bad>] + [(wrap + (do promise.monad + [actual-package (/.one (///repository.mock <bad> []) + {#///dependency.artifact expected-artifact + #///dependency.type ///artifact/type.lux-library})] + (_.claim [<exception>] + (case actual-package + (#try.Failure error) + (exception.match? <exception> error) + + (#try.Success _) + false))))] + + [/.sha-1-does-not-match bad-sha-1] + [/.md5-does-not-match bad-md5] + )) + )))) + +(def: any + Test + (do {! random.monad} + [expected-artifact $///artifact.random + [_ expected-package] $///package.random + [_ dummy-package] (random.filter (|>> product.right + (set@ #///package.pom (get@ #///package.pom expected-package)) + (:: ///package.equivalence = expected-package) + not) + $///package.random) + #let [good (..single expected-artifact expected-package) + bad-sha-1 (: (Simulation Any) + (structure + (def: (on-download actual-artifact extension state) + (if (:: ///artifact.equivalence = expected-artifact actual-artifact) + (cond (text\= extension ///artifact/extension.lux-library) + (#try.Success [state (get@ #///package.library expected-package)]) + + (text\= extension ///artifact/extension.pom) + (#try.Success [state (|> expected-package + (get@ #///package.pom) + (:: xml.codec encode) + encoding.to-utf8)]) + + (text\= extension ///artifact/extension.sha-1) + (#try.Success [state (|> dummy-package + (get@ #///package.sha-1) + (:: ///hash.sha-1-codec encode) + encoding.to-utf8)]) + + (text\= extension ///artifact/extension.md5) + (#try.Success [state (|> expected-package + (get@ #///package.md5) + (:: ///hash.md5-codec encode) + encoding.to-utf8)]) + + ## else + (#try.Failure "NOPE")) + (#try.Failure "NOPE"))) + (def: (on-upload identity artifact extension binary state) + (#try.Failure "NOPE")))) + bad-md5 (: (Simulation Any) + (structure + (def: (on-download actual-artifact extension state) + (if (:: ///artifact.equivalence = expected-artifact actual-artifact) + (cond (text\= extension ///artifact/extension.lux-library) + (#try.Success [state (get@ #///package.library expected-package)]) + + (text\= extension ///artifact/extension.pom) + (#try.Success [state (|> expected-package + (get@ #///package.pom) + (:: xml.codec encode) + encoding.to-utf8)]) + + (text\= extension ///artifact/extension.sha-1) + (#try.Success [state (|> expected-package + (get@ #///package.sha-1) + (:: ///hash.sha-1-codec encode) + encoding.to-utf8)]) + + (text\= extension ///artifact/extension.md5) + (#try.Success [state (|> dummy-package + (get@ #///package.md5) + (:: ///hash.md5-codec encode) + encoding.to-utf8)]) + + ## else + (#try.Failure "NOPE")) + (#try.Failure "NOPE"))) + (def: (on-upload identity artifact extension binary state) + (#try.Failure "NOPE"))))]] + ($_ _.and + (wrap + (do promise.monad + [actual-package (/.any (list (///repository.mock bad-sha-1 []) + (///repository.mock bad-md5 []) + (///repository.mock good [])) + {#///dependency.artifact expected-artifact + #///dependency.type ///artifact/type.lux-library})] + (_.claim [/.any] + (case actual-package + (#try.Success actual-package) + (:: ///package.equivalence = + (set@ #///package.origin #///package.Remote expected-package) + actual-package) + + (#try.Failure _) + false)))) + (wrap + (do promise.monad + [actual-package (/.any (list (///repository.mock bad-sha-1 []) + (///repository.mock bad-md5 [])) + {#///dependency.artifact expected-artifact + #///dependency.type ///artifact/type.lux-library})] + (_.claim [/.cannot-resolve] + (case actual-package + (#try.Failure error) + (exception.match? /.cannot-resolve error) + + (#try.Success _) + false)))) + ))) + +(def: all + Test + (do {! random.monad} + [dependee-artifact $///artifact.random + depender-artifact (random.filter (predicate.complement + (:: ///artifact.equivalence = dependee-artifact)) + $///artifact.random) + ignored-artifact (random.filter (predicate.complement + (predicate.unite (:: ///artifact.equivalence = dependee-artifact) + (:: ///artifact.equivalence = depender-artifact))) + $///artifact.random) + + [_ dependee-package] $///package.random + [_ depender-package] $///package.random + [_ ignored-package] $///package.random + + #let [dependee {#///dependency.artifact dependee-artifact + #///dependency.type ///artifact/type.lux-library} + depender {#///dependency.artifact depender-artifact + #///dependency.type ///artifact/type.lux-library} + ignored {#///dependency.artifact ignored-artifact + #///dependency.type ///artifact/type.lux-library} + + dependee-pom (|> (:: ///.monoid identity) + (set@ #///.identity (#.Some dependee-artifact)) + ///pom.write + try.assume) + depender-pom (|> (:: ///.monoid identity) + (set@ #///.identity (#.Some depender-artifact)) + (set@ #///.dependencies (set.from-list ///dependency.hash (list dependee))) + ///pom.write + try.assume) + ignored-pom (|> (:: ///.monoid identity) + (set@ #///.identity (#.Some ignored-artifact)) + ///pom.write + try.assume) + + dependee-package (set@ #///package.pom dependee-pom dependee-package) + depender-package (set@ #///package.pom depender-pom depender-package) + ignored-package (set@ #///package.pom ignored-pom ignored-package)]] + ($_ _.and + (wrap + (do promise.monad + [resolution (/.all (list (///repository.mock (..single dependee-artifact dependee-package) []) + (///repository.mock (..single depender-artifact depender-package) []) + (///repository.mock (..single ignored-artifact ignored-package) [])) + (list depender) + /.empty)] + (_.claim [/.all] + (case resolution + (#try.Success resolution) + (and (dictionary.contains? depender resolution) + (dictionary.contains? dependee resolution) + (not (dictionary.contains? ignored resolution))) + + (#try.Failure error) + false)))) + ))) + +(def: #export test + Test + (<| (_.covering /._) + (_.with-cover [/.Resolution]) + ($_ _.and + (_.with-cover [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (_.cover [/.empty] + (dictionary.empty? /.empty)) + + ..one + ..any + ..all + ))) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index b05d0afcb..c25d6fe36 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -4,14 +4,14 @@ [abstract [monad (#+ do)]] [control - ["." try (#+ Try) ("#@." functor)] + ["." try (#+ Try)] [concurrency ["." promise (#+ Promise)]] [security ["!" capability]]] [data ["." binary] - ["." text ("#@." equivalence) + ["." text ["%" format] ["." encoding]]] [math diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux index b85f6ce4a..5400d4953 100644 --- a/stdlib/source/test/aedifex/package.lux +++ b/stdlib/source/test/aedifex/package.lux @@ -31,31 +31,36 @@ ["#." 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} - [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)] + [[profile package] ..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))))) + (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 (/.local pom content)) + (case (/.dependencies package) (#try.Success actual) (:: set.equivalence = expected actual) diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index 12fa349bb..394f93977 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -16,9 +16,9 @@ [collection ["." set (#+ Set)] ["." dictionary (#+ Dictionary)] - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [math - ["." random (#+ Random) ("#@." monad)]] + ["." random (#+ Random)]] [macro ["." code]]] [// @@ -98,7 +98,7 @@ (|> expected ..with-empty-profile dictionary.entries - (list@map (function (_ [name profile]) + (list\map (function (_ [name profile]) [name (..with-default-sources profile)])) (dictionary.from-list text.hash) (:: //project.equivalence = actual)) diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index 10d921f94..b49bd7f36 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -14,14 +14,14 @@ [parser ["." cli]]] [data - ["." text ("#@." equivalence)] + ["." text] [number ["n" nat]] [collection ["." set (#+ Set)] ["." dictionary (#+ Dictionary)]]] [math - ["." random (#+ Random) ("#@." monad)]]] + ["." random (#+ Random) ("#\." monad)]]] [// ["@." artifact] ["@." dependency]] @@ -34,8 +34,8 @@ (def: distribution (Random /.Distribution) - (random.or (random@wrap []) - (random@wrap []))) + (random.or (random\wrap []) + (random\wrap []))) (def: license (Random /.License) diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index f2c2917a2..ab8cc438f 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -8,15 +8,15 @@ ["$." equivalence] ["$." monoid]]}] [control - ["." try ("#@." functor)] + ["." try ("#\." functor)] ["." exception]] [data ["." product] - ["." text ("#@." equivalence)] + ["." text ("#\." equivalence)] [number ["n" nat]]] [math - ["." random (#+ Random) ("#@." monad)]]] + ["." random (#+ Random) ("#\." monad)]]] [// ["@." profile]] {#program @@ -27,7 +27,7 @@ (def: profile (Random [//.Name //.Profile]) (|> @profile.random - (random@map (set@ #//.parents (list))) + (random\map (set@ #//.parents (list))) (random.and (random.ascii/alpha 1)))) (def: #export random @@ -48,16 +48,16 @@ (do random.monad [[super-name super-profile] ..profile - [dummy-name dummy-profile] (random.filter (|>> product.left (text@= super-name) not) + [dummy-name dummy-profile] (random.filter (|>> product.left (text\= super-name) not) ..profile) [sub-name sub-profile] (random.filter (function (_ [name profile]) - (and (not (text@= super-name name)) - (not (text@= dummy-name name)))) + (and (not (text\= super-name name)) + (not (text\= dummy-name name)))) ..profile) fake-name (random.filter (function (_ name) - (and (not (text@= super-name name)) - (not (text@= dummy-name name)) - (not (text@= sub-name name)))) + (and (not (text\= super-name name)) + (not (text\= dummy-name name)) + (not (text\= sub-name name)))) (random.ascii/alpha 1)) #let [project ($_ (:: /.monoid compose) (/.project super-name super-profile) @@ -70,13 +70,13 @@ ($_ _.and (_.cover [/.profile] (and (|> (/.profile super-name project) - (try@map (:: //.equivalence = super-profile)) + (try\map (:: //.equivalence = super-profile)) (try.default false)) (|> (/.profile dummy-name project) - (try@map (:: //.equivalence = dummy-profile)) + (try\map (:: //.equivalence = dummy-profile)) (try.default false)) (|> (/.profile sub-name project) - (try@map (:: //.equivalence = (:: //.monoid compose sub-profile super-profile))) + (try\map (:: //.equivalence = (:: //.monoid compose sub-profile super-profile))) (try.default false)))) (_.cover [/.unknown-profile] (case (/.profile fake-name project) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 809e906fb..61e4489f3 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -27,7 +27,7 @@ [territory (#+)]] ["%" data/text/format (#+ format)] [math - ["." random (#+ Random) ("#@." functor)]] + ["." random (#+ Random) ("#\." functor)]] ## TODO: Test these modules ## [data ## [format @@ -239,8 +239,8 @@ Test ($_ _.and (do random.monad - [factor (random@map (|>> (n.% 10) (n.max 1)) random.nat) - iterations (random@map (n.% 100) random.nat) + [factor (random\map (|>> (n.% 10) (n.max 1)) random.nat) + iterations (random\map (n.% 100) random.nat) #let [expected (n.* factor iterations)]] (_.test "Can write loops." (n.= expected @@ -362,10 +362,10 @@ " " (%.name (name-of <backward>)))) (..conversion <gen> <forward> <backward> <=>))] - [i.= .nat .int (random@map (i.% +1,000,000) random.int)] - [n.= .int .nat (random@map (n.% 1,000,000) random.nat)] - [i.= i.frac f.int (random@map (i.% +1,000,000) random.int)] - [f.= f.int i.frac (random@map (|>> (i.% +1,000,000) i.frac) random.int)] + [i.= .nat .int (random\map (i.% +1,000,000) random.int)] + [n.= .int .nat (random\map (n.% 1,000,000) random.nat)] + [i.= i.frac f.int (random\map (i.% +1,000,000) random.int)] + [f.= f.int i.frac (random\map (|>> (i.% +1,000,000) i.frac) random.int)] [r.= r.frac f.rev frac-rev] ))))) (<| (_.context "Prelude macros.") diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index cbf390441..a8c91fbaf 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -249,7 +249,8 @@ [expected random.nat even (random.filter n.even? random.nat) odd (random.filter n.odd? random.nat) - #let [even^ (/.filter n.even? s.nat) + #let [nat^ s.nat + even^ (/.filter n.even? s.nat) odd^ (/.filter n.odd? s.nat)]] ($_ _.and (_.cover [/.rec] @@ -289,6 +290,22 @@ (|> (/.run (/.parses? even^) (list (code.nat odd))) (match verdict (not verdict))))) + (_.cover [/.parses] + (and (|> (/.run (/.parses even^) + (list (code.nat even))) + (match [] true)) + (|> (/.run (/.parses even^) + (list (code.nat odd))) + fails?))) + (_.cover [/.speculative] + (and (|> (/.run (/.and (/.speculative even^) nat^) + (list (code.nat even))) + (match [speculation actual] + (and (n.= speculation actual) + (n.= expected actual)))) + (|> (/.run (/.and (/.speculative even^) nat^) + (list (code.nat odd))) + fails?))) (_.cover [/.codec] (|> (/.run (/.codec n.decimal s.text) (list (code.text (%.nat expected)))) diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux index 6ae68a061..c65567c23 100644 --- a/stdlib/source/test/lux/data.lux +++ b/stdlib/source/test/lux/data.lux @@ -8,7 +8,6 @@ ["." / #_ ["#." binary] ["#." bit] - ["#." color] ["#." identity] ["#." lazy] ["#." maybe] @@ -16,6 +15,12 @@ ["#." number] ["#." product] ["#." sum] + ["#." color + ["#/." named]] + [format + ["#." json] + ["#." tar] + ["#." xml]] [number ["#." i8] ["#." i16] @@ -29,10 +34,6 @@ ["#." complex]] ["#." text ["#/." regex]] - [format - ["#." json] - ["#." tar] - ["#." xml]] ["#." collection]]) ## TODO: Get rid of this ASAP @@ -62,6 +63,7 @@ /binary.test /bit.test /color.test + /color/named.test /identity.test) test1 ($_ _.and /lazy.test diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 181d6efa4..6d35fd15b 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -16,7 +16,7 @@ [number ["n" nat]] [collection - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [math ["." random]]] {1 @@ -58,7 +58,7 @@ (let [merging-with-oneself (let [(^open ".") (/.equivalence n.equivalence)] (= dict (/.merge dict dict))) overwritting-keys (let [dict' (|> dict /.entries - (list@map (function (_ [k v]) [k (inc v)])) + (list\map (function (_ [k v]) [k (inc v)])) (/.from-list n.hash)) (^open ".") (/.equivalence n.equivalence)] (= dict' (/.merge dict' dict)))] diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 8b32295d9..a1d776d10 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -10,15 +10,15 @@ ["$." equivalence]]}] [data ["." product] - ["." bit ("#@." equivalence)] - ["." maybe ("#@." monad)] + ["." bit ("#\." equivalence)] + ["." maybe ("#\." monad)] [number ["n" nat]] [collection ["." set] - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [math - ["." random (#+ Random) ("#@." monad)]]] + ["." random (#+ Random) ("#\." monad)]]] {1 ["." /]}) @@ -27,7 +27,7 @@ (-> (Order k) (Random k) (Random v) Nat (Random (/.Dictionary k v)))) (case size 0 - (random@wrap (/.new order)) + (random\wrap (/.new order)) _ (do random.monad @@ -56,12 +56,12 @@ sorted-pairs (list.sort (function (_ [left _] [right _]) (n.< left right)) pairs) - sorted-values (list@map product.right sorted-pairs) - (^open "list@.") (list.equivalence (: (Equivalence [Nat Nat]) + sorted-values (list\map product.right sorted-pairs) + (^open "list\.") (list.equivalence (: (Equivalence [Nat Nat]) (function (_ [kr vr] [ks vs]) (and (n.= kr ks) (n.= vr vs))))) - (^open "/@.") (/.equivalence n.equivalence)]] + (^open "/\.") (/.equivalence n.equivalence)]] ($_ _.and (_.with-cover [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (..dictionary n.order random.nat random.nat size))) @@ -69,7 +69,7 @@ (_.cover [/.size] (n.= size (/.size sample))) (_.cover [/.empty?] - (bit@= (n.= 0 (/.size sample)) + (bit\= (n.= 0 (/.size sample)) (/.empty? sample))) (_.cover [/.new] (/.empty? (/.new n.order))) @@ -94,15 +94,15 @@ _ #0)) (_.cover [/.entries] - (list@= (/.entries sample) + (list\= (/.entries sample) sorted-pairs)) (_.cover [/.keys /.values] - (list@= (/.entries sample) + (list\= (/.entries sample) (list.zip/2 (/.keys sample) (/.values sample)))) (_.cover [/.from-list] (|> sample /.entries (/.from-list n.order) - (/@= sample))) + (/\= sample))) (_.cover [/.contains?] (and (list.every? (function (_ key) (/.contains? key sample)) (/.keys sample)) @@ -126,12 +126,12 @@ (|> sample (/.put extra-key extra-value) (/.remove extra-key) - (/@= sample))) + (/\= sample))) (_.cover [/.update] (|> sample (/.put extra-key extra-value) (/.update extra-key (n.+ shift)) (/.get extra-key) - (maybe@map (n.= (n.+ shift extra-value))) + (maybe\map (n.= (n.+ shift extra-value))) (maybe.default false))) )))) diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index cac27e0cf..3ffcc816c 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux @@ -7,8 +7,8 @@ [/ ["$." equivalence]]}] [data - ["." bit ("#@." equivalence)] - ["." maybe ("#@." monad)] + ["." bit ("#\." equivalence)] + ["." maybe ("#\." monad)] ["." text] [number ["n" nat]] @@ -50,7 +50,7 @@ (_.cover [/.size] (n.= size (/.size sample))) (_.cover [/.empty?] - (bit@= (n.= 0 (/.size sample)) + (bit\= (n.= 0 (/.size sample)) (/.empty? sample))) (_.cover [/.empty] (/.empty? /.empty)) @@ -74,14 +74,14 @@ (|> sample (/.put extra-key extra-value) (/.get extra-key) - (maybe@map (n.= extra-value)) + (maybe\map (n.= extra-value)) (maybe.default false))) (_.cover [/.update] (|> sample (/.put extra-key extra-value) (/.update extra-key (n.+ shift)) (/.get extra-key) - (maybe@map (n.= (n.+ shift extra-value))) + (maybe\map (n.= (n.+ shift extra-value))) (maybe.default false))) (_.cover [/.remove] (|> sample diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 2190c2fe2..ca432bcb4 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -21,7 +21,7 @@ ["." bit] ["." product] ["." maybe] - ["." text ("#@." equivalence)] + ["." text ("#\." equivalence)] [number ["n" nat] ["." int]] @@ -30,7 +30,7 @@ [math ["." random (#+ Random)]]] {1 - ["." / ("#@." monad)]}) + ["." / ("#\." monad)]}) (def: bounded-size (Random Nat) @@ -53,23 +53,23 @@ (_.with-cover [/.monoid] ($monoid.spec (/.equivalence n.equivalence) /.monoid ..random)) (_.with-cover [/.fold] - ($fold.spec /@wrap /.equivalence /.fold)) + ($fold.spec /\wrap /.equivalence /.fold)) (_.with-cover [/.functor] - ($functor.spec /@wrap /.equivalence /.functor)) + ($functor.spec /\wrap /.equivalence /.functor)) (_.with-cover [/.apply] - ($apply.spec /@wrap /.equivalence /.apply)) + ($apply.spec /\wrap /.equivalence /.apply)) (_.with-cover [/.monad] - ($monad.spec /@wrap /.equivalence /.monad)) + ($monad.spec /\wrap /.equivalence /.monad)) (do {! random.monad} [parameter random.nat subject random.nat] (let [lift (/.lift io.monad) - (^open "io@.") io.monad + (^open "io\.") io.monad expected (n.+ parameter subject)] (_.cover [/.with /.lift] (|> (io.run (do (/.with io.monad) - [a (lift (io@wrap parameter)) + [a (lift (io\wrap parameter)) b (wrap subject)] (wrap (n.+ a b)))) (case> (^ (list actual)) @@ -83,7 +83,7 @@ Test (do {! random.monad} [size ..bounded-size - #let [(^open "/@.") (/.equivalence n.equivalence)] + #let [(^open "/\.") (/.equivalence n.equivalence)] sample (:: ! map set.to-list (random.set n.hash size random.nat))] ($_ _.and (_.cover [/.size] @@ -97,11 +97,11 @@ (_.cover [/.reverse] (or (n.< 2 (/.size sample)) (let [not-same! - (not (/@= sample + (not (/\= sample (/.reverse sample))) self-symmetry! - (/@= sample + (/\= sample (/.reverse (/.reverse sample)))] (and not-same! self-symmetry!)))) @@ -117,7 +117,7 @@ (/.size (/.sort <<< sample))) symmetry! - (/@= (/.sort <<< sample) + (/\= (/.sort <<< sample) (/.reverse (/.sort (function.flip <<<) sample)))] (and size-preservation! symmetry!))) @@ -125,8 +125,8 @@ (def: indices Test - (let [(^open "/@.") (/.equivalence n.equivalence) - (^open "/@.") /.functor] + (let [(^open "/\.") (/.equivalence n.equivalence) + (^open "/\.") /.functor] (do {! random.monad} [sample ..random #let [size (/.size sample)]] @@ -138,7 +138,7 @@ (n.= size (/.size indices)) already-sorted! - (/@= indices + (/\= indices (/.sort n.< indices)) expected-numbers! @@ -153,12 +153,12 @@ (let [enumeration (/.enumeration sample) has-correct-indices! - (/@= (/.indices (/.size enumeration)) - (/@map product.left enumeration)) + (/\= (/.indices (/.size enumeration)) + (/\map product.left enumeration)) has-correct-values! - (/@= sample - (/@map product.right enumeration))] + (/\= sample + (/\map product.right enumeration))] (and has-correct-indices! has-correct-values!))) (_.cover [/.nth] @@ -174,8 +174,8 @@ (def: slice Test - (let [(^open "/@.") (/.equivalence n.equivalence) - (^open "/@.") /.monoid] + (let [(^open "/\.") (/.equivalence n.equivalence) + (^open "/\.") /.monoid] (do {! random.monad} [sample (random.filter (|>> /.size (n.> 0)) ..random) @@ -194,36 +194,36 @@ (/.size negatives)))))) (_.cover [/.partition] (let [[positives negatives] (/.partition n.even? sample)] - (and (/@= (/.filter n.even? sample) + (and (/\= (/.filter n.even? sample) positives) - (/@= (/.filter (bit.complement n.even?) sample) + (/\= (/.filter (bit.complement n.even?) sample) negatives)))) (_.cover [/.split] (let [[left right] (/.split idx sample)] - (/@= sample - (/@compose left right)))) + (/\= sample + (/\compose left right)))) (_.cover [/.split-with] (let [[left right] (/.split-with n.even? sample)] - (/@= sample - (/@compose left right)))) + (/\= sample + (/\compose left right)))) (_.cover [/.take /.drop] - (/@= sample - (/@compose (/.take idx sample) + (/\= sample + (/\compose (/.take idx sample) (/.drop idx sample)))) (_.cover [/.take-while /.drop-while] - (/@= sample - (/@compose (/.take-while n.even? sample) + (/\= sample + (/\compose (/.take-while n.even? sample) (/.drop-while n.even? sample)))) (_.cover [/.chunk] (let [chunks (/.chunk chunk-size sample)] (and (/.every? (|>> /.size (n.<= chunk-size)) chunks) - (/@= sample + (/\= sample (/.concat chunks))))) )))) (def: member Test - (let [(^open "/@.") (/.equivalence n.equivalence)] + (let [(^open "/\.") (/.equivalence n.equivalence)] (do {! random.monad} [sample ..random] (`` ($_ _.and @@ -245,7 +245,7 @@ (_.cover [<tail>] (case [(<pre> sample) (<tail> sample)] [(#.Cons _ expected) (#.Some actual)] - (/@= (<pre> expected) actual) + (/\= (<pre> expected) actual) [#.Nil #.None] true @@ -261,9 +261,9 @@ (def: grouping Test - (let [(^open "/@.") (/.equivalence n.equivalence) - (^open "/@.") /.functor - (^open "/@.") /.monoid + (let [(^open "/\.") (/.equivalence n.equivalence) + (^open "/\.") /.functor + (^open "/\.") /.monoid +/2 (: (-> Nat Nat Nat) (function (_ left right) @@ -288,10 +288,10 @@ (n.min (/.size sample/0) (/.size sample/1))) can-extract-values! - (and (/@= (/.take zipped::size sample/0) - (/@map product.left zipped)) - (/@= (/.take zipped::size sample/1) - (/@map product.right zipped)))] + (and (/\= (/.take zipped::size sample/0) + (/\map product.left zipped)) + (/\= (/.take zipped::size sample/1) + (/\map product.right zipped)))] (and size-of-smaller-list! can-extract-values!))) (_.cover [/.zip/3] @@ -306,12 +306,12 @@ (/.size sample/2))) can-extract-values! - (and (/@= (/.take zipped::size sample/0) - (/@map product.left zipped)) - (/@= (/.take zipped::size sample/1) - (/@map (|>> product.right product.left) zipped)) - (/@= (/.take zipped::size sample/2) - (/@map (|>> product.right product.right) zipped)))] + (and (/\= (/.take zipped::size sample/0) + (/\map product.left zipped)) + (/\= (/.take zipped::size sample/1) + (/\map (|>> product.right product.left) zipped)) + (/\= (/.take zipped::size sample/2) + (/\map (|>> product.right product.right) zipped)))] (and size-of-smaller-list! can-extract-values!))) (_.cover [/.zip] @@ -323,30 +323,30 @@ ((/.zip 3) sample/0 sample/1 sample/2)))) (_.cover [/.zip-with/2] - (/@= (/@map (function (_ [left right]) + (/\= (/\map (function (_ [left right]) (+/2 left right)) (/.zip/2 sample/0 sample/1)) (/.zip-with/2 +/2 sample/0 sample/1))) (_.cover [/.zip-with/3] - (/@= (/@map (function (_ [left mid right]) + (/\= (/\map (function (_ [left mid right]) (+/3 left mid right)) (/.zip/3 sample/0 sample/1 sample/2)) (/.zip-with/3 +/3 sample/0 sample/1 sample/2))) (_.cover [/.zip-with] - (and (/@= (/.zip-with/2 +/2 sample/0 sample/1) + (and (/\= (/.zip-with/2 +/2 sample/0 sample/1) ((/.zip-with 2) +/2 sample/0 sample/1)) - (/@= (/.zip-with/3 +/3 sample/0 sample/1 sample/2) + (/\= (/.zip-with/3 +/3 sample/0 sample/1 sample/2) ((/.zip-with 3) +/3 sample/0 sample/1 sample/2)))) (_.cover [/.concat] - (and (/@= (/@compose sample/0 sample/1) + (and (/\= (/\compose sample/0 sample/1) (/.concat (list sample/0 sample/1))) - (/@= ($_ /@compose sample/0 sample/1 sample/2) + (/\= ($_ /\compose sample/0 sample/1 sample/2) (/.concat (list sample/0 sample/1 sample/2))))) )))) (def: search Test - (let [(^open "/@.") /.functor + (let [(^open "/\.") /.functor choose (: (-> Nat (Maybe Text)) (function (_ value) @@ -359,11 +359,11 @@ (_.cover [/.one] (case [(|> sample (/.filter n.even?) - (/@map (:: n.decimal encode)) + (/\map (:: n.decimal encode)) /.head) (/.one choose sample)] [(#.Some expected) (#.Some actual)] - (text@= expected actual) + (text\= expected actual) [#.None #.None] true @@ -374,7 +374,7 @@ (:: (/.equivalence text.equivalence) = (|> sample (/.filter n.even?) - (/@map (:: n.decimal encode))) + (/\map (:: n.decimal encode))) (/.all choose sample))) (_.cover [/.find] (case (/.find n.even? sample) @@ -389,8 +389,8 @@ Test (<| (_.covering /._) (_.with-cover [.List]) - (let [(^open "/@.") (/.equivalence n.equivalence) - (^open "/@.") /.functor] + (let [(^open "/\.") (/.equivalence n.equivalence) + (^open "/\.") /.functor] (do {! random.monad} [sample ..random separator random.nat] @@ -412,14 +412,14 @@ (_.cover [/.iterate] (or (/.empty? sample) (let [size (/.size sample)] - (/@= (/.indices size) + (/\= (/.indices size) (/.iterate (function (_ index) (if (n.< size index) (#.Some (inc index)) #.None)) 0))))) (_.cover [/.folds] - (/@= (/@map (function (_ index) + (/\= (/\map (function (_ index) (:: /.fold fold n.+ 0 (/.take index sample))) (/.indices (inc (/.size sample)))) (/.folds n.+ 0 sample))) diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux index 9cc7c4500..3cd4d6db2 100644 --- a/stdlib/source/test/lux/data/collection/queue.lux +++ b/stdlib/source/test/lux/data/collection/queue.lux @@ -8,13 +8,13 @@ ["$." equivalence] ["$." functor (#+ Injection)]]}] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] ["%" text/format (#+ format)] [number ["n" nat]] [collection ["." set] - ["." list ("#@." monoid)]]] + ["." list ("#\." monoid)]]] [math ["." random]]] {1 @@ -47,13 +47,13 @@ (_.cover [/.size] (n.= size (/.size sample))) (_.cover [/.empty?] - (bit@= (n.= 0 size) (/.empty? sample))) + (bit\= (n.= 0 size) (/.empty? sample))) (_.cover [/.empty] (let [empty-is-empty! (/.empty? /.empty) all-empty-queues-look-the-same! - (bit@= (/.empty? sample) + (bit\= (/.empty? sample) (:: (/.equivalence n.equivalence) = sample /.empty))] @@ -89,7 +89,7 @@ has-expected-order! (:: (list.equivalence n.equivalence) = - (list@compose (/.to-list sample) (list non-member)) + (list\compose (/.to-list sample) (list non-member)) (/.to-list pushed))] (and size-increases! new-member-is-identified! diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux index 073ce2c8d..37e52d598 100644 --- a/stdlib/source/test/lux/data/collection/queue/priority.lux +++ b/stdlib/source/test/lux/data/collection/queue/priority.lux @@ -4,8 +4,8 @@ [abstract ["." monad (#+ do)]] [data - ["." maybe ("#@." functor)] - ["." bit ("#@." equivalence)] + ["." maybe ("#\." functor)] + ["." bit ("#\." equivalence)] [number ["n" nat]]] [math @@ -41,7 +41,7 @@ (_.cover [/.size] (n.= size (/.size sample))) (_.cover [/.empty?] - (bit@= (n.= 0 (/.size sample)) + (bit\= (n.= 0 (/.size sample)) (/.empty? sample))) (_.cover [/.empty] (/.empty? /.empty)) @@ -78,7 +78,7 @@ (/.push /.min min-member) (/.push /.max max-member) /.peek - (maybe@map (n.= max-member)) + (maybe\map (n.= max-member)) (maybe.default false))) (_.cover [/.min] (|> /.empty @@ -86,7 +86,7 @@ (/.push /.min min-member) /.pop /.peek - (maybe@map (n.= min-member)) + (maybe\map (n.= min-member)) (maybe.default false))) )) )))) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 716b03168..7a51ff797 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -15,16 +15,16 @@ ["." try (#+ Try)] ["." exception]] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["n" nat]] [collection - ["." list ("#@." fold)] + ["." list ("#\." fold)] ["." set]]] [math ["." random]]] {1 - ["." / ("#@." monad)]}) + ["." / ("#\." monad)]}) (def: signatures Test @@ -36,13 +36,13 @@ (_.with-cover [/.monoid] ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.row size random.nat))) (_.with-cover [/.fold] - ($fold.spec /@wrap /.equivalence /.fold)) + ($fold.spec /\wrap /.equivalence /.fold)) (_.with-cover [/.functor] - ($functor.spec /@wrap /.equivalence /.functor)) + ($functor.spec /\wrap /.equivalence /.functor)) (_.with-cover [/.apply] - ($apply.spec /@wrap /.equivalence /.apply)) + ($apply.spec /\wrap /.equivalence /.apply)) (_.with-cover [/.monad] - ($monad.spec /@wrap /.equivalence /.monad)) + ($monad.spec /\wrap /.equivalence /.monad)) ))) (def: whole @@ -51,24 +51,24 @@ [size (:: ! map (n.% 100) random.nat) sample (random.set n.hash size random.nat) #let [sample (|> sample set.to-list /.from-list)] - #let [(^open "/@.") (/.equivalence n.equivalence)]] + #let [(^open "/\.") (/.equivalence n.equivalence)]] ($_ _.and (_.cover [/.size] (n.= size (/.size sample))) (_.cover [/.empty?] - (bit@= (/.empty? sample) (n.= 0 (/.size sample)))) + (bit\= (/.empty? sample) (n.= 0 (/.size sample)))) (_.cover [/.empty] (/.empty? /.empty)) (_.cover [/.to-list /.from-list] - (|> sample /.to-list /.from-list (/@= sample))) + (|> sample /.to-list /.from-list (/\= sample))) (_.cover [/.reverse] (or (n.< 2 (/.size sample)) (let [not-same! - (not (/@= sample + (not (/\= sample (/.reverse sample))) self-symmetry! - (/@= sample + (/\= sample (/.reverse (/.reverse sample)))] (and not-same! self-symmetry!)))) @@ -145,14 +145,14 @@ non-member (random.filter (|>> (set.member? sample) not) random.nat) #let [sample (|> sample set.to-list /.from-list)] - #let [(^open "/@.") (/.equivalence n.equivalence)]] + #let [(^open "/\.") (/.equivalence n.equivalence)]] ($_ _.and (do ! [value/0 random.nat value/1 random.nat value/2 random.nat] (_.cover [/.row] - (/@= (/.from-list (list value/0 value/1 value/2)) + (/\= (/.from-list (list value/0 value/1 value/2)) (/.row value/0 value/1 value/2)))) (_.cover [/.member?] (and (list.every? (/.member? n.equivalence sample) @@ -180,7 +180,7 @@ (|> sample (/.add non-member) /.pop - (/@= sample))] + (/\= sample))] (and expected-size! symmetry!)))) )) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index ad1dd0448..e255fd5f5 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -17,7 +17,7 @@ ["." text ["%" format (#+ format)]] [collection - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [math ["." random]]] {1 @@ -35,7 +35,7 @@ Test (<| (_.covering /._) (_.with-cover [/.Sequence]) - (let [(^open "list@.") (list.equivalence n.equivalence)]) + (let [(^open "list\.") (list.equivalence n.equivalence)]) (do {! random.monad} [repeated random.nat index (:: ! map (n.% 100) random.nat) @@ -56,38 +56,38 @@ (n.= repeated (/.nth index (/.repeat repeated)))) (_.cover [/.take] - (list@= (enum.range n.enum offset (dec (n.+ size offset))) + (list\= (enum.range n.enum offset (dec (n.+ size offset))) (/.take size (/.iterate inc offset)))) (_.cover [/.drop] - (list@= (enum.range n.enum offset (dec (n.+ size offset))) + (list\= (enum.range n.enum offset (dec (n.+ size offset))) (/.take size (/.drop offset (/.iterate inc 0))))) (_.cover [/.split] (let [[drops takes] (/.split size (/.iterate inc 0))] - (and (list@= (enum.range n.enum 0 (dec size)) + (and (list\= (enum.range n.enum 0 (dec size)) drops) - (list@= (enum.range n.enum size (dec (n.* 2 size))) + (list\= (enum.range n.enum size (dec (n.* 2 size))) (/.take size takes))))) (_.cover [/.take-while] - (list@= (enum.range n.enum 0 (dec size)) + (list\= (enum.range n.enum 0 (dec size)) (/.take-while (n.< size) (/.iterate inc 0)))) (_.cover [/.drop-while] - (list@= (enum.range n.enum offset (dec (n.+ size offset))) + (list\= (enum.range n.enum offset (dec (n.+ size offset))) (/.take-while (n.< (n.+ size offset)) (/.drop-while (n.< offset) (/.iterate inc 0))))) (_.cover [/.split-while] (let [[drops takes] (/.split-while (n.< size) (/.iterate inc 0))] - (and (list@= (enum.range n.enum 0 (dec size)) + (and (list\= (enum.range n.enum 0 (dec size)) drops) - (list@= (enum.range n.enum size (dec (n.* 2 size))) + (list\= (enum.range n.enum size (dec (n.* 2 size))) (/.take-while (n.< (n.* 2 size)) takes))))) (_.cover [/.head] (n.= offset (/.head (/.iterate inc offset)))) (_.cover [/.tail] - (list@= (enum.range n.enum (inc offset) (n.+ size offset)) + (list\= (enum.range n.enum (inc offset) (n.+ size offset)) (/.take size (/.tail (/.iterate inc offset))))) (_.cover [/.filter] - (list@= (list@map (n.* 2) (enum.range n.enum 0 (dec size))) + (list\= (list\map (n.* 2) (enum.range n.enum 0 (dec size))) (/.take size (/.filter n.even? (/.iterate inc 0))))) (_.cover [/.partition] (let [[evens odds] (/.partition n.even? (/.iterate inc 0))] @@ -96,16 +96,16 @@ (n.= (inc (n.* 2 offset)) (/.nth offset odds))))) (_.cover [/.unfold] - (let [(^open "/@.") /.functor - (^open "list@.") (list.equivalence text.equivalence)] - (list@= (/.take size - (/@map %.nat (/.iterate inc offset))) + (let [(^open "/\.") /.functor + (^open "list\.") (list.equivalence text.equivalence)] + (list\= (/.take size + (/\map %.nat (/.iterate inc offset))) (/.take size (/.unfold (function (_ n) [(inc n) (%.nat n)]) offset))))) (_.cover [/.cycle] (let [cycle (list& cycle-start cycle-next)] - (list@= (list.concat (list.repeat size cycle)) + (list\= (list.concat (list.repeat size cycle)) (/.take (n.* size (list.size cycle)) (/.cycle [cycle-start cycle-next]))))) (_.cover [/.^sequence&] diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index 93549712f..3525a5fc8 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -9,7 +9,7 @@ ["$." equivalence] ["$." monoid]]}] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["n" nat]] [collection @@ -28,7 +28,7 @@ Test (<| (_.covering /._) (_.with-cover [/.Set]) - (let [(^open "/@.") /.equivalence]) + (let [(^open "/\.") /.equivalence]) (do random.monad [size ..gen-nat] ($_ _.and @@ -48,10 +48,10 @@ (_.cover [/.size] (n.= sizeL (/.size setL))) (_.cover [/.empty?] - (bit@= (/.empty? setL) + (bit\= (/.empty? setL) (n.= 0 (/.size setL)))) (_.cover [/.to-list /.from-list] - (|> setL /.to-list (/.from-list n.hash) (/@= setL))) + (|> setL /.to-list (/.from-list n.hash) (/\= setL))) (_.cover [/.member?] (and (list.every? (/.member? setL) (/.to-list setL)) (not (/.member? setL non-memberL)))) @@ -72,12 +72,12 @@ (|> setL (/.add non-memberL) (/.remove non-memberL) - (/@= setL)) + (/\= setL)) idempotency! (|> setL (/.remove non-memberL) - (/@= setL))] + (/\= setL))] (and symmetry! idempotency!))) (_.cover [/.union /.sub?] @@ -90,7 +90,7 @@ union-with-empty-set! (|> setL (/.union (/.new n.hash)) - (/@= setL))] + (/\= setL))] (and sets-are-subs-of-their-unions! union-with-empty-set!))) (_.cover [/.intersection /.super?] diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 039f67200..8e376ba17 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -9,12 +9,12 @@ [/ ["$." equivalence]]}] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["n" nat]] [collection ["." set] - ["." list ("#@." fold)]]] + ["." list ("#\." fold)]]] [math ["." random (#+ Random)]]] {1 @@ -29,7 +29,7 @@ (do {! random.monad} [elements (random.set hash size element) element-counts (random.list size ..count)] - (wrap (list@fold (function (_ [count element] set) + (wrap (list\fold (function (_ [count element] set) (/.add count element set)) (/.new hash) (list.zip/2 element-counts @@ -60,7 +60,7 @@ (n.= (list.size (/.to-list sample)) (/.size sample))) (_.cover [/.empty?] - (bit@= (/.empty? sample) + (bit\= (/.empty? sample) (n.= 0 (/.size sample)))) (_.cover [/.new] (/.empty? (/.new n.hash))) diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux index 80b7fce63..bc2082846 100644 --- a/stdlib/source/test/lux/data/collection/stack.lux +++ b/stdlib/source/test/lux/data/collection/stack.lux @@ -9,7 +9,7 @@ ["$." functor (#+ Injection)]]}] [data ["." maybe] - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["n" nat]]] [math @@ -38,7 +38,7 @@ (_.cover [/.size] (n.= size (/.size sample))) (_.cover [/.empty?] - (bit@= (n.= 0 (/.size sample)) + (bit\= (n.= 0 (/.size sample)) (/.empty? sample))) (_.cover [/.empty] (/.empty? /.empty)) diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux index ccd4a1d70..9224e5654 100644 --- a/stdlib/source/test/lux/data/collection/tree.lux +++ b/stdlib/source/test/lux/data/collection/tree.lux @@ -13,7 +13,7 @@ [number ["n" nat]] [collection - ["." list ("#@." functor fold)]]] + ["." list ("#\." functor fold)]]] [math ["." random (#+ Random)]]] {1 @@ -26,10 +26,10 @@ num-children (:: ! map (n.% 2) random.nat) children (random.list num-children (tree gen-value))] (wrap [(|> children - (list@map product.left) - (list@fold n.+ 1)) + (list\map product.left) + (list\fold n.+ 1)) {#/.value value - #/.children (list@map product.right children)}]))) + #/.children (list\map product.right children)}]))) (def: #export test Test @@ -63,7 +63,7 @@ (_.cover [/.branch] (:: (list.equivalence n.equivalence) = (list& value children) - (/.flatten (/.branch value (list@map /.leaf children)))))) + (/.flatten (/.branch value (list\map /.leaf children)))))) (do random.monad [expected/0 random.nat expected/1 random.nat diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index ca84d8b07..d81ff7220 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -20,8 +20,7 @@ ["." math ["." random (#+ Random)]]] {1 - ["." / (#+ Color) - ["." named]]}) + ["." / (#+ Color)]}) (def: #export color (Random Color) diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux new file mode 100644 index 000000000..609c847cf --- /dev/null +++ b/stdlib/source/test/lux/data/color/named.lux @@ -0,0 +1,240 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [data + [number + ["n" nat]] + [collection + ["." list] + ["." set]]] + [macro + ["." template]] + [math + ["." random (#+ Random)]]] + {1 + ["." / + ["/#" //]]}) + +(with-expansions [<colors> (as-is [letter/a + [/.alice-blue + /.antique-white + ## /.aqua + /.aquamarine + /.azure]] + + [letter/b + [/.beige + /.bisque + /.black + /.blanched-almond + /.blue + /.blue-violet + /.brown + /.burly-wood]] + + [letter/c + [/.cadet-blue + /.chartreuse + /.chocolate + /.coral + /.cornflower-blue + /.cornsilk + /.crimson + /.cyan]] + + [letter/d + [/.dark-blue + /.dark-cyan + /.dark-goldenrod + /.dark-gray + /.dark-green + /.dark-khaki + /.dark-magenta + /.dark-olive-green + /.dark-orange + /.dark-orchid + /.dark-red + /.dark-salmon + /.dark-sea-green + /.dark-slate-blue + /.dark-slate-gray + /.dark-turquoise + /.dark-violet + /.deep-pink + /.deep-sky-blue + /.dim-gray + /.dodger-blue]] + + [letter/f + [/.fire-brick + /.floral-white + /.forest-green + ## /.fuchsia + ]] + + [letter/g + [/.gainsboro + /.ghost-white + /.gold + /.goldenrod + /.gray + /.green + /.green-yellow]] + + [letter/h + [/.honey-dew + /.hot-pink]] + + [letter/i + [/.indian-red + /.indigo + /.ivory]] + + [letter/k + [/.khaki]] + + [letter/l + [/.lavender + /.lavender-blush + /.lawn-green + /.lemon-chiffon + /.light-blue + /.light-coral + /.light-cyan + /.light-goldenrod-yellow + /.light-gray + /.light-green + /.light-pink + /.light-salmon + /.light-sea-green + /.light-sky-blue + /.light-slate-gray + /.light-steel-blue + /.light-yellow + /.lime + /.lime-green + /.linen]] + + [letter/m + [/.magenta + /.maroon + /.medium-aquamarine + /.medium-blue + /.medium-orchid + /.medium-purple + /.medium-sea-green + /.medium-slate-blue + /.medium-spring-green + /.medium-turquoise + /.medium-violet-red + /.midnight-blue + /.mint-cream + /.misty-rose + /.moccasin]] + + [letter/n + [/.navajo-white + /.navy]] + + [letter/o + [/.old-lace + /.olive + /.olive-drab + /.orange + /.orange-red + /.orchid]] + + [letter/p + [/.pale-goldenrod + /.pale-green + /.pale-turquoise + /.pale-violet-red + /.papaya-whip + /.peach-puff + /.peru + /.pink + /.plum + /.powder-blue + /.purple]] + + [letter/r + [/.rebecca-purple + /.red + /.rosy-brown + /.royal-blue]] + + [letter/s + [/.saddle-brown + /.salmon + /.sandy-brown + /.sea-green + /.sea-shell + /.sienna + /.silver + /.sky-blue + /.slate-blue + /.slate-gray + /.snow + /.spring-green + /.steel-blue]] + + [letter/t + [/.tan + /.teal + /.thistle + /.tomato + /.turquoise]] + + [letter/v + [/.violet]] + + [letter/w + [/.wheat + /.white + /.white-smoke]] + + [letter/y + [/.yellow + /.yellow-green]] + ) + <named> (template [<definition> <by-letter>] + [((: (-> Any (List //.Color)) + (function (_ _) + (`` (list (~~ (template.splice <by-letter>)))))) + 123)] + + <colors>)] + (def: all-colors + (list.concat (list <named>))) + + (def: unique-colors + (set.from-list //.hash ..all-colors)) + + (def: verdict + (n.= (list.size ..all-colors) + (set.size ..unique-colors))) + + (template [<definition> <by-letter>] + [(def: <definition> + Test + (`` (_.cover <by-letter> + ..verdict)))] + + <colors>) + + (def: #export test + Test + (<| (_.covering /._) + (`` ($_ _.and + (~~ (template [<definition> <by-letter>] + [<definition>] + + <colors>)) + (_.cover [/.aqua] + (:: //.equivalence = /.cyan /.aqua)) + (_.cover [/.fuchsia] + (:: //.equivalence = /.magenta /.fuchsia)) + )))) + ) diff --git a/stdlib/source/test/lux/data/maybe.lux b/stdlib/source/test/lux/data/maybe.lux index 24114f6c0..139c63e4c 100644 --- a/stdlib/source/test/lux/data/maybe.lux +++ b/stdlib/source/test/lux/data/maybe.lux @@ -11,7 +11,7 @@ ["$." apply] ["$." monad]]}] [control - ["." io ("#@." monad)] + ["." io ("#\." monad)] pipe] [data ["." text] @@ -22,7 +22,7 @@ [math ["." random (#+ Random)]]] {1 - ["." / ("#@." monoid monad)]}) + ["." / ("#\." monoid monad)]}) (def: #export test Test @@ -34,11 +34,11 @@ (_.with-cover [/.monoid] ($monoid.spec (/.equivalence n.equivalence) /.monoid (random.maybe random.nat))) (_.with-cover [/.functor] - ($functor.spec /@wrap /.equivalence /.functor)) + ($functor.spec /\wrap /.equivalence /.functor)) (_.with-cover [/.apply] - ($apply.spec /@wrap /.equivalence /.apply)) + ($apply.spec /\wrap /.equivalence /.apply)) (_.with-cover [/.monad] - ($monad.spec /@wrap /.equivalence /.monad)) + ($monad.spec /\wrap /.equivalence /.monad)) (do random.monad [left random.nat @@ -47,7 +47,7 @@ (let [lift (/.lift io.monad)] (_.cover [/.with /.lift] (|> (io.run (do (/.with io.monad) - [a (lift (io@wrap left)) + [a (lift (io\wrap left)) b (wrap right)] (wrap (n.+ a b)))) (case> (#.Some actual) diff --git a/stdlib/source/test/lux/data/name.lux b/stdlib/source/test/lux/data/name.lux index bf5c6e876..e3778202c 100644 --- a/stdlib/source/test/lux/data/name.lux +++ b/stdlib/source/test/lux/data/name.lux @@ -13,7 +13,7 @@ [data [number ["n" nat]] - ["." text ("#@." equivalence)]] + ["." text ("#\." equivalence)]] [math ["." random (#+ Random)]]] {1 @@ -49,10 +49,10 @@ ($order.spec /.order (..name sizeM1 sizeS1))) (_.with-cover [/.codec] (_.and ($codec.spec /.equivalence /.codec (..name sizeM1 sizeS1)) - (let [(^open "/@.") /.codec] + (let [(^open "/\.") /.codec] (_.test "Encoding an name without a module component results in text equal to the short of the name." (if (text.empty? module1) - (text@= short1 (/@encode name1)) + (text\= short1 (/\encode name1)) #1))))) (_.cover [/.module /.short] @@ -60,16 +60,16 @@ (is? short1 (/.short name1)))) (_.with-cover [.name-of] - (let [(^open "/@.") /.equivalence] + (let [(^open "/\.") /.equivalence] ($_ _.and (_.test "Can obtain Name from identifier." - (and (/@= ["lux" "yolo"] (.name-of .yolo)) - (/@= ["test/lux/data/name" "yolo"] (.name-of ..yolo)) - (/@= ["" "yolo"] (.name-of yolo)) - (/@= ["lux/test" "yolo"] (.name-of lux/test.yolo)))) + (and (/\= ["lux" "yolo"] (.name-of .yolo)) + (/\= ["test/lux/data/name" "yolo"] (.name-of ..yolo)) + (/\= ["" "yolo"] (.name-of yolo)) + (/\= ["lux/test" "yolo"] (.name-of lux/test.yolo)))) (_.test "Can obtain Name from tag." - (and (/@= ["lux" "yolo"] (.name-of #.yolo)) - (/@= ["test/lux/data/name" "yolo"] (.name-of #..yolo)) - (/@= ["" "yolo"] (.name-of #yolo)) - (/@= ["lux/test" "yolo"] (.name-of #lux/test.yolo))))))) + (and (/\= ["lux" "yolo"] (.name-of #.yolo)) + (/\= ["test/lux/data/name" "yolo"] (.name-of #..yolo)) + (/\= ["" "yolo"] (.name-of #yolo)) + (/\= ["lux/test" "yolo"] (.name-of #lux/test.yolo))))))) ))))) diff --git a/stdlib/source/test/lux/data/number/complex.lux b/stdlib/source/test/lux/data/number/complex.lux index 091814105..13497bfa5 100644 --- a/stdlib/source/test/lux/data/number/complex.lux +++ b/stdlib/source/test/lux/data/number/complex.lux @@ -15,7 +15,7 @@ ["." int] ["f" frac]] [collection - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] ["." math ["r" random (#+ Random)]]] {1 @@ -189,7 +189,7 @@ (_.test "Can calculate the N roots for any complex number." (|> sample (/.roots degree) - (list@map (/.pow' (|> degree .int int.frac))) + (list\map (/.pow' (|> degree .int int.frac))) (list.every? (within? margin-of-error sample)))))) (def: #export test diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index 6a4130229..3ae126887 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -13,7 +13,7 @@ [number ["n" nat]] [collection - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [math ["." random]]] {1 @@ -65,7 +65,7 @@ ($_ _.and (_.cover [/.lefts] (let [actual (: (List (| Nat Nat)) - (list@map /.left expected))] + (list\map /.left expected))] (and (:: (list.equivalence n.equivalence) = expected (/.lefts actual)) @@ -74,7 +74,7 @@ (/.rights actual))))) (_.cover [/.rights] (let [actual (: (List (| Nat Nat)) - (list@map /.right expected))] + (list\map /.right expected))] (and (:: (list.equivalence n.equivalence) = expected (/.rights actual)) @@ -83,7 +83,7 @@ (/.lefts actual))))) (_.cover [/.partition] (let [[lefts rights] (|> expected - (list@map (function (_ value) + (list\map (function (_ value) (if (n.even? value) (/.left value) (/.right value)))) diff --git a/stdlib/source/test/lux/math/infix.lux b/stdlib/source/test/lux/math/infix.lux index 8085d5f98..87f1c9d57 100644 --- a/stdlib/source/test/lux/math/infix.lux +++ b/stdlib/source/test/lux/math/infix.lux @@ -5,7 +5,7 @@ ["r" math/random] ["_" test (#+ Test)] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["n" nat] ["f" frac]]]] @@ -35,11 +35,11 @@ (n.= (n.gcd extra (n.* parameter subject)) (/.infix [(n.* parameter subject) n.gcd extra]))) (_.test "Can use non-numerical functions/macros as operators." - (bit@= (and (n.< parameter subject) (n.< extra parameter)) + (bit\= (and (n.< parameter subject) (n.< extra parameter)) (/.infix [[subject n.< parameter] and [parameter n.< extra]]))) (_.test "Can combine bit operations in special ways via special keywords." - (and (bit@= (and (n.< parameter subject) (n.< extra parameter)) + (and (bit\= (and (n.< parameter subject) (n.< extra parameter)) (/.infix [#and subject n.< parameter n.< extra])) - (bit@= (and (n.< parameter subject) (n.> extra parameter)) + (bit\= (and (n.< parameter subject) (n.> extra parameter)) (/.infix [#and subject n.< parameter n.> extra])))) )))) diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index 16e9116c1..56e03277a 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -8,7 +8,7 @@ ["." random (#+ Random)]] ["_" test (#+ Test)] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["n" nat] ["r" rev]] @@ -47,11 +47,11 @@ (and (r.= //.false (/.membership bottom triangle)) (r.= //.false (/.membership top triangle)))) (_.test "Values within range, will have membership > 0." - (bit@= (r.> //.false (/.membership sample triangle)) + (bit\= (r.> //.false (/.membership sample triangle)) (and (<gt> bottom sample) (<lt> top sample)))) (_.test "Values outside of range, will have membership = 0." - (bit@= (r.= //.false (/.membership sample triangle)) + (bit\= (r.= //.false (/.membership sample triangle)) (or (<lte> bottom sample) (<gte> top sample)))) ))))] @@ -87,15 +87,15 @@ (and (r.= //.false (/.membership bottom trapezoid)) (r.= //.false (/.membership top trapezoid)))) (_.test "Values within inner range will have membership = 1" - (bit@= (r.= //.true (/.membership sample trapezoid)) + (bit\= (r.= //.true (/.membership sample trapezoid)) (and (<gte> middle-bottom sample) (<lte> middle-top sample)))) (_.test "Values within range, will have membership > 0." - (bit@= (r.> //.false (/.membership sample trapezoid)) + (bit\= (r.> //.false (/.membership sample trapezoid)) (and (<gt> bottom sample) (<lt> top sample)))) (_.test "Values outside of range, will have membership = 0." - (bit@= (r.= //.false (/.membership sample trapezoid)) + (bit\= (r.= //.false (/.membership sample trapezoid)) (or (<lte> bottom sample) (<gte> top sample)))) ))))] @@ -148,10 +148,10 @@ sample (|> random.nat (:: ! map (n.% 20)))] ($_ _.and (_.test (%.name (name-of /.from-predicate)) - (bit@= (r.= //.true (/.membership sample (/.from-predicate n.even?))) + (bit\= (r.= //.true (/.membership sample (/.from-predicate n.even?))) (n.even? sample))) (_.test (%.name (name-of /.from-set)) - (bit@= (r.= //.true (/.membership sample (/.from-set set-10))) + (bit\= (r.= //.true (/.membership sample (/.from-set set-10))) (set.member? set-10 sample))) ))) @@ -166,10 +166,10 @@ (<| (_.context (%.name (name-of /.cut))) ($_ _.and (_.test "Can increase the threshold of membership of a fuzzy set." - (bit@= (r.> //.false (/.membership sample vip-fuzzy)) + (bit\= (r.> //.false (/.membership sample vip-fuzzy)) (r.> threshold (/.membership sample fuzzy)))) (_.test "Can turn fuzzy sets into predicates through a threshold." - (bit@= (member? sample) + (bit\= (member? sample) (r.> threshold (/.membership sample fuzzy)))) )))) diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux index 96a80dc4c..27cb63f68 100644 --- a/stdlib/source/test/lux/math/modular.lux +++ b/stdlib/source/test/lux/math/modular.lux @@ -8,10 +8,10 @@ ["." try]] [data ["." product] - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["i" int]]] - ["." type ("#@." equivalence)]] + ["." type ("#\." equivalence)]] {1 ["." /]}) @@ -44,7 +44,7 @@ (-> Int Int Bit) (-> (/.Mod m) (/.Mod m) Bit))) (function (_ param subject) - (bit@= (m/? param subject) + (bit\= (m/? param subject) (i/? (value param) (value subject))))) @@ -73,11 +73,11 @@ #let [copyM (|> normalM /.to-int /.from-int try.assume)]] ($_ _.and (_.test "Every modulus has a unique type, even if the numeric value is the same as another." - (and (type@= (:of normalM) + (and (type\= (:of normalM) (:of normalM)) - (not (type@= (:of normalM) + (not (type\= (:of normalM) (:of alternativeM))) - (not (type@= (:of normalM) + (not (type\= (:of normalM) (:of copyM))))) (_.test "Can extract the original integer from the modulus." (i.= _normalM @@ -90,11 +90,11 @@ ((comparison /.> i.>) param subject) ((comparison /.>= i.>=) param subject))) (_.test "Mod'ed values are ordered." - (and (bit@= (/.< param subject) + (and (bit\= (/.< param subject) (not (/.>= param subject))) - (bit@= (/.> param subject) + (bit\= (/.> param subject) (not (/.<= param subject))) - (bit@= (/.= param subject) + (bit\= (/.= param subject) (not (or (/.< param subject) (/.> param subject)))))) (_.test "Can do arithmetic." @@ -137,6 +137,6 @@ (_.test "All numbers are congruent to themselves." (/.congruent? normalM _subject _subject)) (_.test "If 2 numbers are congruent under a modulus, then they must also be equal under the same modulus." - (bit@= (/.congruent? normalM _param _subject) + (bit\= (/.congruent? normalM _param _subject) (/.= param subject))) )))) diff --git a/stdlib/source/test/lux/time/day.lux b/stdlib/source/test/lux/time/day.lux index a654b069c..ffe896cdc 100644 --- a/stdlib/source/test/lux/time/day.lux +++ b/stdlib/source/test/lux/time/day.lux @@ -9,19 +9,19 @@ ["$." order] ["$." enum]]}] [math - ["r" random (#+ Random) ("#@." monad)]]] + ["r" random (#+ Random) ("#\." monad)]]] {1 ["." / (#+ Day)]}) (def: #export day (Random Day) - (r.either (r.either (r.either (r@wrap #/.Sunday) - (r@wrap #/.Monday)) - (r.either (r@wrap #/.Tuesday) - (r@wrap #/.Wednesday))) - (r.either (r.either (r@wrap #/.Thursday) - (r@wrap #/.Friday)) - (r@wrap #/.Saturday)))) + (r.either (r.either (r.either (r\wrap #/.Sunday) + (r\wrap #/.Monday)) + (r.either (r\wrap #/.Tuesday) + (r\wrap #/.Wednesday))) + (r.either (r.either (r\wrap #/.Thursday) + (r\wrap #/.Friday)) + (r\wrap #/.Saturday)))) (def: #export test Test diff --git a/stdlib/source/test/lux/time/month.lux b/stdlib/source/test/lux/time/month.lux index 180bdb604..1ebd3810c 100644 --- a/stdlib/source/test/lux/time/month.lux +++ b/stdlib/source/test/lux/time/month.lux @@ -9,24 +9,24 @@ ["$." order] ["$." enum]]}] [math - ["r" random (#+ Random) ("#@." monad)]]] + ["r" random (#+ Random) ("#\." monad)]]] {1 ["." / (#+ Month)]}) (def: #export month (Random Month) - (r.either (r.either (r.either (r@wrap #/.January) - (r.either (r@wrap #/.February) - (r@wrap #/.March))) - (r.either (r@wrap #/.April) - (r.either (r@wrap #/.May) - (r@wrap #/.June)))) - (r.either (r.either (r@wrap #/.July) - (r.either (r@wrap #/.August) - (r@wrap #/.September))) - (r.either (r@wrap #/.October) - (r.either (r@wrap #/.November) - (r@wrap #/.December)))))) + (r.either (r.either (r.either (r\wrap #/.January) + (r.either (r\wrap #/.February) + (r\wrap #/.March))) + (r.either (r\wrap #/.April) + (r.either (r\wrap #/.May) + (r\wrap #/.June)))) + (r.either (r.either (r\wrap #/.July) + (r.either (r\wrap #/.August) + (r\wrap #/.September))) + (r.either (r\wrap #/.October) + (r.either (r\wrap #/.November) + (r\wrap #/.December)))))) (def: #export test Test |