mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
fuzz: adapt to API changes of rand
This commit is contained in:
parent
527602248f
commit
9aec9dc454
13 changed files with 115 additions and 115 deletions
|
@ -18,13 +18,13 @@ use crate::fuzz_common::{
|
|||
static CMD_PATH: &str = "split";
|
||||
|
||||
fn generate_split_args() -> String {
|
||||
let mut rng = rand::thread_rng();
|
||||
let mut rng = rand::rng();
|
||||
let mut args = Vec::new();
|
||||
|
||||
match rng.gen_range(0..=9) {
|
||||
match rng.random_range(0..=9) {
|
||||
0 => {
|
||||
args.push(String::from("-a")); // Suffix length
|
||||
args.push(rng.gen_range(1..=8).to_string());
|
||||
args.push(rng.random_range(1..=8).to_string());
|
||||
}
|
||||
1 => {
|
||||
args.push(String::from("--additional-suffix"));
|
||||
|
@ -32,17 +32,17 @@ fn generate_split_args() -> String {
|
|||
}
|
||||
2 => {
|
||||
args.push(String::from("-b")); // Bytes per output file
|
||||
args.push(rng.gen_range(1..=1024).to_string() + "K");
|
||||
args.push(rng.random_range(1..=1024).to_string() + "K");
|
||||
}
|
||||
3 => {
|
||||
args.push(String::from("-C")); // Line bytes
|
||||
args.push(rng.gen_range(1..=1024).to_string());
|
||||
args.push(rng.random_range(1..=1024).to_string());
|
||||
}
|
||||
4 => args.push(String::from("-d")), // Use numeric suffixes
|
||||
5 => args.push(String::from("-x")), // Use hex suffixes
|
||||
6 => {
|
||||
args.push(String::from("-l")); // Number of lines per output file
|
||||
args.push(rng.gen_range(1..=1000).to_string());
|
||||
args.push(rng.random_range(1..=1000).to_string());
|
||||
}
|
||||
7 => {
|
||||
args.push(String::from("--filter"));
|
||||
|
@ -61,11 +61,11 @@ fn generate_split_args() -> String {
|
|||
|
||||
// Function to generate a random string of lines
|
||||
fn generate_random_lines(count: usize) -> String {
|
||||
let mut rng = rand::thread_rng();
|
||||
let mut rng = rand::rng();
|
||||
let mut lines = Vec::new();
|
||||
|
||||
for _ in 0..count {
|
||||
lines.push(generate_random_string(rng.gen_range(1..=20)));
|
||||
lines.push(generate_random_string(rng.random_range(1..=20)));
|
||||
}
|
||||
|
||||
lines.join("\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue