@@ -339,6 +339,8 @@ mod test {
339
339
#[ test]
340
340
fn check_array_ref_5 ( ) {
341
341
fn f ( data : Vec < u8 > , offset : usize ) -> quickcheck:: TestResult {
342
+ // Compute the following, with correct results even if the sum would overflow:
343
+ // if data.len() < offset + 5
342
344
if data. len ( ) < 5 || data. len ( ) - 5 < offset {
343
345
return quickcheck:: TestResult :: discard ( ) ;
344
346
}
@@ -351,6 +353,8 @@ mod test {
351
353
#[ test]
352
354
fn check_array_ref_out_of_bounds_5 ( ) {
353
355
fn f ( data : Vec < u8 > , offset : usize ) -> quickcheck:: TestResult {
356
+ // Compute the following, with correct results even if the sum would overflow:
357
+ // if data.len() >= offset + 5
354
358
if data. len ( ) >= 5 && data. len ( ) - 5 >= offset {
355
359
return quickcheck:: TestResult :: discard ( ) ;
356
360
}
@@ -364,6 +368,8 @@ mod test {
364
368
#[ test]
365
369
fn check_array_mut_ref_7 ( ) {
366
370
fn f ( mut data : Vec < u8 > , offset : usize ) -> quickcheck:: TestResult {
371
+ // Compute the following, with correct results even if the sum would overflow:
372
+ // if data.len() < offset + 7
367
373
if data. len ( ) < 7 || data. len ( ) - 7 < offset {
368
374
return quickcheck:: TestResult :: discard ( ) ;
369
375
}
@@ -377,6 +383,8 @@ mod test {
377
383
#[ test]
378
384
fn check_array_mut_ref_out_of_bounds_32 ( ) {
379
385
fn f ( mut data : Vec < u8 > , offset : usize ) -> quickcheck:: TestResult {
386
+ // Compute the following, with correct results even if the sum would overflow:
387
+ // if data.len() >= offset + 32
380
388
if data. len ( ) >= 32 && data. len ( ) - 32 >= offset {
381
389
return quickcheck:: TestResult :: discard ( ) ;
382
390
}
0 commit comments