diff options
author | Eduardo Julian | 2018-07-03 22:20:22 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-07-03 22:20:22 -0400 |
commit | f505b42847bd7ba54b14d4b593b883c1bb25501d (patch) | |
tree | eb017a0f3db7d4cd7dee260dd5eb437ad74f327a /stdlib/test | |
parent | 371a407a49ddf0f2fe1d977018fcd0a009c86043 (diff) |
- Re-named "sequence" to "row".
Diffstat (limited to '')
-rw-r--r-- | stdlib/test/test/lux/data/coll/row.lux (renamed from stdlib/test/test/lux/data/coll/sequence.lux) | 38 | ||||
-rw-r--r-- | stdlib/test/test/lux/data/format/json.lux | 4 | ||||
-rw-r--r-- | stdlib/test/test/lux/math/random.lux | 22 |
3 files changed, 32 insertions, 32 deletions
diff --git a/stdlib/test/test/lux/data/coll/sequence.lux b/stdlib/test/test/lux/data/coll/row.lux index 024e91c6b..3a4da0f42 100644 --- a/stdlib/test/test/lux/data/coll/sequence.lux +++ b/stdlib/test/test/lux/data/coll/row.lux @@ -2,45 +2,45 @@ lux (lux [io] (control [monad #+ do Monad]) - (data (coll ["&" sequence] + (data (coll ["&" row] [list "list/" Fold<List>]) [number] [maybe]) ["r" math/random]) lux/test) -(context: "Sequences" +(context: "Rows" (<| (times +100) (do @ [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +1)))) idx (|> r.nat (:: @ map (n/% size))) - sample (r.sequence size r.nat) - other-sample (r.sequence size r.nat) + sample (r.row size r.nat) + other-sample (r.row size r.nat) non-member (|> r.nat (r.filter (|>> (&.member? number.Eq<Nat> sample) not))) - #let [(^open "&/") (&.Eq<Sequence> number.Eq<Nat>) - (^open "&/") &.Apply<Sequence> - (^open "&/") &.Monad<Sequence> - (^open "&/") &.Fold<Sequence> - (^open "&/") &.Monoid<Sequence>]] + #let [(^open "&/") (&.Eq<Row> number.Eq<Nat>) + (^open "&/") &.Apply<Row> + (^open "&/") &.Monad<Row> + (^open "&/") &.Fold<Row> + (^open "&/") &.Monoid<Row>]] ($_ seq - (test "Can query size of sequence." + (test "Can query size of row." (if (&.empty? sample) (and (n/= +0 size) (n/= +0 (&.size sample))) (n/= size (&.size sample)))) - (test "Can add and remove elements to sequences." + (test "Can add and remove elements to rows." (and (n/= (inc size) (&.size (&.add non-member sample))) (n/= (dec size) (&.size (&.pop sample))))) - (test "Can put and get elements into sequences." + (test "Can put and get elements into rows." (|> sample (&.put idx non-member) (&.nth idx) maybe.assume (is? non-member))) - (test "Can update elements of sequences." + (test "Can update elements of rows." (|> sample (&.put idx non-member) (&.update idx inc) (&.nth idx) maybe.assume @@ -49,11 +49,11 @@ (test "Can safely transform to/from lists." (|> sample &.to-list &.from-list (&/= sample))) - (test "Can identify members of a sequence." + (test "Can identify members of a row." (and (not (&.member? number.Eq<Nat> sample non-member)) (&.member? number.Eq<Nat> (&.add non-member sample) non-member))) - (test "Can fold over elements of sequence." + (test "Can fold over elements of row." (n/= (list/fold n/+ +0 (&.to-list sample)) (&/fold n/+ +0 sample))) @@ -63,11 +63,11 @@ (and (not (&/= sample there)) (&/= sample back-again)))) - (test "Apply allows you to create singleton sequences, and apply sequences of functions to sequences of values." - (and (&/= (&.sequence non-member) (&/wrap non-member)) + (test "Apply allows you to create singleton rows, and apply rows of functions to rows of values." + (and (&/= (&.row non-member) (&/wrap non-member)) (&/= (&/map inc sample) (&/apply (&/wrap inc) sample)))) - (test "Sequence concatenation is a monad." + (test "Row concatenation is a monad." (&/= (&/compose sample other-sample) - (&/join (&.sequence sample other-sample)))) + (&/join (&.row sample other-sample)))) )))) diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index a8a117a04..b3196e1e6 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -13,7 +13,7 @@ [maybe] [number] (format ["@" json]) - (coll [sequence #+ sequence] + (coll [row #+ row] (dictionary ["d" unordered]) [list])) [macro #+ with-gensyms] @@ -43,7 +43,7 @@ r.bool (|> r.frac (:: @ map (f/* 1_000_000.0))) (r.unicode size) - (r.sequence size gen-json) + (r.row size gen-json) (r.dict text.Hash<Text> size (r.unicode size) gen-json) ))))) diff --git a/stdlib/test/test/lux/math/random.lux b/stdlib/test/test/lux/math/random.lux index 4230f27b1..b2f4fe6ca 100644 --- a/stdlib/test/test/lux/math/random.lux +++ b/stdlib/test/test/lux/math/random.lux @@ -5,7 +5,7 @@ (data [number] text/format (coll [list] - [sequence] + [row] [array] [queue] [stack] @@ -19,7 +19,7 @@ (do @ [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +10)))) _list (r.list size r.nat) - _sequence (r.sequence size r.nat) + _row (r.row size r.nat) _array (r.array size r.nat) _queue (r.queue size r.nat) _stack (r.stack size r.nat) @@ -28,14 +28,14 @@ top r.nat filtered (|> r.nat (r.filter (n/<= top))) shuffle-seed r.nat - #let [sorted (|> _sequence sequence.to-list (list.sort n/<)) - shuffled (|> sorted sequence.from-list (r.shuffle shuffle-seed)) - re-sorted (|> shuffled sequence.to-list (list.sort n/<))]] + #let [sorted (|> _row row.to-list (list.sort n/<)) + shuffled (|> sorted row.from-list (r.shuffle shuffle-seed)) + re-sorted (|> shuffled row.to-list (list.sort n/<))]] ($_ seq (test "Can produce lists." (n/= size (list.size _list))) - (test "Can produce sequences." - (n/= size (sequence.size _sequence))) + (test "Can produce rows." + (n/= size (row.size _row))) (test "Can produce arrays." (n/= size (array.size _array))) (test "Can produce queues." @@ -48,9 +48,9 @@ (n/= size (dict.size _dict))) (test "Can filter values." (n/<= top filtered)) - (test "Can shuffle sequences." - (let [(^open "v/") (sequence.Eq<Sequence> number.Eq<Nat>) - sorted (sequence.from-list sorted)] + (test "Can shuffle rows." + (let [(^open "v/") (row.Eq<Row> number.Eq<Nat>) + sorted (row.from-list sorted)] (and (not (v/= sorted shuffled)) - (v/= sorted (sequence.from-list re-sorted))))) + (v/= sorted (row.from-list re-sorted))))) )))) |