Skip to content

Commit

Permalink
extract all tolerances from test macros
Browse files Browse the repository at this point in the history
  • Loading branch information
imrn99 committed Oct 12, 2024
1 parent 06591f9 commit fdfc84f
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 8 deletions.
8 changes: 8 additions & 0 deletions integraal/src/tests/function_a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions integraal/src/tests/function_b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions integraal/src/tests/function_c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions integraal/src/tests/function_d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions integraal/src/tests/function_e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions integraal/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ macro_rules! all_tests {
$dmd_xpl,
ComputeMethod::Simpson,
RES,
TRAPEZOID_TOLERANCE // FIXME: update tol
SIMPSON_TOLERANCE
);

generate_test!(
Expand All @@ -284,7 +284,7 @@ macro_rules! all_tests {
$dmd_uni,
ComputeMethod::Simpson,
RES,
TRAPEZOID_TOLERANCE // FIXME: update tol
SIMPSON_TOLERANCE
);

generate_test!(
Expand All @@ -295,7 +295,7 @@ macro_rules! all_tests {
$dmd_xpl,
ComputeMethod::Simpson,
RES,
TRAPEZOID_TOLERANCE // FIXME: update tol
SIMPSON_TOLERANCE
);

generate_test!(
Expand All @@ -305,7 +305,7 @@ macro_rules! all_tests {
$dmd_uni,
ComputeMethod::Simpson,
RES,
TRAPEZOID_TOLERANCE // FIXME: update tol
SIMPSON_TOLERANCE
);
}

Expand All @@ -321,7 +321,7 @@ macro_rules! all_tests {
$dmd_uni,
ComputeMethod::Boole { force: true },
RES,
TRAPEZOID_TOLERANCE // FIXME: update tol
BOOLE_TOLERANCE
);

generate_test!(
Expand All @@ -331,7 +331,7 @@ macro_rules! all_tests {
$dmd_uni,
ComputeMethod::Boole { force: true },
RES,
TRAPEZOID_TOLERANCE // FIXME: update tol
BOOLE_TOLERANCE
);
}

Expand All @@ -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!(
Expand All @@ -357,7 +357,7 @@ macro_rules! all_tests {
$dmd_uni,
ComputeMethod::Romberg { max_steps: 10 },
RES,
TRAPEZOID_TOLERANCE // FIXME: update tol
ROMBERG_TOLERANCE
);
}
};
Expand Down

0 comments on commit fdfc84f

Please sign in to comment.