Skip to content

Commit

Permalink
Do all other bulk tests in parallel too
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Mar 20, 2024
1 parent 4396382 commit e2bb86c
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 136 deletions.
45 changes: 14 additions & 31 deletions fidget/src/core/eval/test/float_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,40 +439,11 @@ where
}
}

pub fn test_f_unary_ops() {
use super::canonical::*;

Self::test_unary::<neg>();
Self::test_unary::<recip>();
Self::test_unary::<abs>();
Self::test_unary::<sin>();
Self::test_unary::<cos>();
Self::test_unary::<tan>();
Self::test_unary::<asin>();
Self::test_unary::<acos>();
Self::test_unary::<atan>();
Self::test_unary::<exp>();
Self::test_unary::<ln>();
Self::test_unary::<square>();
Self::test_unary::<sqrt>();
}

pub fn test_binary<C: CanonicalBinaryOp>() {
Self::test_binary_reg_reg::<C>();
Self::test_binary_reg_imm::<C>();
Self::test_binary_imm_reg::<C>();
}

pub fn test_f_binary_ops() {
use super::canonical::*;

Self::test_binary::<add>();
Self::test_binary::<sub>();
Self::test_binary::<mul>();
Self::test_binary::<div>();
Self::test_binary::<min>();
Self::test_binary::<max>();
}
}

#[macro_export]
Expand All @@ -493,7 +464,19 @@ macro_rules! float_slice_tests {
$crate::float_slice_test!(test_f_var, $t);
$crate::float_slice_test!(test_f_sin, $t);
$crate::float_slice_test!(test_f_stress, $t);
$crate::float_slice_test!(test_f_unary_ops, $t);
$crate::float_slice_test!(test_f_binary_ops, $t);

mod f_unary {
use super::*;
$crate::all_unary_tests!(
$crate::eval::test::float_slice::TestFloatSlice::<$t>
);
}

mod f_binary {
use super::*;
$crate::all_binary_tests!(
$crate::eval::test::float_slice::TestFloatSlice::<$t>
);
}
};
}
45 changes: 14 additions & 31 deletions fidget/src/core/eval/test/grad_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,40 +699,11 @@ where
}
}

pub fn test_g_unary_ops() {
use super::canonical::*;

Self::test_unary::<neg>();
Self::test_unary::<recip>();
Self::test_unary::<abs>();
Self::test_unary::<sin>();
Self::test_unary::<cos>();
Self::test_unary::<tan>();
Self::test_unary::<asin>();
Self::test_unary::<acos>();
Self::test_unary::<atan>();
Self::test_unary::<exp>();
Self::test_unary::<ln>();
Self::test_unary::<square>();
Self::test_unary::<sqrt>();
}

pub fn test_binary<C: CanonicalBinaryOp>() {
Self::test_binary_reg_reg::<C>();
Self::test_binary_reg_imm::<C>();
Self::test_binary_imm_reg::<C>();
}

pub fn test_g_binary_ops() {
use super::canonical::*;

Self::test_binary::<add>();
Self::test_binary::<sub>();
Self::test_binary::<mul>();
Self::test_binary::<div>();
Self::test_binary::<min>();
Self::test_binary::<max>();
}
}

#[macro_export]
Expand Down Expand Up @@ -764,7 +735,19 @@ macro_rules! grad_slice_tests {
$crate::grad_test!(test_g_recip, $t);
$crate::grad_test!(test_g_var, $t);
$crate::grad_test!(test_g_stress, $t);
$crate::grad_test!(test_g_unary_ops, $t);
$crate::grad_test!(test_g_binary_ops, $t);

mod g_unary {
use super::*;
$crate::all_unary_tests!(
$crate::eval::test::grad_slice::TestGradSlice::<$t>
);
}

mod g_binary {
use super::*;
$crate::all_binary_tests!(
$crate::eval::test::grad_slice::TestGradSlice::<$t>
);
}
};
}
49 changes: 6 additions & 43 deletions fidget/src/core/eval/test/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,30 +906,6 @@ macro_rules! interval_test {
};
}

#[macro_export]
macro_rules! interval_unary_test {
($i:ident, $t:ty) => {
#[test]
fn $i() {
$crate::eval::test::interval::TestInterval::<$t>::test_unary::<
$crate::eval::test::canonical::$i,
>()
}
};
}

#[macro_export]
macro_rules! interval_binary_test {
($i:ident, $t:ty) => {
#[test]
fn $i() {
$crate::eval::test::interval::TestInterval::<$t>::test_binary::<
$crate::eval::test::canonical::$i,
>()
}
};
}

