vector-victor/tests/ops.rs

22 lines
578 B
Rust
Raw Normal View History

2023-05-06 07:39:06 +00:00
#[macro_use]
mod common;
2022-08-19 04:07:05 +00:00
use generic_parameterize::parameterize;
use std::fmt::Debug;
use std::ops;
use vector_victor::Matrix;
2022-08-19 04:07:05 +00:00
2023-05-06 07:39:06 +00:00
#[parameterize(S = (i32, f32, f64, u32), M = [1,4], N = [1,4])]
2022-08-19 04:07:05 +00:00
#[test]
fn test_add<S: Copy + From<u16> + PartialEq + Debug, const M: usize, const N: usize>()
2022-08-19 04:07:05 +00:00
where
Matrix<S, M, N>: ops::Add<Output = Matrix<S, M, N>>,
{
let a = Matrix::<S, M, N>::fill(S::from(1));
let b = Matrix::<S, M, N>::fill(S::from(3));
let c: Matrix<S, M, N> = a + b;
2023-05-06 07:39:06 +00:00
for (_, ci) in c.elements().enumerate() {
2022-08-19 04:07:05 +00:00
assert_eq!(*ci, S::from(4));
}
}