diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/data/collection/list.lux | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index ffde9bcf4..b2d35b1f4 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -31,7 +31,7 @@ {1 ["." / ("#\." monad)]}) -(def: bounded-size +(def: bounded_size (Random Nat) (\ random.monad map (n.% 100) random.nat)) @@ -39,10 +39,10 @@ (def: random (Random (List Nat)) (do {! random.monad} - [size ..bounded-size] + [size ..bounded_size] (|> random.nat (random.set n.hash size) - (\ ! map set.to-list)))) + (\ ! map set.to_list)))) (def: signatures Test @@ -81,9 +81,9 @@ (def: whole Test (do {! random.monad} - [size ..bounded-size + [size ..bounded_size #let [(^open "/\.") (/.equivalence n.equivalence)] - sample (\ ! map set.to-list (random.set n.hash size random.nat))] + sample (\ ! map set.to_list (random.set n.hash size random.nat))] ($_ _.and (_.cover [/.size] (n.= size (/.size sample))) @@ -95,15 +95,15 @@ (n.= size (/.size (/.repeat size [])))) (_.cover [/.reverse] (or (n.< 2 (/.size sample)) - (let [not-same! + (let [not_same! (not (/\= sample (/.reverse sample))) - self-symmetry! + self_symmetry! (/\= sample (/.reverse (/.reverse sample)))] - (and not-same! - self-symmetry!)))) + (and not_same! + self_symmetry!)))) (_.cover [/.every? /.any?] (if (/.every? n.even? sample) (not (/.any? (bit.complement n.even?) sample)) @@ -111,14 +111,14 @@ (_.cover [/.sort] (let [<<< n.< - size-preservation! + size_preservation! (n.= (/.size sample) (/.size (/.sort <<< sample))) symmetry! (/\= (/.sort <<< sample) (/.reverse (/.sort (function.flip <<<) sample)))] - (and size-preservation! + (and size_preservation! symmetry!))) ))) @@ -133,33 +133,33 @@ (_.cover [/.indices] (let [indices (/.indices size) - expected-amount! + expected_amount! (n.= size (/.size indices)) - already-sorted! + already_sorted! (/\= indices (/.sort n.< indices)) - expected-numbers! + expected_numbers! (/.every? (n.= (dec size)) - (/.zip-with/2 n.+ + (/.zip_with/2 n.+ indices (/.sort n.> indices)))] - (and expected-amount! - already-sorted! - expected-numbers!))) + (and expected_amount! + already_sorted! + expected_numbers!))) (_.cover [/.enumeration] (let [enumeration (/.enumeration sample) - has-correct-indices! + has_correct_indices! (/\= (/.indices (/.size enumeration)) (/\map product.left enumeration)) - has-correct-values! + has_correct_values! (/\= sample (/\map product.right enumeration))] - (and has-correct-indices! - has-correct-values!))) + (and has_correct_indices! + has_correct_values!))) (_.cover [/.nth] (/.every? (function (_ [index expected]) (case (/.nth index sample) @@ -180,7 +180,7 @@ ..random) #let [size (/.size sample)] idx (\ ! map (n.% size) random.nat) - chunk-size (\ ! map (|>> (n.% size) inc) random.nat)] + chunk_size (\ ! map (|>> (n.% size) inc) random.nat)] ($_ _.and (_.cover [/.filter] (let [positives (/.filter n.even? sample) @@ -201,21 +201,21 @@ (let [[left right] (/.split idx sample)] (/\= sample (/\compose left right)))) - (_.cover [/.split-with] - (let [[left right] (/.split-with n.even? sample)] + (_.cover [/.split_with] + (let [[left right] (/.split_with n.even? sample)] (/\= sample (/\compose left right)))) (_.cover [/.take /.drop] (/\= sample (/\compose (/.take idx sample) (/.drop idx sample)))) - (_.cover [/.take-while /.drop-while] + (_.cover [/.take_while /.drop_while] (/\= sample - (/\compose (/.take-while n.even? sample) - (/.drop-while n.even? sample)))) + (/\compose (/.take_while n.even? sample) + (/.drop_while n.even? sample)))) (_.cover [/.chunk] - (let [chunks (/.chunk chunk-size sample)] - (and (/.every? (|>> /.size (n.<= chunk-size)) chunks) + (let [chunks (/.chunk chunk_size sample)] + (and (/.every? (|>> /.size (n.<= chunk_size)) chunks) (/\= sample (/.concat chunks))))) )))) @@ -275,44 +275,44 @@ sample/1 ..random sample/2 ..random] ($_ _.and - (_.cover [/.as-pairs] + (_.cover [/.as_pairs] (n.= (n./ 2 (/.size sample/0)) - (/.size (/.as-pairs sample/0)))) + (/.size (/.as_pairs sample/0)))) (_.cover [/.zip/2] (let [zipped (/.zip/2 sample/0 sample/1) zipped::size (/.size zipped) - size-of-smaller-list! + size_of_smaller_list! (n.= zipped::size (n.min (/.size sample/0) (/.size sample/1))) - can-extract-values! + can_extract_values! (and (/\= (/.take zipped::size sample/0) (/\map product.left zipped)) (/\= (/.take zipped::size sample/1) (/\map product.right zipped)))] - (and size-of-smaller-list! - can-extract-values!))) + (and size_of_smaller_list! + can_extract_values!))) (_.cover [/.zip/3] (let [zipped (/.zip/3 sample/0 sample/1 sample/2) zipped::size (/.size zipped) - size-of-smaller-list! + size_of_smaller_list! (n.= zipped::size ($_ n.min (/.size sample/0) (/.size sample/1) (/.size sample/2))) - can-extract-values! + can_extract_values! (and (/\= (/.take zipped::size sample/0) (/\map product.left zipped)) (/\= (/.take zipped::size sample/1) (/\map (|>> product.right product.left) zipped)) (/\= (/.take zipped::size sample/2) (/\map (|>> product.right product.right) zipped)))] - (and size-of-smaller-list! - can-extract-values!))) + (and size_of_smaller_list! + can_extract_values!))) (_.cover [/.zip] (and (\ (/.equivalence (product.equivalence n.equivalence n.equivalence)) = (/.zip/2 sample/0 sample/1) @@ -321,21 +321,21 @@ (/.zip/3 sample/0 sample/1 sample/2) ((/.zip 3) sample/0 sample/1 sample/2)))) - (_.cover [/.zip-with/2] + (_.cover [/.zip_with/2] (/\= (/\map (function (_ [left right]) (+/2 left right)) (/.zip/2 sample/0 sample/1)) - (/.zip-with/2 +/2 sample/0 sample/1))) - (_.cover [/.zip-with/3] + (/.zip_with/2 +/2 sample/0 sample/1))) + (_.cover [/.zip_with/3] (/\= (/\map (function (_ [left mid right]) (+/3 left mid right)) (/.zip/3 sample/0 sample/1 sample/2)) - (/.zip-with/3 +/3 sample/0 sample/1 sample/2))) - (_.cover [/.zip-with] - (and (/\= (/.zip-with/2 +/2 sample/0 sample/1) - ((/.zip-with 2) +/2 sample/0 sample/1)) - (/\= (/.zip-with/3 +/3 sample/0 sample/1 sample/2) - ((/.zip-with 3) +/3 sample/0 sample/1 sample/2)))) + (/.zip_with/3 +/3 sample/0 sample/1 sample/2))) + (_.cover [/.zip_with] + (and (/\= (/.zip_with/2 +/2 sample/0 sample/1) + ((/.zip_with 2) +/2 sample/0 sample/1)) + (/\= (/.zip_with/3 +/3 sample/0 sample/1 sample/2) + ((/.zip_with 3) +/3 sample/0 sample/1 sample/2)))) (_.cover [/.concat] (and (/\= (/\compose sample/0 sample/1) (/.concat (list sample/0 sample/1))) @@ -407,7 +407,7 @@ (let [sample+ (/.interpose separator sample)] (and (n.= (|> (/.size sample) (n.* 2) dec) (/.size sample+)) - (|> sample+ /.as-pairs (/.every? (|>> product.right (n.= separator)))))))) + (|> sample+ /.as_pairs (/.every? (|>> product.right (n.= separator)))))))) (_.cover [/.iterate] (or (/.empty? sample) (let [size (/.size sample)] |