aboutsummaryrefslogtreecommitdiff
path: root/stdlib/test
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/test')
-rw-r--r--stdlib/test/test/lux/control/region.lux2
-rw-r--r--stdlib/test/test/lux/data/coll/list.lux33
2 files changed, 23 insertions, 12 deletions
diff --git a/stdlib/test/test/lux/control/region.lux b/stdlib/test/test/lux/control/region.lux
index a7a577ab5..fc1eb7edf 100644
--- a/stdlib/test/test/lux/control/region.lux
+++ b/stdlib/test/test/lux/control/region.lux
@@ -26,7 +26,7 @@
(context: "Regions."
(<| (times +100)
(do @
- [expected-clean-ups (|> r.nat (:: @ map (n/% +100)))]
+ [expected-clean-ups (|> r.nat (:: @ map (|>> (n/% +100) (n/max +1))))]
($_ seq
(test "Clean-up functions are always run when region execution is done."
(thread.run
diff --git a/stdlib/test/test/lux/data/coll/list.lux b/stdlib/test/test/lux/data/coll/list.lux
index 729519823..578b652da 100644
--- a/stdlib/test/test/lux/data/coll/list.lux
+++ b/stdlib/test/test/lux/data/coll/list.lux
@@ -132,6 +132,8 @@
other-size bounded-size
other-sample (r.list other-size r.nat)
separator r.nat
+ from (|> r.nat (:: @ map (n/% +10)))
+ to (|> r.nat (:: @ map (n/% +10)))
#let [(^open) (&.Eq<List> number.Eq<Nat>)
(^open "&/") &.Functor<List>]]
($_ seq
@@ -208,17 +210,26 @@
(&/map product.left enum-sample))
(= sample
(&/map product.right enum-sample)))))
+
+ (test "Ranges can be constructed forward and backwards."
+ (and (let [(^open "list/") (&.Eq<List> number.Eq<Nat>)]
+ (list/= (&.n/range from to)
+ (&.reverse (&.n/range to from))))
+ (let [(^open "list/") (&.Eq<List> number.Eq<Int>)
+ from (nat-to-int from)
+ to (nat-to-int to)]
+ (list/= (&.i/range from to)
+ (&.reverse (&.i/range to from))))))
))))
## TODO: Add again once new-luxc becomes the standard compiler.
-## (context: "Monad transformer"
-## (let [lift (&.lift io.Monad<IO>)
-## (^open "io/") io.Monad<IO>]
-## (test "Can add list functionality to any monad."
-## (|> (io.run (do (&.ListT io.Monad<IO>)
-## [a (lift (io/wrap 123))
-## b (wrap 456)]
-## (wrap (i/+ a b))))
-## (case> (^ (list 579)) true
-## _ false)))
-## ))
+(context: "Monad transformer"
+ (let [lift (&.lift io.Monad<IO>)
+ (^open "io/") io.Monad<IO>]
+ (test "Can add list functionality to any monad."
+ (|> (io.run (do (&.ListT io.Monad<IO>)
+ [a (lift (io/wrap 123))
+ b (wrap 456)]
+ (wrap (i/+ a b))))
+ (case> (^ (list 579)) true
+ _ false)))))