Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions core/tests/behavior/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,6 @@ pub fn init_service<B: Builder>() -> Option<Operator> {
Some(op)
}

pub fn gen_bytes() -> (Vec<u8>, usize) {
let mut rng = thread_rng();

let size = rng.gen_range(1..4 * 1024 * 1024);
let mut content = vec![0; size];
rng.fill_bytes(&mut content);

(content, size)
}

pub fn gen_bytes_with_range(range: impl SampleRange<usize>) -> (Vec<u8>, usize) {
let mut rng = thread_rng();

Expand All @@ -116,11 +106,12 @@ pub fn gen_bytes_with_range(range: impl SampleRange<usize>) -> (Vec<u8>, usize)
(content, size)
}

pub fn gen_fixed_bytes(size: usize) -> Vec<u8> {
let mut rng = thread_rng();
pub fn gen_bytes() -> (Vec<u8>, usize) {
gen_bytes_with_range(1..4 * 1024 * 1024)
}

let mut content = vec![0; size];
rng.fill_bytes(&mut content);
pub fn gen_fixed_bytes(size: usize) -> Vec<u8> {
let (content, _) = gen_bytes_with_range(size..=size);

content
}
Expand Down