diff --git a/src/lib.rs b/src/lib.rs index 1746f69..c9f1013 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -339,6 +339,8 @@ mod test { #[test] fn check_array_ref_5() { fn f(data: Vec, offset: usize) -> quickcheck::TestResult { + // Compute the following, with correct results even if the sum would overflow: + // if data.len() < offset + 5 if data.len() < 5 || data.len() - 5 < offset { return quickcheck::TestResult::discard(); } @@ -351,6 +353,8 @@ mod test { #[test] fn check_array_ref_out_of_bounds_5() { fn f(data: Vec, offset: usize) -> quickcheck::TestResult { + // Compute the following, with correct results even if the sum would overflow: + // if data.len() >= offset + 5 if data.len() >= 5 && data.len() - 5 >= offset { return quickcheck::TestResult::discard(); } @@ -364,6 +368,8 @@ mod test { #[test] fn check_array_mut_ref_7() { fn f(mut data: Vec, offset: usize) -> quickcheck::TestResult { + // Compute the following, with correct results even if the sum would overflow: + // if data.len() < offset + 7 if data.len() < 7 || data.len() - 7 < offset { return quickcheck::TestResult::discard(); } @@ -377,6 +383,8 @@ mod test { #[test] fn check_array_mut_ref_out_of_bounds_32() { fn f(mut data: Vec, offset: usize) -> quickcheck::TestResult { + // Compute the following, with correct results even if the sum would overflow: + // if data.len() >= offset + 32 if data.len() >= 32 && data.len() - 32 >= offset { return quickcheck::TestResult::discard(); }