Skip to content

Commit 008eecb

Browse files
committed
ixdyn: Add another test
1 parent 2bd8206 commit 008eecb

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/ixdyn.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,25 @@ fn test_ixdyn_iterate() {
5151
}
5252
}
5353

54+
#[test]
55+
fn test_ixdyn_index_iterate() {
56+
for &rev in &[false, true] {
57+
let mut a = Array::zeros((2, 3, 4).set_f(rev));
58+
let dim = a.shape().to_vec();
59+
for ((i, j, k), elt) in a.indexed_iter_mut() {
60+
*elt = i + 10 * j + 100 * k;
61+
}
62+
let a = a.into_shape(dim).unwrap();
63+
println!("{:?}", a.dim());
64+
let mut c = 0;
65+
for (i, elt) in a.indexed_iter() {
66+
assert_eq!(a[i], *elt);
67+
c += 1;
68+
}
69+
assert_eq!(c, a.len());
70+
}
71+
}
72+
5473
#[test]
5574
fn test_ixdyn_uget() {
5675
// check that we are out of bounds

0 commit comments

Comments
 (0)