From ac6b7a6494f3d7bb89ede1fb0eb3f51f68a8c505 Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Fri, 28 Jun 2019 07:40:47 +0200 Subject: [PATCH] test: Update Whisper test for invalid pool size --- 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 41d9e80e42d..fbf5b5aa7fe 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()); } }