aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
authorEduardo Julian2021-02-15 09:59:58 -0400
committerEduardo Julian2021-02-15 09:59:58 -0400
commitee7721f3a9c0b899ab282dda120b0854a5cc0bd4 (patch)
tree45eda49dbb5ed7c91f22b3efe5f03bc1b53333cb /stdlib/source/test
parentee3240679a7c1c4d216b35e1d2db1544e5c16863 (diff)
Almost done with Lua.
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/data.lux9
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux58
-rw-r--r--stdlib/source/test/lux/data/lazy.lux58
-rw-r--r--stdlib/source/test/lux/data/text.lux4
-rw-r--r--stdlib/source/test/lux/data/text/encoding.lux9
5 files changed, 74 insertions, 64 deletions
diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux
index 376a7cd3e..33f0d963b 100644
--- a/stdlib/source/test/lux/data.lux
+++ b/stdlib/source/test/lux/data.lux
@@ -8,20 +8,20 @@
["." / #_
["#." binary]
["#." bit]
+ ["#." color
+ ["#/." named]]
["#." identity]
["#." lazy]
["#." maybe]
["#." name]
["#." product]
["#." sum]
- ["#." color
- ["#/." named]]
+ ["#." text]
["#." format #_
["#/." binary]
["#/." json]
["#/." tar]
["#/." xml]]
- ["#." text]
["#." collection]])
## TODO: Get rid of this ASAP
@@ -57,8 +57,7 @@
/sum.test
/text.test
..format
- /collection.test
- )]
+ /collection.test)]
($_ _.and
(!bundle test0)
(!bundle test1)
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index 10000ff52..c842ebe9c 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -392,31 +392,33 @@
(def: #export test
Test
(<| (_.covering /._)
- (_.for [/.Tar]
- ($_ _.and
- (_.cover [/.writer /.parser]
- (|> row.empty
- (format.run /.writer)
- (<b>.run /.parser)
- (\ try.monad map row.empty?)
- (try.default false)))
- (_.cover [/.invalid_end_of_archive]
- (let [dump (format.run /.writer row.empty)]
- (case (<b>.run /.parser (binary\compose dump dump))
- (#try.Success _)
- false
-
- (#try.Failure error)
- (exception.match? /.invalid_end_of_archive error))))
-
- ..path
- ..name
- ..small
- ..big
- (_.for [/.Entry]
- ($_ _.and
- ..entry
- ..mode
- ..ownership
- ))
- ))))
+ (_.for [/.Tar])
+ (do random.monad
+ [_ (wrap [])]
+ ($_ _.and
+ (_.cover [/.writer /.parser]
+ (|> row.empty
+ (format.run /.writer)
+ (<b>.run /.parser)
+ (\ try.monad map row.empty?)
+ (try.default false)))
+ (_.cover [/.invalid_end_of_archive]
+ (let [dump (format.run /.writer row.empty)]
+ (case (<b>.run /.parser (binary\compose dump dump))
+ (#try.Success _)
+ false
+
+ (#try.Failure error)
+ (exception.match? /.invalid_end_of_archive error))))
+
+ ..path
+ ..name
+ ..small
+ ..big
+ (_.for [/.Entry]
+ ($_ _.and
+ ..entry
+ ..mode
+ ..ownership
+ ))
+ ))))
diff --git a/stdlib/source/test/lux/data/lazy.lux b/stdlib/source/test/lux/data/lazy.lux
index 5900817e4..86d28d753 100644
--- a/stdlib/source/test/lux/data/lazy.lux
+++ b/stdlib/source/test/lux/data/lazy.lux
@@ -9,6 +9,8 @@
["$." apply]
["$." monad]
["$." equivalence]]}]
+ [data
+ ["." product]]
[math
["." random (#+ Random)]
[number
@@ -31,31 +33,35 @@
(def: #export test
Test
- (<| (_.covering /._)
- (do random.monad
- [left random.nat
- right random.nat
- #let [expected (n.* left right)]]
- (_.for [/.Lazy]
- ($_ _.and
- (_.for [/.equivalence]
- ($equivalence.spec (/.equivalence n.equivalence) (..lazy random.nat)))
- (_.for [/.functor]
- ($functor.spec ..injection ..comparison /.functor))
- (_.for [/.apply]
- ($apply.spec ..injection ..comparison /.apply))
- (_.for [/.monad]
- ($monad.spec ..injection ..comparison /.monad))
+ (with_expansions [<eager> (: [Nat Nat]
+ [(n.+ left right)
+ (n.* left right)])]
+ (<| (_.covering /._)
+ (do random.monad
+ [left random.nat
+ right random.nat
+ #let [expected <eager>]]
+ (_.for [/.Lazy]
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec (/.equivalence n.equivalence) (..lazy random.nat)))
+ (_.for [/.functor]
+ ($functor.spec ..injection ..comparison /.functor))
+ (_.for [/.apply]
+ ($apply.spec ..injection ..comparison /.apply))
+ (_.for [/.monad]
+ ($monad.spec ..injection ..comparison /.monad))
- (_.cover [/.freeze]
- (let [lazy (/.freeze (n.* left right))]
- (n.= expected
- (/.thaw lazy))))
+ (_.cover [/.freeze]
+ (let [lazy (/.freeze <eager>)
+ (^open "\=") (product.equivalence n.equivalence n.equivalence)]
+ (\= expected
+ (/.thaw lazy))))
- (_.cover [/.thaw]
- (let [lazy (/.freeze (n.* left right))]
- (and (not (is? expected
- (/.thaw lazy)))
- (is? (/.thaw lazy)
- (/.thaw lazy)))))
- )))))
+ (_.cover [/.thaw]
+ (let [lazy (/.freeze <eager>)]
+ (and (not (is? expected
+ (/.thaw lazy)))
+ (is? (/.thaw lazy)
+ (/.thaw lazy)))))
+ ))))))
diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux
index 983649a89..28ba6fef5 100644
--- a/stdlib/source/test/lux/data/text.lux
+++ b/stdlib/source/test/lux/data/text.lux
@@ -56,7 +56,7 @@
left (random.unicode 1)
right (random.unicode 1)
#let [full (\ /.monoid compose inner outer)
- fake_index (.nat -1)]]
+ fake_index (dec 0)]]
(`` ($_ _.and
(~~ (template [<affix> <predicate>]
[(_.cover [<affix> <predicate>]
@@ -82,7 +82,7 @@
[inner (random.unicode 1)
outer (random.filter (|>> (\ /.equivalence = inner) not)
(random.unicode 1))
- #let [fake_index (.nat -1)]]
+ #let [fake_index (dec 0)]]
($_ _.and
(_.cover [/.contains?]
(let [full (\ /.monoid compose inner outer)]
diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux
index c5b985f50..c2b438232 100644
--- a/stdlib/source/test/lux/data/text/encoding.lux
+++ b/stdlib/source/test/lux/data/text/encoding.lux
@@ -12,7 +12,7 @@
["." maybe]
["." text ("#\." equivalence)]
[collection
- ["." list ("#\." functor)]
+ ["." list ("#\." fold)]
["." set]]]
[macro
["." template]]
@@ -180,14 +180,17 @@
[((: (-> Any (List /.Encoding))
(function (_ _)
(`` (list (~~ (template.splice <by_letter>))))))
- 123)]
+ [])]
<encodings>)]
(def: all_encodings
(list.concat (list <named>)))
(def: unique_encodings
- (set.from_list text.hash (list\map /.name ..all_encodings)))
+ (list\fold (function (_ encoding set)
+ (set.add (/.name encoding) set))
+ (set.new text.hash)
+ ..all_encodings))
(def: verdict
(n.= (list.size ..all_encodings)