mirror of
https://github.com/drewcassidy/vector-victor.git
synced 2024-09-01 14:58:35 +00:00
Swizzle test reorganization
This commit is contained in:
parent
61b1d211c1
commit
b05a8172c0
@ -96,24 +96,3 @@ macro_rules! sub_literal {
|
||||
};
|
||||
($result:expr, $p:expr, $i:expr) => {};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::Matrix;
|
||||
|
||||
#[test]
|
||||
fn test_swizzle() {
|
||||
let identity = Matrix::<i32, 4, 4>::identity();
|
||||
|
||||
assert_eq!(
|
||||
swizzle!(identity, a, x, b, (1 + 0), { 2 - 3 }),
|
||||
Matrix::mat([
|
||||
[0, 0, 0, 1], // a
|
||||
[1, 0, 0, 0], // x
|
||||
[0, 0, 1, 0], // b
|
||||
[0, 1, 0, 0], // row 1
|
||||
[-1, -1, -1, -1] // fill(-1)
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ impl<T: Copy + Approx, const M: usize, const N: usize> Approx for Matrix<T, M, N
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! assert_approx {
|
||||
($left:expr, $right:expr $(,)?) => {
|
||||
match (&$left, &$right) {
|
||||
|
17
tests/swizzle.rs
Normal file
17
tests/swizzle.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use vector_victor::{swizzle, Matrix};
|
||||
|
||||
#[test]
|
||||
fn test_swizzle() {
|
||||
let identity = Matrix::<i32, 4, 4>::identity();
|
||||
|
||||
assert_eq!(
|
||||
swizzle!(identity, a, x, b, (1 + 0), { 2 - 3 }),
|
||||
Matrix::mat([
|
||||
[0, 0, 0, 1], // a
|
||||
[1, 0, 0, 0], // x
|
||||
[0, 0, 1, 0], // b
|
||||
[0, 1, 0, 0], // row 1
|
||||
[-1, -1, -1, -1] // fill(-1)
|
||||
])
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user