From 556272c0fb8d4a1a276ac7e585dcfd56198f798d Mon Sep 17 00:00:00 2001 From: Trevor Hansen Date: Sat, 30 Dec 2023 10:51:45 +1100 Subject: [PATCH] Replace with macros as suggested by @oflatt --- src/main.rs | 47 ++++++++++------------------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9191646..4287ab9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -265,42 +265,15 @@ fn check_assert_enabled() { assert!(false); } -// Make several identical functions so they'll be run in parallel -#[test] -fn check0() { - check_optimal_results(); -} - -#[test] -fn check1() { - check_optimal_results(); -} - -#[test] -fn check2() { - check_optimal_results(); -} - -#[test] -fn check3() { - check_optimal_results(); -} - -#[test] -fn check4() { - check_optimal_results(); -} -#[test] -fn check5() { - check_optimal_results(); -} - -#[test] -fn check6() { - check_optimal_results(); +macro_rules! create_optimal_check_tests { + ($($name:ident),*) => { + $( + #[test] + fn $name() { + check_optimal_results(); + } + )* + } } -#[test] -fn check7() { - check_optimal_results(); -} +create_optimal_check_tests!(check0, check1, check2, check3, check4, check5, check6, check7);