From b05a8172c0aa26d2efef7e3ec09465e3e0d80ac4 Mon Sep 17 00:00:00 2001 From: Andrew Cassidy Date: Wed, 24 May 2023 22:39:23 -0700 Subject: [PATCH] Swizzle test reorganization --- src/swizzle.rs | 21 --------------------- tests/common/mod.rs | 1 + tests/swizzle.rs | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 21 deletions(-) create mode 100644 tests/swizzle.rs diff --git a/src/swizzle.rs b/src/swizzle.rs index aa7f580..286daa0 100644 --- a/src/swizzle.rs +++ b/src/swizzle.rs @@ -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::::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) - ]) - ); - } -} diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 936c7da..dadbb35 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -29,6 +29,7 @@ impl Approx for Matrix { match (&$left, &$right) { diff --git a/tests/swizzle.rs b/tests/swizzle.rs new file mode 100644 index 0000000..98cd05f --- /dev/null +++ b/tests/swizzle.rs @@ -0,0 +1,17 @@ +use vector_victor::{swizzle, Matrix}; + +#[test] +fn test_swizzle() { + let identity = Matrix::::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) + ]) + ); +}