cross: backfill test for DimensionedSlice::IndexMut

This commit is contained in:
2022-08-17 17:31:11 -07:00
parent 92d4f464e1
commit 1688707aed

View File

@@ -70,7 +70,7 @@ mod test {
3, 4, 5, 3, 4, 5,
0, 10,20, 0, 10,20,
10,40,50, 30,40,50,
]; ];
let s = DimensionedSlice::new(Vec3u::new(3, 2, 2), &data); let s = DimensionedSlice::new(Vec3u::new(3, 2, 2), &data);
assert_eq!(s[Vec3u::new(0, 0, 0)], 0); assert_eq!(s[Vec3u::new(0, 0, 0)], 0);
@@ -79,5 +79,27 @@ mod test {
assert_eq!(s[Vec3u::new(1, 1, 1)], 40); assert_eq!(s[Vec3u::new(1, 1, 1)], 40);
assert_eq!(s[Vec3u::new(2, 1, 1)], 50); assert_eq!(s[Vec3u::new(2, 1, 1)], 50);
} }
#[test]
fn dimensioned_slice_index_mut() {
let mut data = [
0, 1, 2,
3, 4, 5,
0, 10,20,
30,40,50,
];
let mut s = DimensionedSlice::new(Vec3u::new(3, 2, 2), &mut data);
s[Vec3u::new(0, 0, 0)] = 100;
s[Vec3u::new(0, 1, 1)] = 300;
assert_eq!(data, [
100,1, 2,
3, 4, 5,
0, 10, 20,
300,40,50,
]);
}
} }