Add tests for from_shape_fn() with Ix0
@@ -44,6 +44,14 @@ fn test_uninit() {
}
}
+#[test]
+fn test_from_fn_c0() {
+ let a = Array::from_shape_fn((), |i| i);
+ assert_eq!(a[()], ());
+ assert_eq!(a.len(), 1);
+ assert_eq!(a.shape(), &[]);
+}
+
#[test]
fn test_from_fn_c1() {
let a = Array::from_shape_fn(28, |i| i);
@@ -68,6 +76,14 @@ fn test_from_fn_c3() {
}
}
+#[test]
+fn test_from_fn_f0() {
+ let a = Array::from_shape_fn(().f(), |i| i);
+ assert_eq!(a[()], ());
+ assert_eq!(a.len(), 1);
+ assert_eq!(a.shape(), &[]);
+}
+
#[test]
fn test_from_fn_f1() {
let a = Array::from_shape_fn(28.f(), |i| i);
