@@ -5,10 +5,43 @@ use csaps::GridCubicSmoothingSpline;
55
66
77#[ test]
8- fn test_make_surface ( ) {
8+ fn test_make_vector_1 ( ) {
9+ let x0 = array ! [ 1. , 2. , 3. , 4. ] ;
10+ let x = vec ! [ x0. view( ) ] ;
11+
12+ let y = array ! [ 1. , 2. , 3. , 4. ] ;
13+
14+ let yi = GridCubicSmoothingSpline :: new ( & x, & y)
15+ . make ( ) . unwrap ( )
16+ . evaluate ( & x) . unwrap ( ) ;
17+
18+ assert_abs_diff_eq ! ( yi, y) ;
19+ }
20+
21+
22+ #[ test]
23+ fn test_make_vector_2 ( ) {
24+ let x0 = array ! [ 1. , 2. , 3. , 4. ] ;
25+ let x = vec ! [ x0. view( ) ] ;
26+
27+ let xi0 = array ! [ 1. , 1.5 , 2. , 2.5 , 3. , 3.5 , 4. ] ;
28+ let xi = vec ! [ xi0. view( ) ] ;
29+
30+ let y = array ! [ 1. , 2. , 3. , 4. ] ;
31+ let yi_expected = array ! [ 1. , 1.5 , 2. , 2.5 , 3. , 3.5 , 4. ] ;
32+
33+ let yi = GridCubicSmoothingSpline :: new ( & x, & y)
34+ . make ( ) . unwrap ( )
35+ . evaluate ( & xi) . unwrap ( ) ;
36+
37+ assert_abs_diff_eq ! ( yi, yi_expected) ;
38+ }
39+
40+
41+ #[ test]
42+ fn test_make_surface_1 ( ) {
943 let x0 = array ! [ 1. , 2. , 3. ] ;
1044 let x1 = array ! [ 1. , 2. , 3. , 4. ] ;
11-
1245 let x = vec ! [ x0. view( ) , x1. view( ) ] ;
1346
1447 let y = array ! [
@@ -26,7 +59,7 @@ fn test_make_surface() {
2659
2760
2861#[ test]
29- fn test_make_surface_1 ( ) {
62+ fn test_make_surface_2 ( ) {
3063 let x0 = array ! [ 1. , 2. , 3. ] ;
3164 let x1 = array ! [ 1. , 2. , 3. , 4. ] ;
3265 let x = vec ! [ x0. view( ) , x1. view( ) ] ;
0 commit comments