summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/BS23.cpp1
-rw-r--r--tests/Euler.cpp9
-rw-r--r--tests/HE12.cpp1
-rw-r--r--tests/Heun.cpp9
-rw-r--r--tests/Midpoint.cpp9
-rw-r--r--tests/RK4.cpp9
-rw-r--r--tests/RKF45.cpp1
7 files changed, 23 insertions, 16 deletions
diff --git a/tests/BS23.cpp b/tests/BS23.cpp
index 15abd0c..7493345 100644
--- a/tests/BS23.cpp
+++ b/tests/BS23.cpp
@@ -26,6 +26,7 @@ main()
<< "Numerical: " << actual << std::endl
<< "Expected: " << expected << std::endl
<< "h: " << integrator.h() << std::endl
+ << "iterations: " << integrator.iterations() << std::endl
<< "rejections: " << integrator.rejections() << std::endl;
double error = std::fabs(expected - actual)/expected;
diff --git a/tests/Euler.cpp b/tests/Euler.cpp
index 0a6e28e..62ecee7 100644
--- a/tests/Euler.cpp
+++ b/tests/Euler.cpp
@@ -23,15 +23,16 @@ main()
double expected = std::exp(2.0);
std::cout << std::setprecision(10)
- << "Numerical: " << actual << std::endl
- << "Expected: " << expected << std::endl;
+ << "Numerical: " << actual << std::endl
+ << "Expected: " << expected << std::endl
+ << "iterations: " << integrator.iterations() << std::endl;
double error = std::fabs(expected - actual)/expected;
if (error > 0.01) {
- std::cerr << "Error: " << 100.0*error << "%" << std::endl;
+ std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
- std::cout << "Error: " << 100.0*error << "%" << std::endl;
+ std::cout << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_SUCCESS;
}
}
diff --git a/tests/HE12.cpp b/tests/HE12.cpp
index 511a8e0..9a22d20 100644
--- a/tests/HE12.cpp
+++ b/tests/HE12.cpp
@@ -26,6 +26,7 @@ main()
<< "Numerical: " << actual << std::endl
<< "Expected: " << expected << std::endl
<< "h: " << integrator.h() << std::endl
+ << "iterations: " << integrator.iterations() << std::endl
<< "rejections: " << integrator.rejections() << std::endl;
double error = std::fabs(expected - actual)/expected;
diff --git a/tests/Heun.cpp b/tests/Heun.cpp
index 758524b..e8b4e6c 100644
--- a/tests/Heun.cpp
+++ b/tests/Heun.cpp
@@ -23,15 +23,16 @@ main()
double expected = std::exp(2.0);
std::cout << std::setprecision(10)
- << "Numerical: " << actual << std::endl
- << "Expected: " << expected << std::endl;
+ << "Numerical: " << actual << std::endl
+ << "Expected: " << expected << std::endl
+ << "iterations: " << integrator.iterations() << std::endl;
double error = std::fabs(expected - actual)/expected;
if (error > 1.4e-4) {
- std::cerr << "Error: " << 100.0*error << "%" << std::endl;
+ std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
- std::cout << "Error: " << 100.0*error << "%" << std::endl;
+ std::cout << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_SUCCESS;
}
}
diff --git a/tests/Midpoint.cpp b/tests/Midpoint.cpp
index c16fb76..b544ed1 100644
--- a/tests/Midpoint.cpp
+++ b/tests/Midpoint.cpp
@@ -23,15 +23,16 @@ main()
double expected = std::exp(2.0);
std::cout << std::setprecision(10)
- << "Numerical: " << actual << std::endl
- << "Expected: " << expected << std::endl;
+ << "Numerical: " << actual << std::endl
+ << "Expected: " << expected << std::endl
+ << "iterations: " << integrator.iterations() << std::endl;
double error = std::fabs(expected - actual)/expected;
if (error > 1.4e-4) {
- std::cerr << "Error: " << 100.0*error << "%" << std::endl;
+ std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
- std::cout << "Error: " << 100.0*error << "%" << std::endl;
+ std::cout << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_SUCCESS;
}
}
diff --git a/tests/RK4.cpp b/tests/RK4.cpp
index 2090a1e..4b667d4 100644
--- a/tests/RK4.cpp
+++ b/tests/RK4.cpp
@@ -23,15 +23,16 @@ main()
double expected = std::exp(2.0);
std::cout << std::setprecision(10)
- << "Numerical: " << actual << std::endl
- << "Expected: " << expected << std::endl;
+ << "Numerical: " << actual << std::endl
+ << "Expected: " << expected << std::endl
+ << "iterations: " << integrator.iterations() << std::endl;
double error = std::fabs(expected - actual)/expected;
if (error > 4.2e-8) {
- std::cerr << "Error: " << 100.0*error << "%" << std::endl;
+ std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {
- std::cout << "Error: " << 100.0*error << "%" << std::endl;
+ std::cout << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_SUCCESS;
}
}
diff --git a/tests/RKF45.cpp b/tests/RKF45.cpp
index 8b87216..1ac3e4f 100644
--- a/tests/RKF45.cpp
+++ b/tests/RKF45.cpp
@@ -26,6 +26,7 @@ main()
<< "Numerical: " << actual << std::endl
<< "Expected: " << expected << std::endl
<< "h: " << integrator.h() << std::endl
+ << "iterations: " << integrator.iterations() << std::endl
<< "rejections: " << integrator.rejections() << std::endl;
double error = std::fabs(expected - actual)/expected;