#[macro_export]
macro_rules! interval_tests {
($t:ty) => {
Expand All @@ -955,29 +931,16 @@ macro_rules! interval_tests {

mod i_unary {
use super::*;
$crate::interval_unary_test!(neg, $t);
$crate::interval_unary_test!(recip, $t);
$crate::interval_unary_test!(abs, $t);
$crate::interval_unary_test!(sin, $t);
$crate::interval_unary_test!(cos, $t);
$crate::interval_unary_test!(tan, $t);
$crate::interval_unary_test!(asin, $t);
$crate::interval_unary_test!(acos, $t);
$crate::interval_unary_test!(atan, $t);
$crate::interval_unary_test!(exp, $t);
$crate::interval_unary_test!(ln, $t);
$crate::interval_unary_test!(square, $t);
$crate::interval_unary_test!(sqrt, $t);
$crate::all_unary_tests!(
$crate::eval::test::interval::TestInterval::<$t>
);
}

mod i_binary {
use super::*;
$crate::interval_binary_test!(add, $t);
$crate::interval_binary_test!(sub, $t);
$crate::interval_binary_test!(mul, $t);
$crate::interval_binary_test!(div, $t);
$crate::interval_binary_test!(min, $t);
$crate::interval_binary_test!(max, $t);
$crate::all_binary_tests!(
$crate::eval::test::interval::TestInterval::<$t>
);
}
};
}
51 changes: 51 additions & 0 deletions fidget/src/core/eval/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,54 @@ pub mod canonical {
}
);
}

#[macro_export]
macro_rules! one_unary_test {
($tester:ty, $i:ident) => {
#[test]
fn $i() {
<$tester>::test_unary::<$crate::eval::test::canonical::$i>()
}
};
}

#[macro_export]
macro_rules! one_binary_test {
($tester:ty, $i:ident) => {
#[test]
fn $i() {
<$tester>::test_binary::<$crate::eval::test::canonical::$i>()
}
};
}

#[macro_export]
macro_rules! all_unary_tests {
($tester:ty) => {
$crate::one_unary_test!($tester, neg);
$crate::one_unary_test!($tester, recip);
$crate::one_unary_test!($tester, abs);
$crate::one_unary_test!($tester, sin);
$crate::one_unary_test!($tester, cos);
$crate::one_unary_test!($tester, tan);
$crate::one_unary_test!($tester, asin);
$crate::one_unary_test!($tester, acos);
$crate::one_unary_test!($tester, atan);
$crate::one_unary_test!($tester, exp);
$crate::one_unary_test!($tester, ln);
$crate::one_unary_test!($tester, square);
$crate::one_unary_test!($tester, sqrt);
};
}

#[macro_export]
macro_rules! all_binary_tests {
($tester:ty) => {
$crate::one_binary_test!($tester, add);
$crate::one_binary_test!($tester, sub);
$crate::one_binary_test!($tester, mul);
$crate::one_binary_test!($tester, div);
$crate::one_binary_test!($tester, min);
$crate::one_binary_test!($tester, max);
};
}
45 changes: 14 additions & 31 deletions fidget/src/core/eval/test/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,35 +556,6 @@ where
Self::test_binary_reg_imm::<C>();
Self::test_binary_imm_reg::<C>();
}

pub fn test_p_binary_ops() {
use super::canonical::*;

Self::test_binary::<add>();
Self::test_binary::<sub>();
Self::test_binary::<mul>();
Self::test_binary::<div>();
Self::test_binary::<min>();
Self::test_binary::<max>();
}

pub fn test_p_unary_ops() {
use super::canonical::*;

Self::test_unary::<neg>();
Self::test_unary::<recip>();
Self::test_unary::<abs>();
Self::test_unary::<sin>();
Self::test_unary::<cos>();
Self::test_unary::<tan>();
Self::test_unary::<asin>();
Self::test_unary::<acos>();
Self::test_unary::<atan>();
Self::test_unary::<exp>();
Self::test_unary::<ln>();
Self::test_unary::<square>();
Self::test_unary::<sqrt>();
}
}

#[macro_export]
Expand All @@ -611,7 +582,19 @@ macro_rules! point_tests {
$crate::point_test!(test_var, $t);
$crate::point_test!(test_basic, $t);
$crate::point_test!(test_p_stress, $t);
$crate::point_test!(test_p_unary_ops, $t);
$crate::point_test!(test_p_binary_ops, $t);

mod p_unary {
use super::*;
$crate::all_unary_tests!(
$crate::eval::test::point::TestPoint::<$t>
);
}

mod p_binary {
use super::*;
$crate::all_binary_tests!(
$crate::eval::test::point::TestPoint::<$t>
);
}
};
}

0 comments on commit e2bb86c

Please sign in to comment.