aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data
diff options
context:
space:
mode:
authorEduardo Julian2022-03-08 05:06:57 -0400
committerEduardo Julian2022-03-08 05:06:57 -0400
commitbf0562d72b7d42be2b378a7f312fe48ac1f4284c (patch)
treea77566d968c29284408f46db6aa9fc7c84ff62aa /stdlib/source/test/lux/data
parent2ac6926be617bf764c4c18a4f6fbba199f6be697 (diff)
Finishing the meta-compiler [Part 6 / Done... for now]
Diffstat (limited to 'stdlib/source/test/lux/data')
-rw-r--r--stdlib/source/test/lux/data/sum.lux53
1 files changed, 24 insertions, 29 deletions
diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux
index 73ffe0e21..2aa3c5058 100644
--- a/stdlib/source/test/lux/data/sum.lux
+++ b/stdlib/source/test/lux/data/sum.lux
@@ -1,24 +1,25 @@
(.using
- [library
- [lux "*"
- ["_" test {"+" Test}]
- [abstract
- [monad {"+" do}]
- [\\specification
- ["$[0]" equivalence]]]
- [control
- pipe]
- [data
- ["[0]" text]
- [collection
- ["[0]" list ("[1]#[0]" functor)]]]
- [math
- ["[0]" random]
- [number
- ["n" nat]
- ["i" int]]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]
+ [\\specification
+ ["$[0]" equivalence]
+ ["$[0]" hash]]]
+ [control
+ pipe]
+ [data
+ ["[0]" text]
+ [collection
+ ["[0]" list ("[1]#[0]" functor)]]]
+ [math
+ ["[0]" random]
+ [number
+ ["n" nat]
+ ["i" int]]]]]
+ [\\library
+ ["[0]" /]])
(def: .public test
Test
@@ -31,15 +32,9 @@
(_.for [/.equivalence]
($equivalence.spec (/.equivalence n.equivalence n.equivalence)
(random.or random.nat random.nat)))
- (do random.monad
- [left random.int
- right random.nat]
- (_.cover [/.hash]
- (let [hash (/.hash i.hash n.hash)]
- (and (n.= (# i.hash hash left)
- (# hash hash {.#Left left}))
- (n.= (# n.hash hash right)
- (# hash hash {.#Right right}))))))
+ (_.for [/.hash]
+ ($hash.spec (/.hash n.hash n.hash)
+ (random.or random.nat random.nat)))
(_.cover [/.left]
(|> (/.left expected)