diff options
Diffstat (limited to 'stdlib/source/test/lux/data')
-rw-r--r-- | stdlib/source/test/lux/data/collection/dictionary.lux | 22 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/dictionary/ordered.lux | 20 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/dictionary/plist.lux | 18 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/list.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/row.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/sequence.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/set.lux | 14 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/set/multi.lux | 26 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/set/ordered.lux | 12 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/color/named.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/format/json.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text.lux | 18 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/encoding.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/escape.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/regex.lux | 9 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/text/unicode/block.lux | 2 |
16 files changed, 88 insertions, 85 deletions
diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index ad8a63d28..8667b7054 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -154,10 +154,10 @@ (#.Some _) false _ true))) - (_.cover [/.put] + (_.cover [/.has] (and (n.= (inc (/.size dict)) - (/.size (/.put non_key test_val dict))) - (case (/.get non_key (/.put non_key test_val dict)) + (/.size (/.has non_key test_val dict))) + (case (/.get non_key (/.has non_key test_val dict)) (#.Some v) (n.= test_val v) _ true))) @@ -184,21 +184,21 @@ (and can_put_new_keys! cannot_put_old_keys!))) - (_.cover [/.remove] - (and (let [base (/.put non_key test_val dict)] + (_.cover [/.lacks] + (and (let [base (/.has non_key test_val dict)] (and (/.key? base non_key) - (not (/.key? (/.remove non_key base) non_key)))) + (not (/.key? (/.lacks non_key base) non_key)))) (case (list.head (/.keys dict)) #.None true (#.Some known_key) (n.= (dec (/.size dict)) - (/.size (/.remove known_key dict)))))) + (/.size (/.lacks known_key dict)))))) - (_.cover [/.update] - (let [base (/.put non_key test_val dict) - updt (/.update non_key inc base)] + (_.cover [/.revised] + (let [base (/.has non_key test_val dict) + updt (/.revised non_key inc base)] (case [(/.get non_key base) (/.get non_key updt)] [(#.Some x) (#.Some y)] (n.= (inc x) y) @@ -232,7 +232,7 @@ (_.cover [/.sub] (|> dict - (/.put non_key test_val) + (/.has non_key test_val) (/.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 adce56dc3..b2bed04f9 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -36,7 +36,7 @@ key (random.only (|>> (/.key? partial) not) gen_key) value gen_value] - (in (/.put key value partial))))) + (in (/.has key value partial))))) (def: .public test Test @@ -107,14 +107,14 @@ (and (list.every? (/.key? sample) (/.keys sample)) (not (/.key? sample extra_key)))) - (_.cover [/.put] + (_.cover [/.has] (and (not (/.key? sample extra_key)) - (let [sample+ (/.put extra_key extra_value sample)] + (let [sample+ (/.has extra_key extra_value sample)] (and (/.key? sample+ extra_key) (n.= (inc (/.size sample)) (/.size sample+)))))) (_.cover [/.get] - (let [sample+ (/.put extra_key extra_value sample)] + (let [sample+ (/.has extra_key extra_value sample)] (case [(/.get extra_key sample) (/.get extra_key sample+)] [#.None (#.Some actual)] @@ -122,15 +122,15 @@ _ false))) - (_.cover [/.remove] + (_.cover [/.lacks] (|> sample - (/.put extra_key extra_value) - (/.remove extra_key) + (/.has extra_key extra_value) + (/.lacks extra_key) (/\= sample))) - (_.cover [/.update] + (_.cover [/.revised] (|> sample - (/.put extra_key extra_value) - (/.update extra_key (n.+ shift)) + (/.has extra_key extra_value) + (/.revised extra_key (n.+ shift)) (/.get extra_key) (maybe\map (n.= (n.+ shift extra_value))) (maybe.else false))) diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index ad74dc0a0..b36d5d9d2 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux @@ -65,28 +65,28 @@ (/.contains? key sample)) (/.keys sample)) (not (/.contains? extra_key sample)))) - (_.cover [/.put] - (let [sample+ (/.put extra_key extra_value sample)] + (_.cover [/.has] + (let [sample+ (/.has extra_key extra_value sample)] (and (not (/.contains? extra_key sample)) (/.contains? extra_key sample+) (n.= (inc (/.size sample)) (/.size sample+))))) (_.cover [/.get] (|> sample - (/.put extra_key extra_value) + (/.has extra_key extra_value) (/.get extra_key) (maybe\map (n.= extra_value)) (maybe.else false))) - (_.cover [/.update] + (_.cover [/.revised] (|> sample - (/.put extra_key extra_value) - (/.update extra_key (n.+ shift)) + (/.has extra_key extra_value) + (/.revised extra_key (n.+ shift)) (/.get extra_key) (maybe\map (n.= (n.+ shift extra_value))) (maybe.else false))) - (_.cover [/.remove] + (_.cover [/.lacks] (|> sample - (/.put extra_key extra_value) - (/.remove extra_key) + (/.has extra_key extra_value) + (/.lacks extra_key) (\ (/.equivalence n.equivalence) = sample))) )))) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 426b556b8..e9be412e2 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -222,7 +222,7 @@ (let [subs (/.sub sub_size sample)] (and (/.every? (|>> /.size (n.<= sub_size)) subs) (/\= sample - (/.concat subs))))) + (/.joined subs))))) )))) (def: member @@ -341,11 +341,11 @@ ((/.zipped_with 2) +/2 sample/0 sample/1)) (/\= (/.zipped_with/3 +/3 sample/0 sample/1 sample/2) ((/.zipped_with 3) +/3 sample/0 sample/1 sample/2)))) - (_.cover [/.concat] + (_.cover [/.joined] (and (/\= (/\compose sample/0 sample/1) - (/.concat (list sample/0 sample/1))) + (/.joined (list sample/0 sample/1))) (/\= ($_ /\compose sample/0 sample/1 sample/2) - (/.concat (list sample/0 sample/1 sample/2))))) + (/.joined (list sample/0 sample/1 sample/2))))) )))) (def: search diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index c57711e8e..a6e4679fb 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -104,11 +104,11 @@ [sample (/.put good_index non_member sample) actual (/.item good_index sample)] (in (is? non_member actual))))) - (_.cover [/.update] + (_.cover [/.revised] (<| (try.else false) (do try.monad [sample (/.put good_index non_member sample) - sample (/.update good_index inc sample) + sample (/.revised good_index inc sample) actual (/.item good_index sample)] (in (n.= (inc non_member) actual))))) (_.cover [/.within_bounds?] @@ -125,7 +125,7 @@ (exception.match? /.index_out_of_bounds error))))] (and (fails! (/.item bad_index sample)) (fails! (/.put bad_index non_member sample)) - (fails! (/.update bad_index inc sample))))) + (fails! (/.revised bad_index inc sample))))) )) ))) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 7485d857c..61c301f94 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -103,7 +103,7 @@ offset))))) (_.cover [/.cycle] (let [cycle (list& cycle_start cycle_next)] - (list\= (list.concat (list.repeated size cycle)) + (list\= (list.joined (list.repeated size cycle)) (/.take (n.* size (list.size cycle)) (/.cycle [cycle_start cycle_next]))))) (_.cover [/.^sequence&] diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index 18e0a03f0..bd76d5bf3 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -72,28 +72,28 @@ (_.cover [/.member?] (and (list.every? (/.member? setL) (/.list setL)) (not (/.member? setL non_memberL)))) - (_.cover [/.add] + (_.cover [/.has] (let [before_addition! (not (/.member? setL non_memberL)) after_addition! - (/.member? (/.add non_memberL setL) non_memberL) + (/.member? (/.has non_memberL setL) non_memberL) size_increase! (n.= (inc (/.size setL)) - (/.size (/.add non_memberL setL)))] + (/.size (/.has non_memberL setL)))] (and before_addition! after_addition!))) - (_.cover [/.remove] + (_.cover [/.lacks] (let [symmetry! (|> setL - (/.add non_memberL) - (/.remove non_memberL) + (/.has non_memberL) + (/.lacks non_memberL) (\= setL)) idempotency! (|> setL - (/.remove non_memberL) + (/.lacks non_memberL) (\= setL))] (and symmetry! idempotency!))) diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 888ea2623..09c7c2cd5 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -31,7 +31,7 @@ [elements (random.set hash size element) element_counts (random.list size ..count)] (in (list\fold (function (_ [count element] set) - (/.add count element set)) + (/.has count element set)) (/.empty hash) (list.zipped/2 element_counts (set.list elements)))))) @@ -46,7 +46,7 @@ (_.for [/.hash] (|> random.nat (\ random.monad map (function (_ single) - (/.add 1 single (/.empty n.hash)))) + (/.has 1 single (/.empty n.hash)))) ($hash.spec /.hash))) ))) @@ -155,32 +155,32 @@ (/.list sample))] (and non_members_have_0_multiplicity! every_member_has_positive_multiplicity!))) - (_.cover [/.add] + (_.cover [/.has] (let [null_scenario! (|> sample - (/.add 0 non_member) + (/.has 0 non_member) (\ /.equivalence = sample)) normal_scenario! - (let [sample+ (/.add addition_count non_member sample)] + (let [sample+ (/.has addition_count non_member sample)] (and (not (/.member? sample non_member)) (/.member? sample+ non_member) (n.= addition_count (/.multiplicity sample+ non_member))))] (and null_scenario! normal_scenario!))) - (_.cover [/.remove] + (_.cover [/.lacks] (let [null_scenario! (\ /.equivalence = (|> sample - (/.add addition_count non_member)) + (/.has addition_count non_member)) (|> sample - (/.add addition_count non_member) - (/.remove 0 non_member))) + (/.has addition_count non_member) + (/.lacks 0 non_member))) partial_scenario! (let [sample* (|> sample - (/.add addition_count non_member) - (/.remove partial_removal_count non_member))] + (/.has addition_count non_member) + (/.lacks partial_removal_count non_member))] (and (/.member? sample* non_member) (n.= (n.- partial_removal_count addition_count) @@ -188,8 +188,8 @@ total_scenario! (|> sample - (/.add addition_count non_member) - (/.remove addition_count non_member) + (/.has addition_count non_member) + (/.lacks addition_count non_member) (\ /.equivalence = sample))] (and null_scenario! partial_scenario! diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index d5ff02472..725c4b3c0 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -34,7 +34,7 @@ [partial (random (dec size) &order gen_value) value (random.only (|>> (/.member? partial) not) gen_value)] - (in (/.add value partial))))) + (in (/.has value partial))))) (def: .public test Test @@ -91,16 +91,16 @@ (not (/.member? setL non_memberL))] (and members_are_identified! non_members_are_not_identified!))) - (_.cover [/.add] - (let [setL+ (/.add non_memberL setL)] + (_.cover [/.has] + (let [setL+ (/.has non_memberL setL)] (and (not (/.member? setL non_memberL)) (/.member? setL+ non_memberL) (n.= (inc (/.size setL)) (/.size setL+))))) - (_.cover [/.remove] + (_.cover [/.lacks] (|> setL - (/.add non_memberL) - (/.remove non_memberL) + (/.has non_memberL) + (/.lacks non_memberL) (\ /.equivalence = setL))) (_.cover [/.sub?] (let [self! diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux index 6d0130db6..aaf1fcab8 100644 --- a/stdlib/source/test/lux/data/color/named.lux +++ b/stdlib/source/test/lux/data/color/named.lux @@ -201,7 +201,7 @@ /.yellow_green]] )] (def: all_colors - (list.concat (`` (list (~~ (template [<definition> <by_letter>] + (list.joined (`` (list (~~ (template [<definition> <by_letter>] [((: (-> Any (List //.Color)) (function (_ _) (`` (list (~~ (template.spliced <by_letter>)))))) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 0444588e1..51bc3ac0e 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -46,17 +46,17 @@ (random.dictionary text.hash size (random.unicode size) recur) ))))) -(syntax: (boolean) +(syntax: (boolean []) (do meta.monad [value meta.seed] (in (list (code.bit (n.even? value)))))) -(syntax: (number) +(syntax: (number []) (do meta.monad [value meta.seed] (in (list (code.frac (n.frac value)))))) -(syntax: (string) +(syntax: (string []) (do meta.monad [value (macro.identifier "string")] (in (list (code.text (%.code value)))))) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 3c70075d1..f2bcccfc6 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -148,7 +148,7 @@ (do {! random.monad} [size (\ ! map (|>> (n.% 10) inc) random.nat) characters (random.set /.hash size (random.ascii/alpha 1)) - .let [sample (|> characters set.list /.concat)] + .let [sample (|> characters set.list /.joined)] expected (\ ! map (n.% size) random.nat)] (_.cover [/.char] (case (/.char expected sample) @@ -182,7 +182,7 @@ characters (random.set /.hash size (random.ascii/alpha 1)) separator (random.only (|>> (set.member? characters) not) (random.ascii/alpha 1)) - .let [with_no_separator (|> characters set.list /.concat)] + .let [with_no_separator (|> characters set.list /.joined)] static (random.ascii/alpha 1) .let [dynamic (random.only (|>> (\ /.equivalence = static) not) (random.ascii/alpha 1))] @@ -192,9 +192,9 @@ lower (random.ascii/lower 1) upper (random.ascii/upper 1)] ($_ _.and - (_.cover [/.concat] + (_.cover [/.joined] (n.= (set.size characters) - (/.size (/.concat (set.list characters))))) + (/.size (/.joined (set.list characters))))) (_.cover [/.join_with /.split_all_with] (and (|> (set.list characters) (/.join_with separator) @@ -202,7 +202,7 @@ (set.of_list /.hash) (\ set.equivalence = characters)) (\ /.equivalence = - (/.concat (set.list characters)) + (/.joined (set.list characters)) (/.join_with "" (set.list characters))))) (_.cover [/.replaced/1] (\ /.equivalence = @@ -285,7 +285,7 @@ sampleL (random.unicode sizeL) sampleR (random.unicode sizeR) middle (random.unicode 1) - .let [sample (/.concat (list sampleL sampleR)) + .let [sample (/.joined (list sampleL sampleR)) (^open "/\.") /.equivalence]] ($_ _.and (_.cover [/.split] @@ -293,7 +293,7 @@ (case> (#.Right [_l _r]) (and (/\= sampleL _l) (/\= sampleR _r) - (/\= sample (/.concat (list _l _r)))) + (/\= sample (/.joined (list _l _r)))) _ #0))) @@ -323,8 +323,8 @@ .let [part_gen (|> (random.text normal_char_gen sizeP) (random.only (|>> (/.contains? sep1) not)))] parts (random.list sizeL part_gen) - .let [sample1 (/.concat (list.interposed sep1 parts)) - sample2 (/.concat (list.interposed sep2 parts)) + .let [sample1 (/.joined (list.interposed sep1 parts)) + sample2 (/.joined (list.interposed sep2 parts)) (^open "/\.") /.equivalence]] (_.cover [/.replaced] (/\= sample2 diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index 126cb6556..34d6ee08d 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -190,11 +190,11 @@ <encodings>)] (def: all_encodings - (list.concat (list <named>))) + (list.joined (list <named>))) (def: unique_encodings (list\fold (function (_ encoding set) - (set.add (/.name encoding) set)) + (set.has (/.name encoding) set)) (set.empty text.hash) ..all_encodings)) diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 8e8c4b1df..dcb562a3e 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -69,14 +69,14 @@ (debug.private /.\\_sigil) (debug.private /.\u_sigil)))) -(syntax: (static_sample) +(syntax: (static_sample []) (do meta.monad [seed meta.seed .let [[_ expected] (random.result (random.pcg_32 [seed seed]) (random.ascii 10))]] (in (list (code.text expected))))) -(syntax: (static_escaped {un_escaped <code>.text}) +(syntax: (static_escaped [un_escaped <code>.text]) (in (list (code.text (/.escaped un_escaped))))) (def: .public test diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index c0b1f9183..1e77a7904 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -8,7 +8,8 @@ pipe ["." try] [parser - ["<.>" text (#+ Parser)]]] + ["<.>" text (#+ Parser)] + ["<.>" code]]] [data ["." text ("#\." equivalence) ["%" format (#+ format)]]] @@ -51,7 +52,9 @@ _ false))) -(syntax: (should_check pattern regex input) +(syntax: (should_check [pattern <code>.any + regex <code>.any + input <code>.any]) (macro.with_identifiers [g!message g!_] (in (list (` (|> (~ input) (<text>.result (~ regex)) @@ -269,7 +272,7 @@ "123-456-7890"))) )) -(syntax: (expands? form) +(syntax: (expands? [form <code>.any]) (function (_ lux) (#try.Success [lux (list (code.bit (case (macro.single_expansion form lux) (#try.Success _) diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index 6cdc5f091..db419c3dc 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -157,7 +157,7 @@ [(def: <definition> Test (`` (_.cover [(~~ (template.spliced <part>))] - (let [all (list.concat (list <named>)) + (let [all (list.joined (list <named>)) unique (set.of_list /.hash all)] (n.= (list.size all) (set.size unique))))))] |