aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/collection/tree/rose.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/data/collection/tree/rose.lux16
1 files changed, 12 insertions, 4 deletions
diff --git a/stdlib/source/test/lux/data/collection/tree/rose.lux b/stdlib/source/test/lux/data/collection/tree/rose.lux
index 383e250b5..987a72f45 100644
--- a/stdlib/source/test/lux/data/collection/tree/rose.lux
+++ b/stdlib/source/test/lux/data/collection/tree/rose.lux
@@ -28,20 +28,28 @@
1
singleton
+
+ 2
+ (do r.monad
+ [value gen-value
+ single (tree 1 gen-value)]
+ (wrap (/.branch value (list single))))
_
(do r.monad
[value gen-value
- children (r.list (n/+ 2 (n/% 2 size))
- (tree (n// 2 size) gen-value))]
- (wrap (/.branch value children)))
+ #let [size (dec size)]
+ left (tree (n// 2 size) gen-value)
+ right (tree (n/+ (n/% 2 size) (n// 2 size))
+ gen-value)]
+ (wrap (/.branch value (list left right))))
)))
(def: #export test
Test
(<| (_.context (%name (name-of /.Tree)))
(do r.monad
- [size (:: @ map (|>> (n/% 100) (n/max 10)) r.nat)]
+ [size (:: @ map (|>> (n/% 100) (n/+ 1)) r.nat)]
($_ _.and
($equivalence.spec (/.equivalence nat.equivalence) (..tree size r.nat))
($fold.spec /.leaf /.equivalence /.fold)