message: Implemented tests for ArgminRandom impl for ndarray
diff: @@ -61,9 +61,70 @@ macro_rules! make_random {
  }
  make_random!(isize);
  +make_random!(usize);
  make_random!(i8);
  +make_random!(u8);
  make_random!(i16);
  +make_random!(u16);
  make_random!(i32);
  +make_random!(u32);
  make_random!(i64);
  +make_random!(u64);
  make_random!(f32);
  make_random!(f64);
  +
  +#[cfg(test)]
  +mod tests {
  + use super::*;
  + use ndarray::{array, Array1, Array2};
  + use paste::item;
  +
  + macro_rules! make_test {
  + ($t:ty) => {
  + item! {
  + #[test]
  + fn [<test_random_vec_ $t>]() {
  + let a = array![1 as $t, 2 as $t, 4 as $t];
  + let b = array![2 as $t, 3 as $t, 5 as $t];
  + let random = Array1::<$t>::rand_from_range(&a, &b);
  + for i in 0..3usize {
  + assert!(random[i] >= a[i]);
  + assert!(random[i] <= b[i]);
  + }
  + }
  + }
  +
  + item! {
  + #[test]
  + fn [<test_random_mat_ $t>]() {
  + let a = array![
  + [1 as $t, 2 as $t, 4 as $t],
  + [2 as $t, 3 as $t, 5 as $t]
  + ];
  + let b = array![
  + [2 as $t, 3 as $t, 5 as $t],
  + [3 as $t, 4 as $t, 6 as $t]
  + ];
  + let random = Array2::<$t>::rand_from_range(&a, &b);
  + for i in 0..3 {
  + for j in 0..2 {
  + assert!(random[(j, i)] >= a[(j, i)]);
  + assert!(random[(j, i)] <= b[(j, i)]);
  + }
  + }
  + }
  + }
  + };
  + }
  +
  + make_test!(i8);
  + make_test!(u8);
  + make_test!(i16);
  + make_test!(u16);
  + make_test!(i32);
  + make_test!(u32);
  + make_test!(i64);
  + make_test!(u64);
  + make_test!(f32);
  + make_test!(f64);
  +}
  