mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-08-20 13:00:00 +00:00
Add unit test for mutable data access in Matrix
This commit is contained in:
parent
a188d162a7
commit
6804e7ca5a
@ -613,6 +613,22 @@ mod tests {
|
|||||||
assert_eq!(rows[1], vec![2, 4, 6, 8]);
|
assert_eq!(rows[1], vec![2, 4, 6, 8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test data_mut
|
||||||
|
#[test]
|
||||||
|
fn test_data_mut() {
|
||||||
|
let mut matrix = create_test_matrix(); // 3x3
|
||||||
|
// 1 4 7
|
||||||
|
// 2 5 8
|
||||||
|
// 3 6 9
|
||||||
|
|
||||||
|
let data_mut = matrix.data_mut();
|
||||||
|
data_mut[0] = 10;
|
||||||
|
data_mut[1] = 20;
|
||||||
|
|
||||||
|
assert_eq!(matrix[(0, 0)], 10);
|
||||||
|
assert_eq!(matrix[(1, 0)], 20);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_matrix_row_get_and_iter() {
|
fn test_matrix_row_get_and_iter() {
|
||||||
let matrix = create_test_matrix_2x4(); // 2x4
|
let matrix = create_test_matrix_2x4(); // 2x4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user