summaryrefslogtreecommitdiff
path: root/libs/ardour/test/interpolation_test.h
diff options
context:
space:
mode:
authorHans Baier <hansfbaier@googlemail.com>2010-01-29 05:17:44 +0000
committerHans Baier <hansfbaier@googlemail.com>2010-01-29 05:17:44 +0000
commit0c6c45fc689c0e50b2b13f153369a4fc82542053 (patch)
tree7b0074637ccaca8fe3f4562cca359ac1318971bc /libs/ardour/test/interpolation_test.h
parentd978f102f56ae583d6107b3b29a6bcdd3fe55784 (diff)
* add waf option to enable compilation of unit tests
* libs/ardour: make filenames of unit tests compy with the convention git-svn-id: svn://localhost/ardour2/branches/3.0@6583 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/test/interpolation_test.h')
-rw-r--r--libs/ardour/test/interpolation_test.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/libs/ardour/test/interpolation_test.h b/libs/ardour/test/interpolation_test.h
new file mode 100644
index 0000000000..a051990e85
--- /dev/null
+++ b/libs/ardour/test/interpolation_test.h
@@ -0,0 +1,61 @@
+/* Copyright(C) 2000-2008 Paul Davis
+ * Author: Hans Baier
+ *
+ * Evoral is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or(at your option) any later
+ * version.
+ *
+ * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <cassert>
+#include <stdint.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "ardour/interpolation.h"
+
+class InterpolationTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE(InterpolationTest);
+ CPPUNIT_TEST(cubicInterpolationTest);
+ CPPUNIT_TEST(linearInterpolationTest);
+ CPPUNIT_TEST_SUITE_END();
+
+#define NUM_SAMPLES 1000000
+#define INTERVAL 100
+
+ ARDOUR::Sample input[NUM_SAMPLES];
+ ARDOUR::Sample output[NUM_SAMPLES];
+
+ ARDOUR::LinearInterpolation linear;
+ ARDOUR::CubicInterpolation cubic;
+
+ public:
+
+ void setUp() {
+ for (int i = 0; i < NUM_SAMPLES; ++i) {
+ if (i % INTERVAL == 0) {
+ input[i] = 1.0f;
+ } else {
+ input[i] = 0.0f;
+ }
+ output[i] = 0.0f;
+ }
+ linear.add_channel_to (NUM_SAMPLES, NUM_SAMPLES);
+ cubic.add_channel_to (NUM_SAMPLES, NUM_SAMPLES);
+ }
+
+ void tearDown() {
+ }
+
+ void linearInterpolationTest();
+ void cubicInterpolationTest();
+};