Skip to content

Commit 790201e

Browse files
committed
improved test
1 parent dbbf47c commit 790201e

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

tests/oper.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ fn fold_and_sum() {
272272
}
273273

274274
#[test]
275-
fn fold_and_prod() {
276-
let a = Array::linspace(0., 127., 128).into_shape((8, 16)).unwrap();
275+
fn scalar_prod() {
276+
let a = Array::linspace(0.5, 2., 128).into_shape((8, 16)).unwrap();
277277
assert_approx_eq(a.fold(1., |acc, &x| acc * x), a.scalar_prod(), 1e-5);
278278

279279
// test different strides
@@ -289,25 +289,6 @@ fn fold_and_prod() {
289289
assert_approx_eq(prod, a1.scalar_prod(), 1e-5);
290290
}
291291
}
292-
293-
// skip a few elements
294-
let max = 8 as Ixs;
295-
for i in 1..max {
296-
for skip in 1..max {
297-
let a1 = a.slice(s![.., ..;i]);
298-
let mut iter1 = a1.iter();
299-
for _ in 0..skip {
300-
iter1.next();
301-
}
302-
let iter2 = iter1.clone();
303-
304-
let mut prod = 1.;
305-
for elt in iter1 {
306-
prod *= *elt;
307-
}
308-
assert_approx_eq(iter2.fold(1., |acc, &x| acc * x), prod, 1e-5);
309-
}
310-
}
311292
}
312293

313294
fn range_mat(m: Ix, n: Ix) -> Array2<f32> {

0 commit comments

Comments
 (0)