summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Baier <hansfbaier@googlemail.com>2010-01-29 05:17:51 +0000
committerHans Baier <hansfbaier@googlemail.com>2010-01-29 05:17:51 +0000
commit405def9215a2fc7b70dd2999a06d16e704ddd058 (patch)
tree997c49f2a72aa597bf66ff7ec1cccaaaf928dc52
parent0c6c45fc689c0e50b2b13f153369a4fc82542053 (diff)
MidiClock_SlaveTest: add basic framework
git-svn-id: svn://localhost/ardour2/branches/3.0@6584 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rwxr-xr-xlibs/ardour/run-tests.sh2
-rw-r--r--libs/ardour/test/midi_clock_slave_test.cpp16
-rw-r--r--libs/ardour/test/midi_clock_slave_test.h100
-rw-r--r--libs/ardour/wscript1
4 files changed, 118 insertions, 1 deletions
diff --git a/libs/ardour/run-tests.sh b/libs/ardour/run-tests.sh
index 3fc79920fd..38be6c5891 100755
--- a/libs/ardour/run-tests.sh
+++ b/libs/ardour/run-tests.sh
@@ -14,4 +14,4 @@ export LD_LIBRARY_PATH=$libs/audiographer:$libs/vamp-sdk:$libs/surfaces:$libs/su
echo LD_LIBRARY_PATH = $LD_LIBRARY_PATH
-gdb ./libs/ardour/run-tests
+./libs/ardour/run-tests
diff --git a/libs/ardour/test/midi_clock_slave_test.cpp b/libs/ardour/test/midi_clock_slave_test.cpp
new file mode 100644
index 0000000000..4fc5237726
--- /dev/null
+++ b/libs/ardour/test/midi_clock_slave_test.cpp
@@ -0,0 +1,16 @@
+#include <sigc++/sigc++.h>
+#include "midi_clock_slave_test.h"
+
+using namespace std;
+using namespace ARDOUR;
+
+CPPUNIT_TEST_SUITE_REGISTRATION( MIDIClock_SlaveTest );
+
+void
+MIDIClock_SlaveTest::testStepResponse ()
+{
+ //CPPUNIT_ASSERT_EQUAL ((uint32_t)(NUM_SAMPLES * linear.speed()), result);
+ cerr << "Frozz";
+}
+
+
diff --git a/libs/ardour/test/midi_clock_slave_test.h b/libs/ardour/test/midi_clock_slave_test.h
new file mode 100644
index 0000000000..1709962512
--- /dev/null
+++ b/libs/ardour/test/midi_clock_slave_test.h
@@ -0,0 +1,100 @@
+/*
+ * 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/tempo.h"
+#include "ardour/slave.h"
+
+namespace ARDOUR {
+
+class TestSlaveSessionProxy : public ISlaveSessionProxy {
+ #define FRAME_RATE 44100
+ nframes64_t _period_size;
+
+ double transport_speed;
+ nframes64_t _transport_frame;
+ nframes64_t _frame_time;
+ TempoMap _tempo_map;
+
+ Tempo tempo;
+ Meter meter;
+ BBT_Time zero;
+
+ public:
+ TestSlaveSessionProxy() :
+ transport_speed (1.0),
+ _transport_frame (0),
+ _frame_time (1000000),
+ _tempo_map (FRAME_RATE),
+ tempo (120),
+ meter (4.0, 4.0)
+ {
+ _tempo_map.add_tempo (tempo, zero);
+ _tempo_map.add_meter (meter, zero);
+ }
+
+ // Controlling the mock object
+ void set_period_size (nframes64_t a_size) { _period_size = a_size; }
+ void next_period () {
+ _transport_frame += _period_size;
+ _frame_time += _period_size;
+ }
+
+ // Implementation
+ TempoMap& tempo_map () { return _tempo_map; }
+ nframes_t frame_rate () const { return FRAME_RATE; }
+ nframes64_t audible_frame () const { return _transport_frame; }
+ nframes64_t transport_frame () const { return _transport_frame; }
+ nframes_t frames_since_cycle_start () const { return 0; }
+ nframes64_t frame_time () const { return _frame_time; }
+
+ void request_locate (nframes64_t frame, bool with_roll = false) {
+ _transport_frame = frame;
+ }
+
+ void request_transport_speed (const double speed) { transport_speed = speed; }
+};
+
+class MIDIClock_SlaveTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE(MIDIClock_SlaveTest);
+ CPPUNIT_TEST(testStepResponse);
+ CPPUNIT_TEST_SUITE_END();
+
+ ISlaveSessionProxy *session_proxy;
+ MIDIClock_Slave *slave;
+
+ public:
+
+ void setUp() {
+ session_proxy = new TestSlaveSessionProxy ();
+ slave = new MIDIClock_Slave (session_proxy);
+ }
+
+ void tearDown() {
+ }
+
+ void testStepResponse();
+
+};
+
+} // namespace ARDOUR
diff --git a/libs/ardour/wscript b/libs/ardour/wscript
index a6ea97ec0d..cb62735f0f 100644
--- a/libs/ardour/wscript
+++ b/libs/ardour/wscript
@@ -323,6 +323,7 @@ def build(bld):
testobj.source = '''
test/bbt_test.cpp
test/interpolation_test.cpp
+ test/midi_clock_slave_test.cpp
test/testrunner.cpp
'''.split()
testobj.includes = obj.includes + ['../pbd/']