diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/test/test/lux/data/coll/sequence.lux (renamed from stdlib/test/test/lux/data/coll/vector.lux) | 36 | ||||
-rw-r--r-- | stdlib/test/test/lux/data/format/json.lux | 4 | ||||
-rw-r--r-- | stdlib/test/test/lux/math/random.lux | 22 | ||||
-rw-r--r-- | stdlib/test/tests.lux | 2 |
4 files changed, 32 insertions, 32 deletions
diff --git a/stdlib/test/test/lux/data/coll/vector.lux b/stdlib/test/test/lux/data/coll/sequence.lux index 23fe64464..596805d51 100644 --- a/stdlib/test/test/lux/data/coll/vector.lux +++ b/stdlib/test/test/lux/data/coll/sequence.lux @@ -2,7 +2,7 @@ lux (lux [io] (control [monad #+ do Monad]) - (data (coll ["&" vector] + (data (coll ["&" sequence] [list "List/" Fold<List> Functor<List>]) [text "Text/" Monoid<Text>] text/format @@ -11,35 +11,35 @@ ["r" math/random]) lux/test) -(context: "Vectors" +(context: "Sequences" [size (|> r;nat (:: @ map (|>. (n.% +100) (n.max +1)))) idx (|> r;nat (:: @ map (n.% size))) - sample (r;vector size r;nat) - other-sample (r;vector size r;nat) + sample (r;sequence size r;nat) + other-sample (r;sequence size r;nat) non-member (|> r;nat (r;filter (. not (&;member? number;Eq<Nat> sample)))) - #let [(^open "&/") (&;Eq<Vector> number;Eq<Nat>) - (^open "&/") &;Monad<Vector> - (^open "&/") &;Fold<Vector> - (^open "&/") &;Monoid<Vector>]] + #let [(^open "&/") (&;Eq<Sequence> number;Eq<Nat>) + (^open "&/") &;Monad<Sequence> + (^open "&/") &;Fold<Sequence> + (^open "&/") &;Monoid<Sequence>]] ($_ seq - (test "Can query size of vector." + (test "Can query size of sequence." (if (&;empty? sample) (and (n.= +0 size) (n.= +0 (&;size sample))) (n.= size (&;size sample)))) - (test "Can add and remove elements to vectors." + (test "Can add and remove elements to sequences." (and (n.= (n.inc size) (&;size (&;add non-member sample))) (n.= (n.dec size) (&;size (&;pop sample))))) - (test "Can put and get elements into vectors." + (test "Can put and get elements into sequences." (|> sample (&;put idx non-member) (&;nth idx) maybe;assume (is non-member))) - (test "Can update elements of vectors." + (test "Can update elements of sequences." (|> sample (&;put idx non-member) (&;update idx n.inc) (&;nth idx) maybe;assume @@ -48,11 +48,11 @@ (test "Can safely transform to/from lists." (|> sample &;to-list &;from-list (&/= sample))) - (test "Can identify members of a vector." + (test "Can identify members of a sequence." (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 vector." + (test "Can fold over elements of sequence." (n.= (List/fold n.+ +0 (&;to-list sample)) (&/fold n.+ +0 sample))) @@ -62,11 +62,11 @@ (and (not (&/= sample there)) (&/= sample back-again)))) - (test "Applicative allows you to create singleton vectors, and apply vectors of functions to vectors of values." - (and (&/= (&;vector non-member) (&/wrap non-member)) + (test "Applicative allows you to create singleton sequences, and apply sequences of functions to sequences of values." + (and (&/= (&;sequence non-member) (&/wrap non-member)) (&/= (&/map n.inc sample) (&/apply (&/wrap n.inc) sample)))) - (test "Vector concatenation is a monad." + (test "Sequence concatenation is a monad." (&/= (&/compose sample other-sample) - (&/join (&;vector sample other-sample)))) + (&/join (&;sequence sample other-sample)))) )) diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index 89244d6fe..67e636d36 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 "i/" Number<Int>] (format ["@" json]) - (coll [vector #+ vector] + (coll [sequence #+ sequence] ["d" dict] [list])) [macro #+ with-gensyms] @@ -43,7 +43,7 @@ r;bool (|> r;frac (:: @ map (f.* 1_000_000.0))) (r;text size) - (r;vector size gen-json) + (r;sequence size gen-json) (r;dict text;Hash<Text> size (r;text size) gen-json) ))))) diff --git a/stdlib/test/test/lux/math/random.lux b/stdlib/test/test/lux/math/random.lux index 003a3a803..c98f75c20 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] - [vector] + [sequence] [array] [queue] [stack] @@ -17,7 +17,7 @@ (context: "Random." [size (|> r;nat (:: @ map (|>. (n.% +100) (n.max +10)))) _list (r;list size r;nat) - _vector (r;vector size r;nat) + _sequence (r;sequence size r;nat) _array (r;array size r;nat) _queue (r;queue size r;nat) _stack (r;stack size r;nat) @@ -26,14 +26,14 @@ top r;nat filtered (|> r;nat (r;filter (n.<= top))) shuffle-seed r;nat - #let [sorted (|> _vector vector;to-list (list;sort n.<)) - shuffled (|> sorted vector;from-list (r;shuffle shuffle-seed)) - re-sorted (|> shuffled vector;to-list (list;sort n.<))]] + #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.<))]] ($_ seq (test "Can produce lists." (n.= size (list;size _list))) - (test "Can produce vectors." - (n.= size (vector;size _vector))) + (test "Can produce sequences." + (n.= size (sequence;size _sequence))) (test "Can produce arrays." (n.= size (array;size _array))) (test "Can produce queues." @@ -46,9 +46,9 @@ (n.= size (dict;size _dict))) (test "Can filter values." (n.<= top filtered)) - (test "Can shuffle vectors." - (let [(^open "v/") (vector;Eq<Vector> number;Eq<Nat>) - sorted (vector;from-list sorted)] + (test "Can shuffle sequences." + (let [(^open "v/") (sequence;Eq<Sequence> number;Eq<Nat>) + sorted (sequence;from-list sorted)] (and (not (v/= sorted shuffled)) - (v/= sorted (vector;from-list re-sorted))))) + (v/= sorted (sequence;from-list re-sorted))))) )) diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux index b7f097fa2..8d20ef379 100644 --- a/stdlib/test/tests.lux +++ b/stdlib/test/tests.lux @@ -48,7 +48,7 @@ ["_;" queue] ["_;" set] ["_;" stack] - ["_;" vector] + ["_;" sequence] ["_;" priority-queue] ["_;" stream] (tree ["tree_;" rose] |