Skip to content

Commit 932fbc0

Browse files
committed
update test for ndg make
1 parent 1e25447 commit 932fbc0

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tests/ndg_make.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use ndarray::array;
1+
use ndarray::{array, Array1};
2+
use approx::assert_abs_diff_eq;
23

34
use csaps::GridCubicSmoothingSpline;
45

@@ -19,5 +20,19 @@ fn test_make_surface() {
1920
let s = GridCubicSmoothingSpline::new(&x, &y)
2021
.make().unwrap();
2122

22-
assert!(s.spline().is_some())
23+
let coeffs_expected = array![
24+
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
25+
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
26+
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
27+
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
28+
[0., 0., 0., 0., 0., 0., 0., 0., 0., 4., 4., 4.],
29+
[0., 0., 0., 0., 0., 0., 0., 0., 0., 4., 4., 4.],
30+
[0., 0., 0., 0., 0., 0., 1., 1., 1., 1., 2., 3.],
31+
[0., 0., 0., 0., 0., 0., 1., 1., 1., 5., 6., 7.],
32+
];
33+
34+
let smooth: Array1<f64> = s.smooth().iter().map(|v| v.unwrap()).collect();
35+
36+
assert_abs_diff_eq!(smooth, array![0.8999999999999999, 0.8999999999999999]);
37+
assert_abs_diff_eq!(s.spline().unwrap().coeffs(), coeffs_expected)
2338
}

0 commit comments

Comments
 (0)