aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/data/binary.lux54
-rw-r--r--stdlib/source/test/lux/data/collection/array.lux56
2 files changed, 55 insertions, 55 deletions
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index 2098203de..25877dfd7 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -42,7 +42,7 @@
(if (n.< size idx)
(do random.monad
[byte random.nat]
- (exec (try.trusted (/.write/8! idx byte output))
+ (exec (try.trusted (/.has/1! idx byte output))
(again (++ idx))))
(# random.monad in output)))))
@@ -100,8 +100,8 @@
(!.= (!.empty size) (!.empty size)))
(_.cover [!.size]
(|> (!.empty size) !.size (n.= size)))
- (~~ (template [<power> <bytes/?> <with/?>]
- [(_.cover [<bytes/?> <with/?>]
+ (~~ (template [<power> <bytes/?> <has/?>]
+ [(_.cover [<bytes/?> <has/?>]
(let [bytes (i64.left_shifted <power> 1)
binary (!.empty bytes)
cap (case bytes
@@ -110,15 +110,15 @@
capped_value (i64.and cap value)
pre (<bytes/?> 0 binary)
- _ (<with/?> 0 value binary)
+ _ (<has/?> 0 value binary)
post (<bytes/?> 0 binary)]
(and (n.= 0 pre)
(n.= capped_value post))))]
- [0 !.bytes/1 !.with/1!]
- [1 !.bytes/2 !.with/2!]
- [2 !.bytes/4 !.with/4!]
- [3 !.bytes/8 !.with/8!]))
+ [0 !.bytes/1 !.has/1!]
+ [1 !.bytes/2 !.has/2!]
+ [2 !.bytes/4 !.has/4!]
+ [3 !.bytes/8 !.has/8!]))
(_.cover [!.slice]
(let [random_slice (!.slice offset length sample)
idxs (is (List Nat)
@@ -172,14 +172,14 @@
(|> (/.empty size) /.size (n.= size)))
(_.for [/.index_out_of_bounds]
($_ _.and
- (_.cover [/.read/8! /.write/8!]
- (..binary_io 0 /.read/8! /.write/8! value))
- (_.cover [/.read/16! /.write/16!]
- (..binary_io 1 /.read/16! /.write/16! value))
- (_.cover [/.read/32! /.write/32!]
- (..binary_io 2 /.read/32! /.write/32! value))
- (_.cover [/.read/64! /.write/64!]
- (..binary_io 3 /.read/64! /.write/64! value))))
+ (_.cover [/.bytes/1 /.has/1!]
+ (..binary_io 0 /.bytes/1 /.has/1! value))
+ (_.cover [/.bytes/2 /.has/2!]
+ (..binary_io 1 /.bytes/2 /.has/2! value))
+ (_.cover [/.bytes/4 /.has/4!]
+ (..binary_io 2 /.bytes/4 /.has/4! value))
+ (_.cover [/.bytes/8 /.has/8!]
+ (..binary_io 3 /.bytes/8 /.has/8! value))))
(_.cover [/.slice]
(let [random_slice (try.trusted (/.slice offset length sample))
idxs (is (List Nat)
@@ -187,7 +187,7 @@
0 (list)
_ (enum.range n.enum 0 (-- length))))
reader (function (_ binary idx)
- (/.read/8! idx binary))]
+ (/.bytes/1 idx binary))]
(and (n.= length (/.size random_slice))
(case [(monad.each try.monad (|>> (n.+ offset) (reader sample)) idxs)
(monad.each try.monad (reader random_slice) idxs)]
@@ -213,8 +213,8 @@
{.#Item head tail}
(n.= (list.mix n.+ 0 tail)
(/.aggregate n.+ 0 (/.after 1 sample))))))
- (_.cover [/.copy]
- (and (case (/.copy size 0 sample 0 (/.empty size))
+ (_.cover [/.copy!]
+ (and (case (/.copy! size 0 sample 0 (/.empty size))
{try.#Success output}
(and (not (same? sample output))
(# /.equivalence = sample output))
@@ -223,21 +223,21 @@
false)
(succeed
(do try.monad
- [sample/0 (/.read/8! 0 sample)
- copy (/.copy 1 0 sample 0 (/.empty 2))
- copy/0 (/.read/8! 0 copy)
- copy/1 (/.read/8! 1 copy)]
+ [sample/0 (/.bytes/1 0 sample)
+ copy (/.copy! 1 0 sample 0 (/.empty 2))
+ copy/0 (/.bytes/1 0 copy)
+ copy/1 (/.bytes/1 1 copy)]
(in (and (n.= sample/0 copy/0)
(n.= 0 copy/1)))))))
(_.cover [/.cannot_copy]
(and (not (throws? /.cannot_copy
- (/.copy size 0 sample 0 (/.empty size))))
+ (/.copy! size 0 sample 0 (/.empty size))))
(throws? /.cannot_copy
- (/.copy (n.+ offset size) 0 sample 0 (/.empty size)))
+ (/.copy! (n.+ offset size) 0 sample 0 (/.empty size)))
(throws? /.cannot_copy
- (/.copy size offset sample 0 (/.empty size)))
+ (/.copy! size offset sample 0 (/.empty size)))
(throws? /.cannot_copy
- (/.copy size 0 sample offset (/.empty size)))))
+ (/.copy! size 0 sample offset (/.empty size)))))
..test|unsafe
))))
diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux
index 2d413f633..1008f2422 100644
--- a/stdlib/source/test/lux/data/collection/array.lux
+++ b/stdlib/source/test/lux/data/collection/array.lux
@@ -71,7 +71,7 @@
(_.cover [/.one]
(case [(|> evens
(/#each (# n.decimal encoded))
- (/.read! 0))
+ (/.item 0))
(/.one choose evens)]
[{.#Some expected} {.#Some actual}]
(text#= expected actual)
@@ -85,13 +85,13 @@
(# (maybe.equivalence n.equivalence) =
(/.example n.even? the_array)
(list.example n.even? (/.list {.#None} the_array))))
- (_.cover [/.example+]
+ (_.cover [/.example']
(case [(/.example n.even? the_array)
- (/.example+ (function (_ idx member)
+ (/.example' (function (_ idx member)
(n.even? member))
the_array)]
[{.#Some expected} {.#Some [idx actual]}]
- (case (/.read! idx the_array)
+ (case (/.item idx the_array)
{.#Some again}
(and (n.= expected actual)
(n.= actual again))
@@ -332,23 +332,23 @@
_
false))
- (_.cover [/.read! /.write!]
+ (_.cover [/.item /.has!]
(let [the_array (|> (/.empty 2)
(is (Array Nat))
- (/.write! 0 expected))]
- (case [(/.read! 0 the_array)
- (/.read! 1 the_array)]
+ (/.has! 0 expected))]
+ (case [(/.item 0 the_array)
+ (/.item 1 the_array)]
[{.#Some actual} {.#None}]
(n.= expected actual)
_
false)))
- (_.cover [/.delete!]
+ (_.cover [/.lacks!]
(let [the_array (|> (/.empty 1)
(is (Array Nat))
- (/.write! 0 expected))]
- (case [(/.read! 0 the_array)
- (/.read! 0 (/.delete! 0 the_array))]
+ (/.has! 0 expected))]
+ (case [(/.item 0 the_array)
+ (/.item 0 (/.lacks! 0 the_array))]
[{.#Some actual} {.#None}]
(n.= expected actual)
@@ -357,21 +357,21 @@
(_.cover [/.lacks?]
(let [the_array (|> (/.empty 2)
(is (Array Nat))
- (/.write! 0 expected))]
+ (/.has! 0 expected))]
(and (not (/.lacks? 0 the_array))
(/.lacks? 1 the_array))))
- (_.cover [/.contains?]
+ (_.cover [/.has?]
(let [the_array (|> (/.empty 2)
(is (Array Nat))
- (/.write! 0 expected))]
- (and (/.contains? 0 the_array)
- (not (/.contains? 1 the_array)))))
- (_.cover [/.update!]
+ (/.has! 0 expected))]
+ (and (/.has? 0 the_array)
+ (not (/.has? 1 the_array)))))
+ (_.cover [/.revised!]
(let [the_array (|> (/.empty 1)
(is (Array Nat))
- (/.write! 0 base)
- (/.update! 0 (n.+ shift)))]
- (case (/.read! 0 the_array)
+ (/.has! 0 base)
+ (/.revised! 0 (n.+ shift)))]
+ (case (/.item 0 the_array)
{.#Some actual}
(n.= expected actual)
@@ -380,11 +380,11 @@
(_.cover [/.upsert!]
(let [the_array (|> (/.empty 2)
(is (Array Nat))
- (/.write! 0 base)
+ (/.has! 0 base)
(/.upsert! 0 dummy (n.+ shift))
(/.upsert! 1 base (n.+ shift)))]
- (case [(/.read! 0 the_array)
- (/.read! 1 the_array)]
+ (case [(/.item 0 the_array)
+ (/.item 1 the_array)]
[{.#Some actual/0} {.#Some actual/1}]
(and (n.= expected actual/0)
(n.= expected actual/1))
@@ -398,7 +398,7 @@
(/.empty size))
idx 0])
(if (n.< occupancy idx)
- (again (/.write! idx expected output)
+ (again (/.has! idx expected output)
(++ idx))
output))]
(and (n.= occupancy (/.occupancy the_array))
@@ -418,7 +418,7 @@
(|> the_array (/.list {.#None}) /.of_list
(# (/.equivalence n.equivalence) = the_array))
(exec
- (/.filter! n.even? the_array)
+ (/.only! n.even? the_array)
(list.every? (function (_ value)
(or (n.even? value)
(same? default value)))
@@ -439,8 +439,8 @@
(let [the_array (/.clone the_array)
evens (|> the_array (/.list {.#None}) (list.only n.even?))
odds (|> the_array (/.list {.#None}) (list.only n.odd?))]
- (_.cover [/.filter!]
- (exec (/.filter! n.even? the_array)
+ (_.cover [/.only!]
+ (exec (/.only! n.even? the_array)
(and (n.= (list.size evens) (/.occupancy the_array))
(n.= (list.size odds) (/.vacancy the_array))
(|> the_array (/.list {.#None}) (# (list.equivalence n.equivalence) = evens))))))