mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-08-20 04:00:01 +00:00
Add test for row_copy_from_slice to check out-of-bounds access
This commit is contained in:
parent
10018f7efe
commit
a3bb509202
@ -1250,6 +1250,13 @@ mod tests {
|
|||||||
ma.row_copy_from_slice(1, &new_row);
|
ma.row_copy_from_slice(1, &new_row);
|
||||||
assert_eq!(ma.row(1), &[10, 20, 30]);
|
assert_eq!(ma.row(1), &[10, 20, 30]);
|
||||||
}
|
}
|
||||||
|
#[test]
|
||||||
|
#[should_panic(expected = "row index 4 out of bounds for 3 rows")]
|
||||||
|
fn test_row_copy_from_slice_out_of_bounds() {
|
||||||
|
let mut ma = static_test_matrix();
|
||||||
|
let new_row = vec![10, 20, 30];
|
||||||
|
ma.row_copy_from_slice(4, &new_row);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "row index 3 out of bounds for 3 rows")]
|
#[should_panic(expected = "row index 3 out of bounds for 3 rows")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user