diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Euler.cpp | 25 | ||||
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/compile.cpp | 8 |
3 files changed, 27 insertions, 10 deletions
diff --git a/tests/Euler.cpp b/tests/Euler.cpp new file mode 100644 index 0000000..5666cd8 --- /dev/null +++ b/tests/Euler.cpp @@ -0,0 +1,25 @@ +#include "vZ.hpp" +#include <cmath> +#include <cstdlib> +#include <iostream> + +// y' = y (y == C*exp(t)) +double +f(double t, double y) +{ + return y; +} + +int +main() +{ + vZ::EulerIntegrator integrator(f); + integrator.y(1.0).x(0.0).h(0.01); + + integrator.integrate(2.0); + + std::cout << integrator.y() << std::endl + << std::exp(2.0) << std::endl; + + return EXIT_SUCCESS; +} diff --git a/tests/Makefile.am b/tests/Makefile.am index 156bc06..a3d5a77 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,7 +19,7 @@ INCLUDES = -I$(top_srcdir)/src -check_PROGRAMS = compile-test +check_PROGRAMS = Euler-test TESTS = $(check_PROGRAMS) -compile_test_SOURCES = compile.cpp +Euler_test_SOURCES = Euler.cpp diff --git a/tests/compile.cpp b/tests/compile.cpp deleted file mode 100644 index 17381b4..0000000 --- a/tests/compile.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "vZ.hpp" -#include <cstdlib> - -int -main() -{ - return EXIT_SUCCESS; -} |