diff options
author | Eduardo Julian | 2020-10-31 02:59:48 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-10-31 02:59:48 -0400 |
commit | eea741e9b4a47ae09832311d6d61f0bd6024f673 (patch) | |
tree | 9d503f609c322c235811856ffa05232991b9c653 /stdlib/source/test | |
parent | cb8f2b36352948108446c7e3b270faa97589bf7a (diff) |
Easy to use Rev constants.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/aedifex.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/artifact.lux | 20 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/local.lux | 36 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/set.lux | 136 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/format/json.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/format/tar.lux | 28 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/format/xml.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/name.lux | 10 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/number.lux | 29 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/number/rev.lux | 18 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/sum.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text.lux | 22 | ||||
-rw-r--r-- | stdlib/source/test/lux/host.jvm.lux | 12 | ||||
-rw-r--r-- | stdlib/source/test/lux/meta/annotation.lux | 28 | ||||
-rw-r--r-- | stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux | 52 |
15 files changed, 278 insertions, 135 deletions
diff --git a/stdlib/source/test/aedifex.lux b/stdlib/source/test/aedifex.lux index fd92d9b40..c40939b47 100644 --- a/stdlib/source/test/aedifex.lux +++ b/stdlib/source/test/aedifex.lux @@ -10,6 +10,7 @@ ["#." input] ["#." command #_ ["#/." pom]] + ["#." local] ["#." dependency] ["#." profile] ["#." project] @@ -24,6 +25,7 @@ /artifact.test /input.test /command/pom.test + /local.test /dependency.test /profile.test /project.test diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux index 376f26717..9a4607306 100644 --- a/stdlib/source/test/aedifex/artifact.lux +++ b/stdlib/source/test/aedifex/artifact.lux @@ -7,8 +7,17 @@ {[0 #spec] [/ ["$." equivalence]]}] + [control + [concurrency + [promise (#+ Promise)]]] + [data + ["." text ("#@." equivalence)]] [math - ["." random (#+ Random)]]] + ["." random (#+ Random)]] + [world + ["." file] + [net + ["." uri]]]] ["." / #_ ["#." type] ["#." extension]] @@ -31,6 +40,15 @@ (_.with-cover [/.equivalence] ($equivalence.spec /.equivalence ..random)) + (do random.monad + [sample ..random + #let [fs (: (file.System Promise) + (file.mock (:: file.default separator)))]] + (_.cover [/.uri /.path] + (|> (/.path fs sample) + (text.replace-all uri.separator (:: fs separator)) + (text@= (/.uri sample))))) + /type.test /extension.test )))) diff --git a/stdlib/source/test/aedifex/local.lux b/stdlib/source/test/aedifex/local.lux new file mode 100644 index 000000000..a883f565e --- /dev/null +++ b/stdlib/source/test/aedifex/local.lux @@ -0,0 +1,36 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [control + [concurrency + [promise (#+ Promise)]]] + [data + ["." text]] + [math + ["." random (#+ Random)]] + [world + ["." file]]] + [// + ["@." artifact]] + {#program + ["." / + ["/#" // #_ + ["#." artifact]]]}) + +(def: #export test + Test + (<| (_.covering /._) + (do {@ random.monad} + [sample @artifact.random + #let [fs (: (file.System Promise) + (file.mock (:: file.default separator)))]] + ($_ _.and + (_.cover [/.repository /.path] + (let [path (/.path fs sample)] + (and (text.starts-with? (/.repository fs) + path) + (text.ends-with? (//artifact.path fs sample) + path)))) + )))) diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index 993082e79..93549712f 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -9,66 +9,108 @@ ["$." equivalence] ["$." monoid]]}] [data + ["." bit ("#@." equivalence)] [number ["n" nat]] [collection ["." list]]] [math - ["r" random]]] + ["." random (#+ Random)]]] {1 ["." /]}) (def: gen-nat - (r.Random Nat) - (|> r.nat - (:: r.monad map (n.% 100)))) + (Random Nat) + (:: random.monad map (n.% 100) + random.nat)) (def: #export test Test - (<| (_.context (%.name (name-of /.Set))) - (do r.monad - [size gen-nat] + (<| (_.covering /._) + (_.with-cover [/.Set]) + (let [(^open "/@.") /.equivalence]) + (do random.monad + [size ..gen-nat] ($_ _.and - ($equivalence.spec /.equivalence (r.set n.hash size r.nat)) - ($monoid.spec /.equivalence (/.monoid n.hash) (r.set n.hash size r.nat)) + (_.with-cover [/.equivalence] + ($equivalence.spec /.equivalence (random.set n.hash size random.nat))) + (_.with-cover [/.monoid] + ($monoid.spec /.equivalence (/.monoid n.hash) (random.set n.hash size random.nat))) - (do r.monad - [sizeL gen-nat - sizeR gen-nat - setL (r.set n.hash sizeL gen-nat) - setR (r.set n.hash sizeR gen-nat) - non-member (|> gen-nat - (r.filter (|>> (/.member? setL) not))) - #let [(^open "/@.") /.equivalence]] + (do random.monad + [sizeL ..gen-nat + sizeR ..gen-nat + setL (random.set n.hash sizeL random.nat) + setR (random.set n.hash sizeR random.nat) + non-memberL (random.filter (|>> (/.member? setL) not) + random.nat)] ($_ _.and - (_.test "I can query the size of a set." - (and (n.= sizeL (/.size setL)) - (n.= sizeR (/.size setR)))) - (_.test "Converting sets to/from lists can't change their values." - (|> setL - /.to-list (/.from-list n.hash) - (/@= setL))) - (_.test "Every set is a sub-set of the union of itself with another." - (let [setLR (/.union setL setR)] - (and (/.sub? setLR setL) - (/.sub? setLR setR)))) - (_.test "Every set is a super-set of the intersection of itself with another." - (let [setLR (/.intersection setL setR)] - (and (/.super? setLR setL) - (/.super? setLR setR)))) - (_.test "Union with the empty set leaves a set unchanged." - (/@= setL - (/.union (/.new n.hash) - setL))) - (_.test "Intersection with the empty set results in the empty set." - (let [empty-set (/.new n.hash)] - (/@= empty-set - (/.intersection empty-set setL)))) - (_.test "After substracting a set A from another B, no member of A can be a member of B." - (let [sub (/.difference setR setL)] - (not (list.any? (/.member? sub) (/.to-list setR))))) - (_.test "Every member of a set must be identifiable." - (and (not (/.member? setL non-member)) - (/.member? (/.add non-member setL) non-member) - (not (/.member? (/.remove non-member (/.add non-member setL)) non-member)))) + (_.cover [/.size] + (n.= sizeL (/.size setL))) + (_.cover [/.empty?] + (bit@= (/.empty? setL) + (n.= 0 (/.size setL)))) + (_.cover [/.to-list /.from-list] + (|> setL /.to-list (/.from-list n.hash) (/@= setL))) + (_.cover [/.member?] + (and (list.every? (/.member? setL) (/.to-list setL)) + (not (/.member? setL non-memberL)))) + (_.cover [/.add] + (let [before-addition! + (not (/.member? setL non-memberL)) + + after-addition! + (/.member? (/.add non-memberL setL) non-memberL) + + size-increase! + (n.= (inc (/.size setL)) + (/.size (/.add non-memberL setL)))] + (and before-addition! + after-addition!))) + (_.cover [/.remove] + (let [symmetry! + (|> setL + (/.add non-memberL) + (/.remove non-memberL) + (/@= setL)) + + idempotency! + (|> setL + (/.remove non-memberL) + (/@= setL))] + (and symmetry! + idempotency!))) + (_.cover [/.union /.sub?] + (let [setLR (/.union setL setR) + + sets-are-subs-of-their-unions! + (and (/.sub? setLR setL) + (/.sub? setLR setR)) + + union-with-empty-set! + (|> setL + (/.union (/.new n.hash)) + (/@= setL))] + (and sets-are-subs-of-their-unions! + union-with-empty-set!))) + (_.cover [/.intersection /.super?] + (let [setLR (/.intersection setL setR) + + sets-are-supers-of-their-intersections! + (and (/.super? setLR setL) + (/.super? setLR setR)) + + intersection-with-empty-set! + (|> setL + (/.intersection (/.new n.hash)) + /.empty?)] + (and sets-are-supers-of-their-intersections! + intersection-with-empty-set!))) + (_.cover [/.difference] + (let [setL+R (/.union setR setL) + setL-R (/.difference setR setL+R)] + (and (list.every? (/.member? setL+R) (/.to-list setR)) + (not (list.any? (/.member? setL-R) (/.to-list setR)))))) + (_.cover [/.predicate] + (list.every? (/.predicate setL) (/.to-list setL))) )))))) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 548dbebdd..c1341aae0 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -47,10 +47,10 @@ (def: #export json (Random JSON) (r.rec (function (_ recur) - (do {@ r.monad} - [size (:: @ map (n.% 2) r.nat)] + (do {! r.monad} + [size (:: ! map (n.% 2) r.nat)] ($_ r.or - (:: @ wrap []) + (:: ! wrap []) r.bit r.safe-frac (r.unicode size) diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 17f18e005..0e274a6e6 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -35,7 +35,7 @@ (def: path Test (_.with-cover [/.Path] - (do {@ random.monad} + (do {! random.monad} [expected (random.ascii/lower-alpha /.path-size) invalid (random.ascii/lower-alpha (inc /.path-size)) not-ascii (random.text (random.char (unicode.set [unicode.katakana (list)])) @@ -68,7 +68,7 @@ (def: name Test (_.with-cover [/.Name] - (do {@ random.monad} + (do {! random.monad} [expected (random.ascii/lower-alpha /.name-size) invalid (random.ascii/lower-alpha (inc /.name-size)) not-ascii (random.text (random.char (unicode.set [unicode.katakana (list)])) @@ -101,9 +101,9 @@ (def: small Test (_.with-cover [/.Small] - (do {@ random.monad} - [expected (|> random.nat (:: @ map (n.% /.small-limit))) - invalid (|> random.nat (:: @ map (n.max /.small-limit)))] + (do {! random.monad} + [expected (|> random.nat (:: ! map (n.% /.small-limit))) + invalid (|> random.nat (:: ! map (n.max /.small-limit)))] (`` ($_ _.and (_.cover [/.small /.from-small] (case (/.small expected) @@ -125,9 +125,9 @@ (def: big Test (_.with-cover [/.Big] - (do {@ random.monad} - [expected (|> random.nat (:: @ map (n.% /.big-limit))) - invalid (|> random.nat (:: @ map (n.max /.big-limit)))] + (do {! random.monad} + [expected (|> random.nat (:: ! map (n.% /.big-limit))) + invalid (|> random.nat (:: ! map (n.max /.big-limit)))] (`` ($_ _.and (_.cover [/.big /.from-big] (case (/.big expected) @@ -150,12 +150,12 @@ (def: entry Test - (do {@ random.monad} + (do {! random.monad} [expected-path (random.ascii/lower-alpha (dec /.path-size)) - expected-moment (:: @ map (|>> (n.% 1,0,00,00,00,00,000) .int instant.from-millis) + expected-moment (:: ! map (|>> (n.% 1,0,00,00,00,00,000) .int instant.from-millis) random.nat) chunk (random.ascii/lower-alpha chunk-size) - chunks (:: @ map (n.% 100) random.nat) + chunks (:: ! map (n.% 100) random.nat) #let [content (|> chunk (list.repeat chunks) (text.join-with "") @@ -218,7 +218,7 @@ (def: random-mode (Random /.Mode) - (do {@ random.monad} + (do {! random.monad} [] (random.either (random.either (random.either (wrap /.execute-by-other) (wrap /.write-by-other)) @@ -236,7 +236,7 @@ (def: mode Test (_.with-cover [/.Mode /.mode] - (do {@ random.monad} + (do {! random.monad} [path (random.ascii/lower-alpha 10) modes (random.list 4 ..random-mode) #let [expected-mode (list@fold /.and /.none modes)]] @@ -308,7 +308,7 @@ (def: ownership Test - (do {@ random.monad} + (do {! random.monad} [path (random.ascii/lower-alpha /.path-size) expected (random.ascii/lower-alpha /.name-size) invalid (random.ascii/lower-alpha (inc /.name-size)) diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index 6cf842827..e0a1a5c05 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -35,8 +35,8 @@ (def: char (Random Nat) - (do {@ r.monad} - [idx (|> r.nat (:: @ map (n.% (text.size char-range))))] + (do {! r.monad} + [idx (|> r.nat (:: ! map (n.% (text.size char-range))))] (wrap (maybe.assume (text.nth idx char-range))))) (def: (size bottom top) @@ -73,9 +73,9 @@ ($equivalence.spec /.equivalence ..xml) ($codec.spec /.equivalence /.codec ..xml) - (do {@ r.monad} + (do {! r.monad} [text (..text 1 10) - num-children (|> r.nat (:: @ map (n.% 5))) + num-children (|> r.nat (:: ! map (n.% 5))) children (r.list num-children (..text 1 10)) tag xml-identifier^ attribute xml-identifier^ diff --git a/stdlib/source/test/lux/data/name.lux b/stdlib/source/test/lux/data/name.lux index 836f75aa1..bf5c6e876 100644 --- a/stdlib/source/test/lux/data/name.lux +++ b/stdlib/source/test/lux/data/name.lux @@ -32,14 +32,14 @@ (def: #export test Test (<| (_.covering /._) - (do {@ random.monad} + (do {! random.monad} [## First Name - sizeM1 (|> random.nat (:: @ map (n.% 100))) - sizeS1 (|> random.nat (:: @ map (|>> (n.% 100) (n.max 1)))) + sizeM1 (|> random.nat (:: ! map (n.% 100))) + sizeS1 (|> random.nat (:: ! map (|>> (n.% 100) (n.max 1)))) (^@ name1 [module1 short1]) (..name sizeM1 sizeS1) ## Second Name - sizeM2 (|> random.nat (:: @ map (n.% 100))) - sizeS2 (|> random.nat (:: @ map (|>> (n.% 100) (n.max 1)))) + sizeM2 (|> random.nat (:: ! map (n.% 100))) + sizeS2 (|> random.nat (:: ! map (|>> (n.% 100) (n.max 1)))) (^@ name2 [module2 short2]) (..name sizeM2 sizeS2)] (_.with-cover [.Name] ($_ _.and diff --git a/stdlib/source/test/lux/data/number.lux b/stdlib/source/test/lux/data/number.lux index 876cf4c4d..d8b0ad3bf 100644 --- a/stdlib/source/test/lux/data/number.lux +++ b/stdlib/source/test/lux/data/number.lux @@ -12,12 +12,38 @@ ["r" rev] ["f" frac]]]] {1 - ["." /]}) + ["." /]} + ["." / #_ + ["#." i8] + ["#." i16] + ["#." i32] + ["#." i64] + ["#." nat] + ["#." int] + ["#." rev] + ["#." frac] + ["#." ratio] + ["#." complex]]) (def: clean-commas (-> Text Text) (text.replace-all "," "")) +(def: sub + Test + ($_ _.and + /i8.test + /i16.test + /i32.test + /i64.test + /nat.test + /int.test + /rev.test + /frac.test + /ratio.test + /complex.test + )) + (def: #export test Test (<| (_.covering /._) @@ -85,4 +111,5 @@ [f.= f.hex "+dead.BEEF"] [f.= f.hex "-dead,BE.EF"] ))))) + ..sub ))) diff --git a/stdlib/source/test/lux/data/number/rev.lux b/stdlib/source/test/lux/data/number/rev.lux index dfb484fc8..90a29c6d3 100644 --- a/stdlib/source/test/lux/data/number/rev.lux +++ b/stdlib/source/test/lux/data/number/rev.lux @@ -48,4 +48,22 @@ (oct ".615,243")) (/.= (hex ".deadBEEF") (hex ".dead,BEEF")))) + (~~ (template [<half> <whole>] + [(_.cover [<half>] + (/.= <whole> + (/.+ <half> <half>)))] + + [/./2 .0] + [/./4 /./2] + [/./8 /./4] + [/./16 /./8] + [/./32 /./16] + [/./64 /./32] + [/./128 /./64] + [/./256 /./128] + [/./512 /./256] + [/./1024 /./512] + [/./2048 /./1024] + [/./4096 /./2048] + )) )))) diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index 3bbf65bc9..6a4130229 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -23,7 +23,7 @@ Test (<| (_.covering /._) (_.with-cover [.|]) - (do {@ random.monad} + (do {! random.monad} [expected random.nat shift random.nat]) ($_ _.and @@ -59,8 +59,8 @@ (: (| Nat Nat)) (/.each (n.+ shift) (n.- shift)) (case> (0 #1 actual) (n.= (n.- shift expected) actual) _ false)))) - (do @ - [size (:: @ map (n.% 5) random.nat) + (do ! + [size (:: ! map (n.% 5) random.nat) expected (random.list size random.nat)] ($_ _.and (_.cover [/.lefts] diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 6fbee6ec5..5a6b2e4bb 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -29,8 +29,8 @@ (def: size Test - (do {@ random.monad} - [size (:: @ map (n.% 10) random.nat) + (do {! random.monad} + [size (:: ! map (n.% 10) random.nat) sample (random.unicode size)] ($_ _.and (_.cover [/.size] @@ -41,7 +41,7 @@ (def: affix Test - (do {@ random.monad} + (do {! random.monad} [inner (random.unicode 1) outer (random.filter (|>> (:: /.equivalence = inner) not) (random.unicode 1)) @@ -70,7 +70,7 @@ (def: index Test - (do {@ random.monad} + (do {! random.monad} [inner (random.unicode 1) outer (random.filter (|>> (:: /.equivalence = inner) not) (random.unicode 1)) @@ -154,11 +154,11 @@ (_.cover [/.line-feed] (:: /.equivalence = /.new-line /.line-feed)) ))) - (do {@ random.monad} - [size (:: @ map (|>> (n.% 10) inc) random.nat) + (do {! random.monad} + [size (:: ! map (|>> (n.% 10) inc) random.nat) characters (random.set /.hash size (random.ascii/alpha 1)) #let [sample (|> characters set.to-list /.concat)] - expected (:: @ map (n.% size) random.nat)] + expected (:: ! map (n.% size) random.nat)] (_.cover [/.nth] (case (/.nth expected sample) (#.Some char) @@ -186,8 +186,8 @@ (def: manipulation Test - (do {@ random.monad} - [size (:: @ map (|>> (n.% 10) (n.+ 2)) random.nat) + (do {! random.monad} + [size (:: ! map (|>> (n.% 10) (n.+ 2)) random.nat) characters (random.set /.hash size (random.ascii/alpha 1)) separator (random.filter (|>> (set.member? characters) not) (random.ascii/alpha 1)) @@ -274,13 +274,13 @@ _ #0))) )) - (do {@ random.monad} + (do {! random.monad} [sizeP bounded-size sizeL bounded-size #let [## The wider unicode charset includes control characters that ## can make text replacement work improperly. ## Because of that, I restrict the charset. - normal-char-gen (|> random.nat (:: @ map (|>> (n.% 128) (n.max 1))))] + normal-char-gen (|> random.nat (:: ! map (|>> (n.% 128) (n.max 1))))] sep1 (random.text normal-char-gen 1) sep2 (random.text normal-char-gen 1) #let [part-gen (|> (random.text normal-char-gen sizeP) diff --git a/stdlib/source/test/lux/host.jvm.lux b/stdlib/source/test/lux/host.jvm.lux index d5b44b481..355be630f 100644 --- a/stdlib/source/test/lux/host.jvm.lux +++ b/stdlib/source/test/lux/host.jvm.lux @@ -93,8 +93,8 @@ (def: miscellaneous Test - (do {@ r.monad} - [sample (:: @ map (|>> (:coerce java/lang/Object)) + (do {! r.monad} + [sample (:: ! map (|>> (:coerce java/lang/Object)) (r.ascii 1))] ($_ _.and (_.test "Can check if an object is of a certain class." @@ -124,10 +124,10 @@ (def: arrays Test - (do {@ r.monad} - [size (|> r.nat (:: @ map (|>> (n.% 100) (n.max 1)))) - idx (|> r.nat (:: @ map (n.% size))) - value (:: @ map (|>> (:coerce java/lang/Long)) r.int)] + (do {! r.monad} + [size (|> r.nat (:: ! map (|>> (n.% 100) (n.max 1)))) + idx (|> r.nat (:: ! map (n.% size))) + value (:: ! map (|>> (:coerce java/lang/Long)) r.int)] ($_ _.and (_.test "Can create arrays of some length." (n.= size (/.array-length (/.array java/lang/Long size)))) diff --git a/stdlib/source/test/lux/meta/annotation.lux b/stdlib/source/test/lux/meta/annotation.lux index f8f569bde..f0ff06160 100644 --- a/stdlib/source/test/lux/meta/annotation.lux +++ b/stdlib/source/test/lux/meta/annotation.lux @@ -35,14 +35,14 @@ (def: (random-sequence random) (All [a] (-> (Random a) (Random (List a)))) - (do {@ random.monad} - [size (|> random.nat (:: @ map (nat.% 3)))] + (do {! random.monad} + [size (|> random.nat (:: ! map (nat.% 3)))] (random.list size random))) (def: (random-record random) (All [a] (-> (Random a) (Random (List [a a])))) - (do {@ random.monad} - [size (|> random.nat (:: @ map (nat.% 3)))] + (do {! random.monad} + [size (|> random.nat (:: ! map (nat.% 3)))] (random.list size (random.and random random)))) (template: (!expect <pattern> <value>) @@ -57,11 +57,11 @@ (def: typed-value Test - (do {@ random.monad} + (do {! random.monad} [key ..random-key] (`` ($_ _.and (~~ (template [<definition> <random> <constructor> <equivalence>] - [(do {@ random.monad} + [(do {! random.monad} [expected <random>] (_.cover [<definition>] (|> expected <constructor> @@ -86,10 +86,10 @@ (def: flag Test - (do {@ random.monad} + (do {! random.monad} [key ..random-key] (`` ($_ _.and - (do {@ random.monad} + (do ! [dummy ..random-key expected random.bit] (_.cover [/.flagged?] @@ -101,7 +101,7 @@ (..annotation dummy) (/.flagged? key)))))) (~~ (template [<definition> <tag>] - [(do {@ random.monad} + [(do ! [expected random.bit] (_.cover [<definition>] (and (|> expected code.bit @@ -120,11 +120,11 @@ (def: arguments Test - (do {@ random.monad} + (do {! random.monad} [key ..random-key] (`` ($_ _.and (~~ (template [<definition> <tag>] - [(do {@ random.monad} + [(do ! [expected (random.list 5 (random.ascii/alpha 1))] (_.cover [<definition>] (and (|> expected (list@map code.text) code.tuple @@ -145,10 +145,10 @@ Test (<| (_.covering /._) (_.with-cover [/.Annotation]) - (do {@ random.monad} + (do {! random.monad} [key ..random-key] ($_ _.and - (do {@ random.monad} + (do ! [expected _code.random] (_.cover [/.value] (|> expected @@ -159,7 +159,7 @@ ..typed-value - (do {@ random.monad} + (do ! [expected (random.ascii/alpha 10)] (_.cover [/.documentation] (and (not (|> expected code.text diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index e42e139d1..2667eedac 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -30,14 +30,14 @@ (Scenario Synthesis) (`` ($_ random.either (~~ (template [<synthesis> <random>] - [(do {@ random.monad} - [example (:: @ map (|>> <synthesis>) <random>)] + [(do {! random.monad} + [example (:: ! map (|>> <synthesis>) <random>)] (wrap [next [example example]]))] [//.bit random.bit] - [//.i64 (:: @ map .i64 random.nat)] + [//.i64 (:: ! map .i64 random.nat)] [//.f64 random.frac] [//.text (random.unicode 1)] )) @@ -54,8 +54,8 @@ (def: (variable offset arity next) (Scenario Variable) - (let [local (do {@ random.monad} - [register (:: @ map (|>> (n.% arity) inc) random.nat)] + (let [local (do {! random.monad} + [register (:: ! map (|>> (n.% arity) inc) random.nat)] (wrap [next [(#variable.Local (/.register-optimization offset register)) (#variable.Local register)]]))] @@ -63,8 +63,8 @@ 0 local _ ($_ random.either local - (do {@ random.monad} - [foreign (:: @ map (n.% offset) random.nat)] + (do {! random.monad} + [foreign (:: ! map (n.% offset) random.nat)] (wrap [next [(#variable.Local foreign) (#variable.Foreign foreign)]])))))) @@ -73,7 +73,7 @@ (Scenario Synthesis) (`` ($_ random.either (~~ (template [<tag> <random>] - [(do {@ random.monad} + [(do {! random.monad} [[next [exampleE exampleA]] (<random> offset arity next)] (wrap [next [(<tag> exampleE) @@ -86,7 +86,7 @@ (def: (structure offset arity next) (Scenario Synthesis) ($_ random.either - (do {@ random.monad} + (do {! random.monad} [lefts random.nat right? random.bit [next [valueE valueA]] (..reference offset arity next)] @@ -99,7 +99,7 @@ {#analysis.lefts lefts #analysis.right? right? #analysis.value valueA})]])) - (do {@ random.monad} + (do {! random.monad} [[next [leftE leftA]] (..reference offset arity next) [next [rightE rightA]] (..reference offset arity next)] (wrap [next @@ -116,20 +116,20 @@ [//.path/pop //.path/pop]]) (~~ (template [<path> <random>] - [(do {@ random.monad} - [example (:: @ map (|>> <path>) <random>)] + [(do {! random.monad} + [example (:: ! map (|>> <path>) <random>)] (wrap [next [example example]]))] [//.path/bit random.bit] - [//.path/i64 (:: @ map .i64 random.nat)] + [//.path/i64 (:: ! map .i64 random.nat)] [//.path/f64 random.frac] [//.path/text (random.unicode 1)] )) (~~ (template [<path>] - [(do {@ random.monad} - [example (:: @ map (|>> <path>) + [(do {! random.monad} + [example (:: ! map (|>> <path>) (random.or random.nat random.nat))] (wrap [next @@ -166,13 +166,13 @@ random.nat))] ($_ random.either ($_ random.either - (do {@ random.monad} + (do {! random.monad} [[next [inputE inputA]] (..reference offset arity next) [next [bodyE bodyA]] (..reference offset arity next)] (wrap [next [(//.branch/let [inputE (/.register-optimization offset next) bodyE]) (//.branch/let [inputA next bodyA])]])) - (do {@ random.monad} + (do {! random.monad} [[next [testE testA]] (..reference offset arity next) [next [thenE thenA]] (..reference offset arity next) [next [elseE elseA]] (..reference offset arity next)] @@ -180,14 +180,14 @@ [(//.branch/if [testE thenE elseE]) (//.branch/if [testA thenA elseA])]]))) ($_ random.either - (do {@ random.monad} + (do {! random.monad} [[next [recordE recordA]] (..reference offset arity next) - path-length (:: @ map (|>> (n.% 5) inc) random.nat) + path-length (:: ! map (|>> (n.% 5) inc) random.nat) path (random.list path-length random-member)] (wrap [next [(//.branch/get [path recordE]) (//.branch/get [path recordA])]])) - (do {@ random.monad} + (do {! random.monad} [[next [inputE inputA]] (..reference offset arity next) [next [pathE pathA]] (..path offset arity next)] (wrap [next @@ -216,10 +216,10 @@ (def: (function offset arity next) (Scenario Synthesis) ($_ random.either - (do {@ random.monad} + (do {! random.monad} [[next [firstE firstA]] (..variable offset arity next) [next [secondE secondA]] (..variable offset arity next) - arity (:: @ map (n.max 1) random.nat) + arity (:: ! map (n.max 1) random.nat) [next [bodyE bodyA]] (..primitive 0 arity next)] (wrap [next [(//.function/abstraction @@ -265,11 +265,11 @@ Test (<| (_.covering /._) ($_ _.and - (do {@ random.monad} - [expected-offset (:: @ map (|>> (n.% 5) (n.+ 2)) random.nat) - arity (:: @ map (|>> (n.% 5) inc) random.nat) + (do {! random.monad} + [expected-offset (:: ! map (|>> (n.% 5) (n.+ 2)) random.nat) + arity (:: ! map (|>> (n.% 5) inc) random.nat) expected-inits (|> random.nat - (:: @ map (|>> .i64 //.i64)) + (:: ! map (|>> .i64 //.i64)) (random.list arity)) [_ [expected iteration]] (..scenario expected-offset arity 0)] (_.cover [/.Transform /.optimization /.register-optimization] |