From 0d009a4e980e40dc8a9c9b5e3d25c3fafb363e95 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 7 Jan 2010 21:27:39 +0000 Subject: Move unit testing and coverage framework into autowaf. Make raul tests return 0 on success, 1 on failure. Test coverage for Raul. git-svn-id: http://svn.drobilla.net/lad/trunk/raul@2368 a436a847-0d15-0410-975c-d299462d15a1 --- test/quantize_test.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/quantize_test.cpp (limited to 'test/quantize_test.cpp') diff --git a/test/quantize_test.cpp b/test/quantize_test.cpp new file mode 100644 index 0000000..39ba899 --- /dev/null +++ b/test/quantize_test.cpp @@ -0,0 +1,25 @@ +#include "raul/Quantizer.hpp" +#include + +using namespace std; +using namespace Raul; + + +int +main() +{ + TimeStamp q(TimeUnit(TimeUnit::BEATS, 19200), 0.25); + + for (double in = 0.0; in < 32; in += 0.23) { + TimeStamp beats(TimeUnit(TimeUnit::BEATS, 19200), in); + + cout << "Q(" << in << ", 1/4) = " + << Quantizer::quantize(q, beats) << endl; + + if (Quantizer::quantize(q, beats).subticks() % (19200/4) != 0) + return 1; + } + + return 0; +} + -- cgit v1.2.1