From a5a06e49baf6b15eac207fe5b0556617c89fa3d6 Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Fri, 5 Jul 2019 00:56:16 +1000 Subject: [PATCH] test: Update Whisper test for invalid pool size (#10811) --- whisper/cli/src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/whisper/cli/src/main.rs b/whisper/cli/src/main.rs index 41d9e80e4..fbf5b5aa7 100644 --- a/whisper/cli/src/main.rs +++ b/whisper/cli/src/main.rs @@ -332,12 +332,21 @@ mod tests { } #[test] + // The Whisper pool size is of type usize. Invalid Whisper pool sizes include + // values below 0 and either above 2 ** 64 - 1 on a 64-bit processor or + // above 2 ** 32 - 1 on a 32-bit processor. fn invalid_whisper_pool_size() { - let command = vec!["whisper", "--whisper-pool-size=-100000000000000000000000000000000000000"] + let command_pool_size_too_low = vec!["whisper", "--whisper-pool-size=-1"] .into_iter() .map(Into::into) .collect::>(); - assert!(execute(command).is_err()); + let command_pool_size_too_high = vec!["whisper", "--whisper-pool-size=18446744073709552000"] + .into_iter() + .map(Into::into) + .collect::>(); + + assert!(execute(command_pool_size_too_low).is_err()); + assert!(execute(command_pool_size_too_high).is_err()); } }