From 120ebb44dbb1a20fc150e5e58099f90be2e61d49 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 8 Apr 2022 21:32:38 -0400 Subject: Better names for random text/character generators. --- .../specification/compositor/analysis/type.lux | 2 +- .../specification/compositor/generation/common.lux | 8 ++--- .../compositor/generation/reference.lux | 2 +- stdlib/source/specification/lux/world/console.lux | 36 +++++++++++----------- stdlib/source/specification/lux/world/file.lux | 24 +++++++-------- stdlib/source/specification/lux/world/shell.lux | 2 +- 6 files changed, 37 insertions(+), 37 deletions(-) (limited to 'stdlib/source/specification') diff --git a/stdlib/source/specification/compositor/analysis/type.lux b/stdlib/source/specification/compositor/analysis/type.lux index b84e18888..5f2820ba2 100644 --- a/stdlib/source/specification/compositor/analysis/type.lux +++ b/stdlib/source/specification/compositor/analysis/type.lux @@ -48,7 +48,7 @@ [r.int {0 #0 "#I64" {0 #1 {0 #0 "#Int" {0 #0}} {0 #0}}} code.int] [r.rev {0 #0 "#I64" {0 #1 {0 #0 "#Rev" {0 #0}} {0 #0}}} code.rev] [r.safe_frac {0 #0 "#Frac" {0 #0}} code.frac] - [(r.ascii/upper_alpha 5) {0 #0 "#Text" {0 #0}} code.text] + [(r.upper_case_alpha 5) {0 #0 "#Text" {0 #0}} code.text] ))))) (def: .public (spec expander state) diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index 599dae209..77854d953 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -183,9 +183,9 @@ (-> Runner Test) (do [! r.monad] [sample_size (|> r.nat (# ! each (|>> (n.% 10) (n.max 1)))) - sample_lower (r.ascii/lower_alpha sample_size) - sample_upper (r.ascii/upper_alpha sample_size) - sample_alpha (|> (r.ascii/alpha sample_size) + sample_lower (r.lower_case_alpha sample_size) + sample_upper (r.upper_case_alpha sample_size) + sample_alpha (|> (r.alphabetic sample_size) (r.only (|>> (text#= sample_upper) not))) char_idx (|> r.nat (# ! each (n.% sample_size))) .let [sample_lowerS (synthesis.text sample_lower) @@ -303,7 +303,7 @@ (def: (io run) (-> Runner Test) (do r.monad - [message (r.ascii/alpha 5)] + [message (r.alphabetic 5)] (all _.and (_.test "Can log messages." (|> {synthesis.#Extension "lux io log" diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux index f9d5e3ec9..df9482058 100644 --- a/stdlib/source/specification/compositor/generation/reference.lux +++ b/stdlib/source/specification/compositor/generation/reference.lux @@ -21,7 +21,7 @@ (def: symbol (Random Symbol) - (let [symbol_part (r.ascii/upper_alpha 5)] + (let [symbol_part (r.upper_case_alpha 5)] [(r.and symbol_part symbol_part)])) (def: (definition define) diff --git a/stdlib/source/specification/lux/world/console.lux b/stdlib/source/specification/lux/world/console.lux index e40230f94..e9faf9834 100644 --- a/stdlib/source/specification/lux/world/console.lux +++ b/stdlib/source/specification/lux/world/console.lux @@ -1,26 +1,26 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - [io {"+" IO}] - ["[0]" try] - [concurrency - ["[0]" async {"+" Async}]]] - [data - ["[0]" text - ["%" format {"+" format}]]] - [math - ["[0]" random]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + [io {"+" IO}] + ["[0]" try] + [concurrency + ["[0]" async {"+" Async}]]] + [data + ["[0]" text + ["%" format {"+" format}]]] + [math + ["[0]" random]]]] + [\\library + ["[0]" /]]) (def: .public (spec console) (-> (IO (/.Console Async)) Test) (do random.monad - [message (random.ascii/alpha 10)] + [message (random.alphabetic 10)] (in (do async.monad [console (async.future console) ?write (# console write (format message text.new_line)) diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index d4a0e591d..75bf2a571 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -34,8 +34,8 @@ (-> (IO (/.System Async)) Test) (<| (_.for [/.Path]) (do [! random.monad] - [parent (random.ascii/numeric 2) - child (random.ascii/numeric 2)]) + [parent (random.numeric 2) + child (random.numeric 2)]) in (do async.monad [fs (async.future fs)] @@ -157,14 +157,14 @@ (def: (for_system fs) (-> (IO (/.System Async)) Test) (<| (do [! random.monad] - [parent (random.ascii/numeric 2) - child (random.ascii/numeric 2) + [parent (random.numeric 2) + child (random.numeric 2) sub_dir (random.only (|>> (text#= child) not) - (random.ascii/numeric 2)) + (random.numeric 2)) alternate_child (random.only (predicate.and (|>> (text#= child) not) (|>> (text#= sub_dir) not)) - (random.ascii/numeric 2)) + (random.numeric 2)) expected_file_size (# ! each (|>> (n.% 10) ++) random.nat) content ($binary.random expected_file_size) appendix ($binary.random expected_file_size) @@ -208,9 +208,9 @@ (def: (make_directories&cannot_make_directory fs) (-> (IO (/.System Async)) Test) (<| (do [! random.monad] - [dir/0 (random.ascii/numeric 2) - dir/1 (random.ascii/numeric 2) - dir/2 (random.ascii/numeric 2)]) + [dir/0 (random.numeric 2) + dir/1 (random.numeric 2) + dir/2 (random.numeric 2)]) in (do [! async.monad] [fs (async.future fs) @@ -255,7 +255,7 @@ (def: (make_file&cannot_make_file fs) (-> (IO (/.System Async)) Test) (<| (do [! random.monad] - [file/0 (random.ascii/numeric 3)]) + [file/0 (random.numeric 3)]) in (do [! async.monad] [fs (async.future fs) @@ -285,9 +285,9 @@ (def: (exists? fs) (-> (IO (/.System Async)) Test) (<| (do [! random.monad] - [file (random.ascii/numeric 2) + [file (random.numeric 2) dir (random.only (|>> (text#= file) not) - (random.ascii/numeric 2))]) + (random.numeric 2))]) in (do [! async.monad] [fs (async.future fs) diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux index 30c061ca3..3b367bdd1 100644 --- a/stdlib/source/specification/lux/world/shell.lux +++ b/stdlib/source/specification/lux/world/shell.lux @@ -70,7 +70,7 @@ (-> (/.Shell Async) Test) (<| (_.for [/.Shell /.Process]) (do [! random.monad] - [message (random.ascii/alpha 10) + [message (random.alphabetic 10) seconds (# ! each (|>> (n.% 5) (n.+ 5)) random.nat)] (in (do [! async.monad] [?echo (# shell execute (..echo! message)) -- cgit v1.2.3