diff options
Diffstat (limited to 'stdlib/source/test/lux/data')
-rw-r--r-- | stdlib/source/test/lux/data/binary.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/array.lux | 18 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/dictionary.lux | 20 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/dictionary/ordered.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/list.lux | 10 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/row.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/set.lux | 10 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/set/multi.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/set/ordered.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/color.lux | 14 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/product.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/sum.lux | 20 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text.lux | 24 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/encoding.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/escape.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/regex.lux | 8 |
16 files changed, 82 insertions, 82 deletions
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 638668ec5..2d1a25092 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -137,7 +137,7 @@ (_.cover [/.drop] (and (\ /.equivalence = sample (/.drop 0 sample)) (\ /.equivalence = (/.create 0) (/.drop size sample)) - (case (list.reverse (..as_list sample)) + (case (list.reversed (..as_list sample)) #.End false diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index 29f0c733a..d5ea9badf 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -103,9 +103,9 @@ ..structures ..search - (_.cover [/.new /.size] + (_.cover [/.empty /.size] (n.= size (/.size (: (Array Nat) - (/.new size))))) + (/.empty size))))) (_.cover [/.type_name] (case /.Array (^ (#.Named _ (#.UnivQ _ (#.Primitive nominal_type (list (#.Parameter 1)))))) @@ -114,7 +114,7 @@ _ false)) (_.cover [/.read /.write!] - (let [the_array (|> (/.new 2) + (let [the_array (|> (/.empty 2) (: (Array Nat)) (/.write! 0 expected))] (case [(/.read 0 the_array) @@ -125,7 +125,7 @@ _ false))) (_.cover [/.delete!] - (let [the_array (|> (/.new 1) + (let [the_array (|> (/.empty 1) (: (Array Nat)) (/.write! 0 expected))] (case [(/.read 0 the_array) @@ -136,14 +136,14 @@ _ false))) (_.cover [/.contains?] - (let [the_array (|> (/.new 2) + (let [the_array (|> (/.empty 2) (: (Array Nat)) (/.write! 0 expected))] (and (/.contains? 0 the_array) (not (/.contains? 1 the_array))))) (_.cover [/.update!] - (let [the_array (|> (/.new 1) + (let [the_array (|> (/.empty 1) (: (Array Nat)) (/.write! 0 base) (/.update! 0 (n.+ shift)))] @@ -154,7 +154,7 @@ _ false))) (_.cover [/.upsert!] - (let [the_array (|> (/.new 2) + (let [the_array (|> (/.empty 2) (: (Array Nat)) (/.write! 0 base) (/.upsert! 0 dummy (n.+ shift)) @@ -171,7 +171,7 @@ [occupancy (\ ! map (n.% (inc size)) random.nat)] (_.cover [/.occupancy /.vacancy] (let [the_array (loop [output (: (Array Nat) - (/.new size)) + (/.empty size)) idx 0] (if (n.< occupancy idx) (recur (/.write! idx expected output) @@ -191,7 +191,7 @@ [amount (\ ! map (n.% (inc size)) random.nat)] (_.cover [/.copy!] (let [copy (: (Array Nat) - (/.new size))] + (/.empty size))] (exec (/.copy! amount 0 the_array 0 copy) (\ (list.equivalence n.equivalence) = (list.take amount (/.to_list the_array)) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 2cec43439..11c4b59cd 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -47,8 +47,8 @@ 0 (/.empty? dict) _ (not (/.empty? dict)))) - (_.cover [/.new] - (let [sample (/.new n.hash)] + (_.cover [/.empty] + (let [sample (/.empty n.hash)] (and (n.= 0 (/.size sample)) (/.empty? sample)))) @@ -60,7 +60,7 @@ (def: (hash _) constant)))]] (_.cover [/.key_hash] - (is? hash (/.key_hash (/.new hash))))) + (is? hash (/.key_hash (/.empty hash))))) (_.cover [/.entries] (let [entries (/.entries dict) @@ -108,21 +108,21 @@ (n.= (/.size dict) (list.size (/.values dict)))) - (_.cover [/.merge] + (_.cover [/.merged] (let [merging_with_oneself (let [(^open ".") (/.equivalence n.equivalence)] - (= dict (/.merge dict dict))) + (= dict (/.merged dict dict))) overwritting_keys (let [dict' (|> dict /.entries (list\map (function (_ [k v]) [k (inc v)])) (/.of_list n.hash)) (^open ".") (/.equivalence n.equivalence)] - (= dict' (/.merge dict' dict)))] + (= dict' (/.merged dict' dict)))] (and merging_with_oneself overwritting_keys))) - (_.cover [/.merge_with] + (_.cover [/.merged_with] (list.every? (function (_ [x x*2]) (n.= (n.* 2 x) x*2)) (list.zipped/2 (/.values dict) - (/.values (/.merge_with n.+ dict dict))))) + (/.values (/.merged_with n.+ dict dict))))) (_.cover [/.of_list] (let [(^open ".") (/.equivalence n.equivalence)] @@ -230,10 +230,10 @@ (and can_upsert_new_key! can_upsert_old_key!))) - (_.cover [/.select] + (_.cover [/.sub] (|> dict (/.put non_key test_val) - (/.select (list non_key)) + (/.sub (list non_key)) /.size (n.= 1))) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 8302cdf38..4637d3058 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -27,7 +27,7 @@ (-> (Order k) (Random k) (Random v) Nat (Random (/.Dictionary k v)))) (case size 0 - (random\in (/.new order)) + (random\in (/.empty order)) _ (do random.monad @@ -70,8 +70,8 @@ (_.cover [/.empty?] (bit\= (n.= 0 (/.size sample)) (/.empty? sample))) - (_.cover [/.new] - (/.empty? (/.new n.order))) + (_.cover [/.empty] + (/.empty? (/.empty n.order))) (_.cover [/.min] (case [(/.min sample) (list.head sorted_values)] [#.None #.None] diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index a2fc3911d..872c21e2d 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -98,15 +98,15 @@ (n.= 0 (/.size sample)))) (_.cover [/.repeat] (n.= size (/.size (/.repeat size [])))) - (_.cover [/.reverse] + (_.cover [/.reversed] (or (n.< 2 (/.size sample)) (let [not_same! (not (/\= sample - (/.reverse sample))) + (/.reversed sample))) self_symmetry! (/\= sample - (/.reverse (/.reverse sample)))] + (/.reversed (/.reversed sample)))] (and not_same! self_symmetry!)))) (_.cover [/.every? /.any?] @@ -122,7 +122,7 @@ symmetry! (/\= (/.sort <<< sample) - (/.reverse (/.sort (function.flip <<<) sample)))] + (/.reversed (/.sort (function.flip <<<) sample)))] (and size_preservation! symmetry!))) ))) @@ -259,7 +259,7 @@ )] [/.head /.tail |>] - [/.last /.inits /.reverse] + [/.last /.inits /.reversed] )) ))))) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 3ac6e8965..902fec0d8 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -61,15 +61,15 @@ (/.empty? /.empty)) (_.cover [/.to_list /.of_list] (|> sample /.to_list /.of_list (/\= sample))) - (_.cover [/.reverse] + (_.cover [/.reversed] (or (n.< 2 (/.size sample)) (let [not_same! (not (/\= sample - (/.reverse sample))) + (/.reversed sample))) self_symmetry! (/\= sample - (/.reverse (/.reverse sample)))] + (/.reversed (/.reversed sample)))] (and not_same! self_symmetry!)))) (_.cover [/.every? /.any?] diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index 64556ed63..d092dcf6f 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -49,8 +49,8 @@ non_memberL (random.only (|>> (/.member? setL) not) random.nat)] ($_ _.and - (_.cover [/.new] - (/.empty? (/.new n.hash))) + (_.cover [/.empty] + (/.empty? (/.empty n.hash))) (do ! [hash (\ ! map (function (_ constant) (: (Hash Nat) @@ -61,7 +61,7 @@ constant)))) random.nat)] (_.cover [/.member_hash] - (is? hash (/.member_hash (/.new hash))))) + (is? hash (/.member_hash (/.empty hash))))) (_.cover [/.size] (n.= sizeL (/.size setL))) (_.cover [/.empty?] @@ -106,7 +106,7 @@ union_with_empty_set! (|> setL - (/.union (/.new n.hash)) + (/.union (/.empty n.hash)) (\= setL))] (and sets_are_subs_of_their_unions! union_with_empty_set!))) @@ -119,7 +119,7 @@ intersection_with_empty_set! (|> setL - (/.intersection (/.new n.hash)) + (/.intersection (/.empty n.hash)) /.empty?)] (and sets_are_supers_of_their_intersections! intersection_with_empty_set!))) diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 197f35e93..7f23bfe3d 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -32,7 +32,7 @@ element_counts (random.list size ..count)] (in (list\fold (function (_ [count element] set) (/.add count element set)) - (/.new hash) + (/.empty hash) (list.zipped/2 element_counts (set.to_list elements)))))) @@ -46,7 +46,7 @@ (_.for [/.hash] (|> random.nat (\ random.monad map (function (_ single) - (/.add 1 single (/.new n.hash)))) + (/.add 1 single (/.empty n.hash)))) ($hash.spec /.hash))) ))) @@ -132,8 +132,8 @@ (_.cover [/.empty?] (bit\= (/.empty? sample) (n.= 0 (/.size sample)))) - (_.cover [/.new] - (/.empty? (/.new n.hash))) + (_.cover [/.empty] + (/.empty? (/.empty n.hash))) (_.cover [/.support] (list.every? (set.member? (/.support sample)) (/.to_list sample))) diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index 0614a1938..89ce681b0 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -27,7 +27,7 @@ (All [a] (-> Nat (Order a) (Random a) (Random (Set a)))) (case size 0 - (random\in (/.new &order)) + (random\in (/.empty &order)) _ (do random.monad @@ -51,7 +51,7 @@ #let [(^open "/\.") /.equivalence setL (/.of_list n.order listL) setR (/.of_list n.order listR) - empty (/.new n.order)]] + empty (/.empty n.order)]] (`` ($_ _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence (..random sizeL n.order random.nat))) @@ -61,8 +61,8 @@ (_.cover [/.empty?] (bit\= (n.= 0 (/.size setL)) (/.empty? setL))) - (_.cover [/.new] - (/.empty? (/.new n.order))) + (_.cover [/.empty] + (/.empty? (/.empty n.order))) (_.cover [/.to_list] (\ (list.equivalence n.equivalence) = (/.to_list (/.of_list n.order listL)) diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index c118a98ad..81c45a8e2 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -106,17 +106,17 @@ (distance/3 (/.darker ratio colorful) /.black)) (f.<= (distance/3 colorful /.white) (distance/3 (/.brighter ratio colorful) /.white)))) - (_.cover [/.interpolate] + (_.cover [/.interpolated] (and (f.<= (distance/3 colorful /.black) - (distance/3 (/.interpolate ratio /.black colorful) /.black)) + (distance/3 (/.interpolated ratio /.black colorful) /.black)) (f.<= (distance/3 colorful /.white) - (distance/3 (/.interpolate ratio /.white colorful) /.white)))) - (_.cover [/.saturate] + (distance/3 (/.interpolated ratio /.white colorful) /.white)))) + (_.cover [/.saturated] (f.> (saturation mediocre) - (saturation (/.saturate ratio mediocre)))) - (_.cover [/.de_saturate] + (saturation (/.saturated ratio mediocre)))) + (_.cover [/.un_saturated] (f.< (saturation mediocre) - (saturation (/.de_saturate ratio mediocre)))) + (saturation (/.un_saturated ratio mediocre)))) (_.cover [/.gray_scale] (let [gray'ed (/.gray_scale mediocre)] (and (f.= +0.0 diff --git a/stdlib/source/test/lux/data/product.lux b/stdlib/source/test/lux/data/product.lux index 867d8bb84..2f781972d 100644 --- a/stdlib/source/test/lux/data/product.lux +++ b/stdlib/source/test/lux/data/product.lux @@ -17,7 +17,7 @@ (def: #export test Test (<| (_.covering /._) - (_.for [.&]) + (_.for [.Tuple .And]) (do random.monad [expected random.nat shift random.nat diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index 05a2746f7..73765d85f 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -23,7 +23,7 @@ (def: #export test Test (<| (_.covering /._) - (_.for [.|]) + (_.for [.Variant .Or]) (do {! random.monad} [expected random.nat shift random.nat] @@ -43,30 +43,30 @@ (_.cover [/.left] (|> (/.left expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (case> (0 #0 actual) (n.= expected actual) _ false))) (_.cover [/.right] (|> (/.right expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (case> (0 #1 actual) (n.= expected actual) _ false))) (_.cover [/.either] (and (|> (/.left expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (/.either (n.+ shift) (n.- shift)) (n.= (n.+ shift expected))) (|> (/.right expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (/.either (n.+ shift) (n.- shift)) (n.= (n.- shift expected))))) (_.cover [/.apply] (and (|> (/.left expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (/.apply (n.+ shift) (n.- shift)) (case> (0 #0 actual) (n.= (n.+ shift expected) actual) _ false)) (|> (/.right expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (/.apply (n.+ shift) (n.- shift)) (case> (0 #1 actual) (n.= (n.- shift expected) actual) _ false)))) (do ! @@ -74,7 +74,7 @@ expected (random.list size random.nat)] ($_ _.and (_.cover [/.lefts] - (let [actual (: (List (| Nat Nat)) + (let [actual (: (List (Or Nat Nat)) (list\map /.left expected))] (and (\ (list.equivalence n.equivalence) = expected @@ -83,7 +83,7 @@ (list) (/.rights actual))))) (_.cover [/.rights] - (let [actual (: (List (| Nat Nat)) + (let [actual (: (List (Or Nat Nat)) (list\map /.right expected))] (and (\ (list.equivalence n.equivalence) = expected @@ -97,7 +97,7 @@ (if (n.even? value) (/.left value) (/.right value)))) - (: (List (| Nat Nat))) + (: (List (Or Nat Nat))) /.partition)] (and (\ (list.equivalence n.equivalence) = (list.only n.even? expected) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index e1f9c1e4f..82a364120 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -98,20 +98,20 @@ (n.= 1)))) (_.cover [/.index_of'] (let [full (\ /.monoid compose inner outer)] - (and (|> (/.index_of' inner 0 full) + (and (|> (/.index_of' 0 inner full) (maybe.else fake_index) (n.= 0)) - (|> (/.index_of' inner 1 full) + (|> (/.index_of' 1 inner full) (maybe.else fake_index) (n.= fake_index)) - (|> (/.index_of' outer 0 full) + (|> (/.index_of' 0 outer full) (maybe.else fake_index) (n.= 1)) - (|> (/.index_of' outer 1 full) + (|> (/.index_of' 1 outer full) (maybe.else fake_index) (n.= 1)) - (|> (/.index_of' outer 2 full) + (|> (/.index_of' 2 outer full) (maybe.else fake_index) (n.= fake_index))))) (_.cover [/.last_index_of] @@ -124,20 +124,20 @@ (n.= 2))))) (_.cover [/.last_index_of'] (let [full ($_ (\ /.monoid compose) outer inner outer)] - (and (|> (/.last_index_of' inner 0 full) + (and (|> (/.last_index_of' 0 inner full) (maybe.else fake_index) (n.= 1)) - (|> (/.last_index_of' inner 2 full) + (|> (/.last_index_of' 2 inner full) (maybe.else fake_index) (n.= fake_index)) - (|> (/.last_index_of' outer 0 full) + (|> (/.last_index_of' 0 outer full) (maybe.else fake_index) (n.= 2)) - (|> (/.last_index_of' outer 2 full) + (|> (/.last_index_of' 2 outer full) (maybe.else fake_index) (n.= 2)) - (|> (/.last_index_of' outer 3 full) + (|> (/.last_index_of' 3 outer full) (maybe.else fake_index) (n.= fake_index))))) ))) @@ -145,7 +145,7 @@ (def: char Test ($_ _.and - (_.for [/.Char /.of_code] + (_.for [/.Char /.of_char] (`` ($_ _.and (~~ (template [<short> <long>] [(_.cover [<short> <long>] @@ -171,7 +171,7 @@ (_.cover [/.nth] (case (/.nth expected sample) (#.Some char) - (case (/.index_of (/.of_code char) sample) + (case (/.index_of (/.of_char char) sample) (#.Some actual) (n.= expected actual) diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index 11a68ea33..f5670b35f 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -195,7 +195,7 @@ (def: unique_encodings (list\fold (function (_ encoding set) (set.add (/.name encoding) set)) - (set.new text.hash) + (set.empty text.hash) ..all_encodings)) (def: verdict diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 73f9455d7..6899c6f62 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -100,7 +100,7 @@ [left (random.char unicode.character) right (random.char unicode.character)] (_.cover [/.escape /.un_escape] - (let [expected (format (text.of_code left) (text.of_code right))] + (let [expected (format (text.of_char left) (text.of_char right))] (if (or (/.escapable? left) (/.escapable? right)) (let [escaped (/.escape expected)] @@ -114,7 +114,7 @@ (text\= expected (/.escape expected)))))) (do {! random.monad} [dummy (|> (random.char unicode.character) - (\ ! map text.of_code))] + (\ ! map text.of_char))] (_.cover [/.dangling_escape] (case (/.un_escape (format (/.escape dummy) "\")) (#try.Success _) @@ -125,7 +125,7 @@ (do {! random.monad} [dummy (|> (random.char unicode.character) (random.only (|>> (set.member? ..valid_sigils) not)) - (\ ! map text.of_code))] + (\ ! map text.of_char))] (_.cover [/.invalid_escape] (case (/.un_escape (format "\" dummy)) (#try.Success _) diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index ea81e2c77..95f82e502 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -132,9 +132,9 @@ (should_fail (/.regex "\p{Blank}") "."))) (_.test "ASCII." (and (should_pass (/.regex "\p{ASCII}") text.tab) - (should_fail (/.regex "\p{ASCII}") (text.of_code (hex "1234"))))) + (should_fail (/.regex "\p{ASCII}") (text.of_char (hex "1234"))))) (_.test "Control characters." - (and (should_pass (/.regex "\p{Contrl}") (text.of_code (hex "12"))) + (and (should_pass (/.regex "\p{Contrl}") (text.of_char (hex "12"))) (should_fail (/.regex "\p{Contrl}") "a"))) (_.test "Punctuation." (and (should_pass (/.regex "\p{Punct}") "@") @@ -143,8 +143,8 @@ (and (should_pass (/.regex "\p{Graph}") "@") (should_fail (/.regex "\p{Graph}") " "))) (_.test "Print." - (and (should_pass (/.regex "\p{Print}") (text.of_code (hex "20"))) - (should_fail (/.regex "\p{Print}") (text.of_code (hex "1234"))))) + (and (should_pass (/.regex "\p{Print}") (text.of_char (hex "20"))) + (should_fail (/.regex "\p{Print}") (text.of_char (hex "1234"))))) )) (def: custom_character_classes |