diff options
Diffstat (limited to 'stdlib/source/test/lux/data')
-rw-r--r-- | stdlib/source/test/lux/data/binary.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/dictionary.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/list.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/row.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/sequence.lux | 43 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/format/tar.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/format/xml.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/encoding.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/format.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/unicode/set.lux | 6 |
11 files changed, 49 insertions, 40 deletions
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index aab56834f..372aed7de 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -38,7 +38,7 @@ (if (n.< size idx) (do random.monad [byte random.nat] - (exec (try.assumed (/.write/8! idx byte output)) + (exec (try.trusted (/.write/8! idx byte output)) (recur (inc idx)))) (\ random.monad in output))))) @@ -113,7 +113,7 @@ (_.cover [/.read/64! /.write/64!] (..binary_io 3 /.read/64! /.write/64! value)))) (_.cover [/.slice] - (let [random_slice (try.assumed (/.slice offset length sample)) + (let [random_slice (try.trusted (/.slice offset length sample)) idxs (: (List Nat) (case length 0 (list) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 82e421d28..080e09001 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -174,7 +174,7 @@ cannot_put_old_keys! (or (n.= 0 size) - (let [first_key (|> dict /.keys list.head maybe.assume)] + (let [first_key (|> dict /.keys list.head maybe.trusted)] (case (/.has' first_key test_val dict) (#try.Success _) false @@ -239,13 +239,13 @@ (_.cover [/.re_bound] (or (n.= 0 size) - (let [first_key (|> dict /.keys list.head maybe.assume) + (let [first_key (|> dict /.keys list.head maybe.trusted) rebound (/.re_bound first_key non_key dict)] (and (n.= (/.size dict) (/.size rebound)) (/.key? rebound non_key) (not (/.key? rebound first_key)) - (n.= (maybe.assume (/.value first_key dict)) - (maybe.assume (/.value non_key rebound))))))) + (n.= (maybe.trusted (/.value first_key dict)) + (maybe.trusted (/.value non_key rebound))))))) ))) (def: .public test diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index ce86a80c7..8ba430845 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -68,12 +68,12 @@ (do {! random.monad} [parameter random.nat subject random.nat] - (let [lift (/.lift io.monad) + (let [lifted (/.lifted io.monad) (^open "io\.") io.monad expected (n.+ parameter subject)] - (_.cover [/.with /.lift] + (_.cover [/.with /.lifted] (|> (io.run! (do (/.with io.monad) - [a (lift (io\in parameter)) + [a (lifted (io\in parameter)) b (in subject)] (in (n.+ a b)))) (case> (^ (list actual)) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 3ae89efba..2515f284f 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -98,16 +98,16 @@ (#try.Failure error) false)) - (_.cover [/.put] + (_.cover [/.has] (<| (try.else false) (do try.monad - [sample (/.put good_index non_member sample) + [sample (/.has good_index non_member sample) actual (/.item good_index sample)] (in (same? non_member actual))))) (_.cover [/.revised] (<| (try.else false) (do try.monad - [sample (/.put good_index non_member sample) + [sample (/.has good_index non_member sample) sample (/.revised good_index inc sample) actual (/.item good_index sample)] (in (n.= (inc non_member) actual))))) @@ -124,7 +124,7 @@ (#try.Failure error) (exception.match? /.index_out_of_bounds error))))] (and (fails! (/.item bad_index sample)) - (fails! (/.put bad_index non_member sample)) + (fails! (/.has bad_index non_member sample)) (fails! (/.revised bad_index inc sample))))) )) ))) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 19183f1b1..ebac1772b 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -29,6 +29,15 @@ (/.first 100 reference) (/.first 100 subject)))) +(def: (iterations step) + (All [a] + (-> (-> a a) + (-> a (/.Sequence a)))) + (/.iterations + (function (_ state) + (let [state' (step state)] + [state' state])))) + (def: .public test Test (<| (_.covering /._) @@ -47,67 +56,67 @@ (_.for [/.comonad] ($comonad.spec /.repeated ..equivalence /.comonad)) - (_.cover [/.iterations /.item] + (_.cover [/.item] (n.= (n.+ offset index) - (/.item index (/.iterations inc offset)))) + (/.item index (..iterations inc offset)))) (_.cover [/.repeated] (n.= repeated (/.item index (/.repeated repeated)))) (_.cover [/.first] (list\= (enum.range n.enum offset (dec (n.+ size offset))) - (/.first size (/.iterations inc offset)))) + (/.first size (..iterations inc offset)))) (_.cover [/.after] (list\= (enum.range n.enum offset (dec (n.+ size offset))) - (/.first size (/.after offset (/.iterations inc 0))))) + (/.first size (/.after offset (..iterations inc 0))))) (_.cover [/.split_at] - (let [[drops takes] (/.split_at size (/.iterations inc 0))] + (let [[drops takes] (/.split_at size (..iterations inc 0))] (and (list\= (enum.range n.enum 0 (dec size)) drops) (list\= (enum.range n.enum size (dec (n.* 2 size))) (/.first size takes))))) (_.cover [/.while] (list\= (enum.range n.enum 0 (dec size)) - (/.while (n.< size) (/.iterations inc 0)))) + (/.while (n.< size) (..iterations inc 0)))) (_.cover [/.until] (list\= (enum.range n.enum offset (dec (n.+ size offset))) (/.while (n.< (n.+ size offset)) - (/.until (n.< offset) (/.iterations inc 0))))) + (/.until (n.< offset) (..iterations inc 0))))) (_.cover [/.split_when] - (let [[drops takes] (/.split_when (n.= size) (/.iterations inc 0))] + (let [[drops takes] (/.split_when (n.= size) (..iterations inc 0))] (and (list\= (enum.range n.enum 0 (dec size)) drops) (list\= (enum.range n.enum size (dec (n.* 2 size))) (/.while (n.< (n.* 2 size)) takes))))) (_.cover [/.head] (n.= offset - (/.head (/.iterations inc offset)))) + (/.head (..iterations inc offset)))) (_.cover [/.tail] (list\= (enum.range n.enum (inc offset) (n.+ size offset)) - (/.first size (/.tail (/.iterations inc offset))))) + (/.first size (/.tail (..iterations inc offset))))) (_.cover [/.only] (list\= (list\map (n.* 2) (enum.range n.enum 0 (dec size))) - (/.first size (/.only n.even? (/.iterations inc 0))))) + (/.first size (/.only n.even? (..iterations inc 0))))) (_.cover [/.partition] - (let [[evens odds] (/.partition n.even? (/.iterations inc 0))] + (let [[evens odds] (/.partition n.even? (..iterations inc 0))] (and (n.= (n.* 2 offset) (/.item offset evens)) (n.= (inc (n.* 2 offset)) (/.item offset odds))))) - (_.cover [/.unfold] + (_.cover [/.iterations] (let [(^open "/\.") /.functor (^open "list\.") (list.equivalence text.equivalence)] (list\= (/.first size - (/\map %.nat (/.iterations inc offset))) + (/\map %.nat (..iterations inc offset))) (/.first size - (/.unfold (function (_ n) [(inc n) (%.nat n)]) - offset))))) + (/.iterations (function (_ n) [(inc n) (%.nat n)]) + offset))))) (_.cover [/.cycle] (let [cycle (list& cycle_start cycle_next)] (list\= (list.joined (list.repeated size cycle)) (/.first (n.* size (list.size cycle)) (/.cycle [cycle_start cycle_next]))))) (_.cover [/.^sequence&] - (let [(/.^sequence& first second third next) (/.iterations inc offset)] + (let [(/.^sequence& first second third next) (..iterations inc offset)] (and (n.= offset first) (n.= (n.+ 1 offset) second) (n.= (n.+ 2 offset) third)))) diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 0c43ada46..fe0083c95 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -164,7 +164,7 @@ chunks (\ ! map (n.% 100) random.nat) .let [content (|> chunk (list.repeated chunks) - (text.join_with "") + text.joined (\ utf8.codec encode))]] (`` ($_ _.and (~~ (template [<type> <tag>] diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index 4fef01a10..0ce833e92 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -37,7 +37,7 @@ (Random Nat) (do {! random.monad} [idx (|> random.nat (\ ! map (n.% (text.size char_range))))] - (in (maybe.assume (text.char idx char_range))))) + (in (maybe.trusted (text.char idx char_range))))) (def: (size bottom top) (-> Nat Nat (Random Nat)) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 1efa4ebfe..aa012a5ae 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -195,15 +195,15 @@ (_.cover [/.joined] (n.= (set.size characters) (/.size (/.joined (set.list characters))))) - (_.cover [/.join_with /.all_split_by] + (_.cover [/.interposed /.all_split_by] (and (|> (set.list characters) - (/.join_with separator) + (/.interposed separator) (/.all_split_by separator) (set.of_list /.hash) (\ set.equivalence = characters)) (\ /.equivalence = (/.joined (set.list characters)) - (/.join_with "" (set.list characters))))) + (/.interposed "" (set.list characters))))) (_.cover [/.replaced/1] (\ /.equivalence = (\ /.monoid compose post static) diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index 34d6ee08d..46dba6ded 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -215,7 +215,7 @@ (let [options (list.size ..all_encodings)] (do {! random.monad} [choice (\ ! map (n.% options) random.nat)] - (in (maybe.assume (list.item choice ..all_encodings)))))) + (in (maybe.trusted (list.item choice ..all_encodings)))))) (def: .public test Test diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux index f2887f530..24746c45d 100644 --- a/stdlib/source/test/lux/data/text/format.lux +++ b/stdlib/source/test/lux/data/text/format.lux @@ -160,7 +160,7 @@ (text\= (/.list /.nat members) (|> members (list\map /.nat) - (text.join_with " ") + (text.interposed " ") list (/.list (|>>)))))) (do random.monad diff --git a/stdlib/source/test/lux/data/text/unicode/set.lux b/stdlib/source/test/lux/data/text/unicode/set.lux index 6efe6cb14..84ebef798 100644 --- a/stdlib/source/test/lux/data/text/unicode/set.lux +++ b/stdlib/source/test/lux/data/text/unicode/set.lux @@ -64,9 +64,9 @@ (_.cover [/.member?] (bit\= (block.within? block inside) (/.member? (/.set [block (list)]) inside))) - (_.cover [/.compose] - (let [composed (/.compose (/.set [left (list)]) - (/.set [right (list)]))] + (_.cover [/.composite] + (let [composed (/.composite (/.set [left (list)]) + (/.set [right (list)]))] (and (n.= (n.min (block.start left) (block.start right)) (/.start composed)) |