From fdfc84fb268f09bc1ab858cc59bd24912a624bb9 Mon Sep 17 00:00:00 2001 From: imrn99 Date: Sat, 12 Oct 2024 13:55:12 +0200 Subject: [PATCH] extract all tolerances from test macros --- integraal/src/tests/function_a.rs | 8 ++++++++ integraal/src/tests/function_b.rs | 8 ++++++++ integraal/src/tests/function_c.rs | 8 ++++++++ integraal/src/tests/function_d.rs | 8 ++++++++ integraal/src/tests/function_e.rs | 8 ++++++++ integraal/src/tests/mod.rs | 16 ++++++++-------- 6 files changed, 48 insertions(+), 8 deletions(-) diff --git a/integraal/src/tests/function_a.rs b/integraal/src/tests/function_a.rs index ef63fb8..9ee9b34 100644 --- a/integraal/src/tests/function_a.rs +++ b/integraal/src/tests/function_a.rs @@ -12,8 +12,12 @@ mod double { const STEP: f64 = 0.001; const RES: f64 = 2.0; + // FIXME: tolerances need to be updated const RECTANGLE_TOLERANCE: f64 = 1e-5; const TRAPEZOID_TOLERANCE: f64 = 1e-5; + const SIMPSON_TOLERANCE: f64 = 1e-5; + const BOOLE_TOLERANCE: f64 = 1e-5; + const ROMBERG_TOLERANCE: f64 = 1e-5; all_tests!( f64, @@ -40,8 +44,12 @@ mod simple { const STEP: f32 = 0.001; const RES: f32 = 2.0; + // FIXME: tolerances need to be updated const RECTANGLE_TOLERANCE: f32 = 1e-5; const TRAPEZOID_TOLERANCE: f32 = 1e-5; + const SIMPSON_TOLERANCE: f32 = 1e-5; + const BOOLE_TOLERANCE: f32 = 1e-5; + const ROMBERG_TOLERANCE: f32 = 1e-5; all_tests!( f32, diff --git a/integraal/src/tests/function_b.rs b/integraal/src/tests/function_b.rs index 1529223..100b41d 100644 --- a/integraal/src/tests/function_b.rs +++ b/integraal/src/tests/function_b.rs @@ -14,8 +14,12 @@ mod double { const STEP: f64 = 0.001; const RES: f64 = 2.0; + // FIXME: tolerances need to be updated const RECTANGLE_TOLERANCE: f64 = 1e-5; const TRAPEZOID_TOLERANCE: f64 = 1e-5; + const SIMPSON_TOLERANCE: f64 = 1e-5; + const BOOLE_TOLERANCE: f64 = 1e-5; + const ROMBERG_TOLERANCE: f64 = 1e-5; all_tests!( f64, @@ -54,8 +58,12 @@ mod simple { const STEP: f32 = 0.001; const RES: f32 = 2.0; + // FIXME: tolerances need to be updated const RECTANGLE_TOLERANCE: f32 = 1e-5; const TRAPEZOID_TOLERANCE: f32 = 1e-5; + const SIMPSON_TOLERANCE: f32 = 1e-5; + const BOOLE_TOLERANCE: f32 = 1e-5; + const ROMBERG_TOLERANCE: f32 = 1e-5; all_tests!( f32, diff --git a/integraal/src/tests/function_c.rs b/integraal/src/tests/function_c.rs index 48db2d5..ec49720 100644 --- a/integraal/src/tests/function_c.rs +++ b/integraal/src/tests/function_c.rs @@ -14,8 +14,12 @@ mod double { const STEP: f64 = 0.001; const RES: f64 = 0.5; + // FIXME: tolerances need to be updated const RECTANGLE_TOLERANCE: f64 = 1e-5; const TRAPEZOID_TOLERANCE: f64 = 1e-5; + const SIMPSON_TOLERANCE: f64 = 1e-5; + const BOOLE_TOLERANCE: f64 = 1e-5; + const ROMBERG_TOLERANCE: f64 = 1e-5; all_tests!( f64, @@ -52,8 +56,12 @@ mod simple { const STEP: f32 = 0.001; const RES: f32 = 0.5; + // FIXME: tolerances need to be updated const RECTANGLE_TOLERANCE: f32 = 1e-5; const TRAPEZOID_TOLERANCE: f32 = 1e-5; + const SIMPSON_TOLERANCE: f32 = 1e-5; + const BOOLE_TOLERANCE: f32 = 1e-5; + const ROMBERG_TOLERANCE: f32 = 1e-5; all_tests!( f32, diff --git a/integraal/src/tests/function_d.rs b/integraal/src/tests/function_d.rs index 28f8348..53b44b3 100644 --- a/integraal/src/tests/function_d.rs +++ b/integraal/src/tests/function_d.rs @@ -13,8 +13,12 @@ mod double { const STEP: f64 = 0.001; const RES: f64 = 128.0 / 3.0; + // FIXME: tolerances need to be updated const RECTANGLE_TOLERANCE: f64 = 1e-5; const TRAPEZOID_TOLERANCE: f64 = 1e-5; + const SIMPSON_TOLERANCE: f64 = 1e-5; + const BOOLE_TOLERANCE: f64 = 1e-5; + const ROMBERG_TOLERANCE: f64 = 1e-5; all_tests!( f64, @@ -41,8 +45,12 @@ mod simple { const STEP: f32 = 0.001; const RES: f32 = 128.0 / 3.0; + // FIXME: tolerances need to be updated const RECTANGLE_TOLERANCE: f32 = 1e-5; const TRAPEZOID_TOLERANCE: f32 = 1e-5; + const SIMPSON_TOLERANCE: f32 = 1e-5; + const BOOLE_TOLERANCE: f32 = 1e-5; + const ROMBERG_TOLERANCE: f32 = 1e-5; all_tests!( f32, diff --git a/integraal/src/tests/function_e.rs b/integraal/src/tests/function_e.rs index 8561b20..285c897 100644 --- a/integraal/src/tests/function_e.rs +++ b/integraal/src/tests/function_e.rs @@ -13,8 +13,12 @@ mod double { const STEP: f64 = 0.001; const RES: f64 = 0.0; + // FIXME: tolerances need to be updated const RECTANGLE_TOLERANCE: f64 = 1e-5; const TRAPEZOID_TOLERANCE: f64 = 1e-5; + const SIMPSON_TOLERANCE: f64 = 1e-5; + const BOOLE_TOLERANCE: f64 = 1e-5; + const ROMBERG_TOLERANCE: f64 = 1e-5; all_tests!( f64, @@ -41,8 +45,12 @@ mod simple { const STEP: f32 = 0.001; const RES: f32 = 0.0; + // FIXME: tolerances need to be updated const RECTANGLE_TOLERANCE: f32 = 1e-5; const TRAPEZOID_TOLERANCE: f32 = 1e-5; + const SIMPSON_TOLERANCE: f32 = 1e-5; + const BOOLE_TOLERANCE: f32 = 1e-5; + const ROMBERG_TOLERANCE: f32 = 1e-5; all_tests!( f32, diff --git a/integraal/src/tests/mod.rs b/integraal/src/tests/mod.rs index f7ba081..3dc871c 100644 --- a/integraal/src/tests/mod.rs +++ b/integraal/src/tests/mod.rs @@ -274,7 +274,7 @@ macro_rules! all_tests { $dmd_xpl, ComputeMethod::Simpson, RES, - TRAPEZOID_TOLERANCE // FIXME: update tol + SIMPSON_TOLERANCE ); generate_test!( @@ -284,7 +284,7 @@ macro_rules! all_tests { $dmd_uni, ComputeMethod::Simpson, RES, - TRAPEZOID_TOLERANCE // FIXME: update tol + SIMPSON_TOLERANCE ); generate_test!( @@ -295,7 +295,7 @@ macro_rules! all_tests { $dmd_xpl, ComputeMethod::Simpson, RES, - TRAPEZOID_TOLERANCE // FIXME: update tol + SIMPSON_TOLERANCE ); generate_test!( @@ -305,7 +305,7 @@ macro_rules! all_tests { $dmd_uni, ComputeMethod::Simpson, RES, - TRAPEZOID_TOLERANCE // FIXME: update tol + SIMPSON_TOLERANCE ); } @@ -321,7 +321,7 @@ macro_rules! all_tests { $dmd_uni, ComputeMethod::Boole { force: true }, RES, - TRAPEZOID_TOLERANCE // FIXME: update tol + BOOLE_TOLERANCE ); generate_test!( @@ -331,7 +331,7 @@ macro_rules! all_tests { $dmd_uni, ComputeMethod::Boole { force: true }, RES, - TRAPEZOID_TOLERANCE // FIXME: update tol + BOOLE_TOLERANCE ); } @@ -347,7 +347,7 @@ macro_rules! all_tests { $dmd_uni, ComputeMethod::Romberg { max_steps: 10 }, RES, - TRAPEZOID_TOLERANCE // FIXME: update tol + ROMBERG_TOLERANCE ); generate_test!( @@ -357,7 +357,7 @@ macro_rules! all_tests { $dmd_uni, ComputeMethod::Romberg { max_steps: 10 }, RES, - TRAPEZOID_TOLERANCE // FIXME: update tol + ROMBERG_TOLERANCE ); } };