diff options
-rw-r--r-- | libs/ardour/test/bbt_test.cc (renamed from libs/ardour/test/bbt_test.cpp) | 0 | ||||
-rw-r--r-- | libs/ardour/test/framewalk_to_beats_test.cc | 33 | ||||
-rw-r--r-- | libs/ardour/test/framewalk_to_beats_test.h | 17 | ||||
-rw-r--r-- | libs/ardour/test/interpolation_test.cc (renamed from libs/ardour/test/interpolation_test.cpp) | 0 | ||||
-rw-r--r-- | libs/ardour/test/mantis_3356.cc | 69 | ||||
-rw-r--r-- | libs/ardour/test/mantis_3356.h | 13 | ||||
-rw-r--r-- | libs/ardour/test/midi_clock_slave_test.cc (renamed from libs/ardour/test/midi_clock_slave_test.cpp) | 0 | ||||
-rw-r--r-- | libs/ardour/test/resampled_source_test.cc (renamed from libs/ardour/test/resampled_source.cc) | 2 | ||||
-rw-r--r-- | libs/ardour/test/resampled_source_test.h (renamed from libs/ardour/test/resampled_source.h) | 0 | ||||
-rw-r--r-- | libs/ardour/test/testrunner.cc (renamed from libs/ardour/test/testrunner.cpp) | 0 | ||||
-rw-r--r-- | libs/ardour/wscript | 16 |
11 files changed, 61 insertions, 89 deletions
diff --git a/libs/ardour/test/bbt_test.cpp b/libs/ardour/test/bbt_test.cc index 4dab5c6f32..4dab5c6f32 100644 --- a/libs/ardour/test/bbt_test.cpp +++ b/libs/ardour/test/bbt_test.cc diff --git a/libs/ardour/test/framewalk_to_beats_test.cc b/libs/ardour/test/framewalk_to_beats_test.cc new file mode 100644 index 0000000000..c7fb45cada --- /dev/null +++ b/libs/ardour/test/framewalk_to_beats_test.cc @@ -0,0 +1,33 @@ +#include "framewalk_to_beats_test.h" +#include "ardour/tempo.h" +#include "timecode/bbt_time.h" + +CPPUNIT_TEST_SUITE_REGISTRATION (FramewalkToBeatsTest); + +using namespace std; +using namespace ARDOUR; +using namespace Timecode; + +void +FramewalkToBeatsTest::singleTempoTest () +{ + int const sampling_rate = 48000; + int const bpm = 120; + + double const frames_per_beat = (60 / double (bpm)) * double (sampling_rate); + + TempoMap map (sampling_rate); + Tempo tempo (bpm); + Meter meter (4, 4); + + map.add_meter (meter, BBT_Time (1, 1, 0)); + map.add_tempo (tempo, BBT_Time (1, 1, 0)); + + /* Add 1 beats-worth of frames to a 2 beat starting point */ + double r = map.framewalk_to_beats (frames_per_beat * 2, frames_per_beat * 1); + CPPUNIT_ASSERT (r == 1); + + /* Add 6 beats-worth of frames to a 3 beat starting point */ + r = map.framewalk_to_beats (frames_per_beat * 3, frames_per_beat * 6); + CPPUNIT_ASSERT (r == 6); +} diff --git a/libs/ardour/test/framewalk_to_beats_test.h b/libs/ardour/test/framewalk_to_beats_test.h new file mode 100644 index 0000000000..3dd24553e2 --- /dev/null +++ b/libs/ardour/test/framewalk_to_beats_test.h @@ -0,0 +1,17 @@ +#include <sigc++/sigc++.h> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> + +class FramewalkToBeatsTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE (FramewalkToBeatsTest); + CPPUNIT_TEST (singleTempoTest); + CPPUNIT_TEST_SUITE_END (); + +public: + void setUp () {} + void tearDown () {} + + void singleTempoTest (); +}; + diff --git a/libs/ardour/test/interpolation_test.cpp b/libs/ardour/test/interpolation_test.cc index 0bbb697b85..0bbb697b85 100644 --- a/libs/ardour/test/interpolation_test.cpp +++ b/libs/ardour/test/interpolation_test.cc diff --git a/libs/ardour/test/mantis_3356.cc b/libs/ardour/test/mantis_3356.cc deleted file mode 100644 index 2a68fca352..0000000000 --- a/libs/ardour/test/mantis_3356.cc +++ /dev/null @@ -1,69 +0,0 @@ -#include <stdexcept> -#include "midi++/manager.h" -#include "pbd/textreceiver.h" -#include "ardour/session.h" -#include "ardour/audioengine.h" -#include "ardour/smf_source.h" -#include "ardour/midi_model.h" -#include "test/mantis_3356.h" - -CPPUNIT_TEST_SUITE_REGISTRATION (Mantis3356Test); - -using namespace std; -using namespace ARDOUR; -using namespace PBD; - -TextReceiver text_receiver ("test"); - -void -Mantis3356Test::test () -{ - init (false, true); - SessionEvent::create_per_thread_pool ("test", 512); - - text_receiver.listen_to (error); - text_receiver.listen_to (info); - text_receiver.listen_to (fatal); - text_receiver.listen_to (warning); - - AudioEngine engine ("test", ""); - MIDI::Manager::create (engine.jack ()); - CPPUNIT_ASSERT (engine.start () == 0); - - Session session (engine, "../libs/ardour/test/data/mantis_3356", "mantis_3356"); - engine.set_session (&session); - - Session::SourceMap sources = session.get_sources (); - - boost::shared_ptr<SMFSource> source = boost::dynamic_pointer_cast<SMFSource> (sources[ID ("87")]); - CPPUNIT_ASSERT (source); - - boost::shared_ptr<MidiModel> model = source->model (); - CPPUNIT_ASSERT (model); - - stringstream result; - - for (MidiModel::const_iterator i = model->begin(); i != model->end(); ++i) { - result << *i << "\n"; - } - - ifstream ref ("../libs/ardour/test/data/mantis_3356.ref"); - - while (1) { - string a; - string b; - - getline (ref, a); - getline (result, b); - - CPPUNIT_ASSERT (a == b); - - if (result.eof() && ref.eof()) { - break; - } - - CPPUNIT_ASSERT (!result.eof ()); - CPPUNIT_ASSERT (!ref.eof ()); - } - -} diff --git a/libs/ardour/test/mantis_3356.h b/libs/ardour/test/mantis_3356.h deleted file mode 100644 index cda9712f90..0000000000 --- a/libs/ardour/test/mantis_3356.h +++ /dev/null @@ -1,13 +0,0 @@ -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> - -/** Test for Mantis bug #3356 */ -class Mantis3356Test : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE (Mantis3356Test); - CPPUNIT_TEST (test); - CPPUNIT_TEST_SUITE_END (); - -public: - void test (); -}; diff --git a/libs/ardour/test/midi_clock_slave_test.cpp b/libs/ardour/test/midi_clock_slave_test.cc index dcb159cb2c..dcb159cb2c 100644 --- a/libs/ardour/test/midi_clock_slave_test.cpp +++ b/libs/ardour/test/midi_clock_slave_test.cc diff --git a/libs/ardour/test/resampled_source.cc b/libs/ardour/test/resampled_source_test.cc index bb8cd76f56..983c0d88d2 100644 --- a/libs/ardour/test/resampled_source.cc +++ b/libs/ardour/test/resampled_source_test.cc @@ -1,6 +1,6 @@ #include "ardour/resampled_source.h" #include "ardour/sndfileimportable.h" -#include "resampled_source.h" +#include "resampled_source_test.h" CPPUNIT_TEST_SUITE_REGISTRATION (ResampledSourceTest); diff --git a/libs/ardour/test/resampled_source.h b/libs/ardour/test/resampled_source_test.h index c836968987..c836968987 100644 --- a/libs/ardour/test/resampled_source.h +++ b/libs/ardour/test/resampled_source_test.h diff --git a/libs/ardour/test/testrunner.cpp b/libs/ardour/test/testrunner.cc index ebbd50543e..ebbd50543e 100644 --- a/libs/ardour/test/testrunner.cpp +++ b/libs/ardour/test/testrunner.cc diff --git a/libs/ardour/wscript b/libs/ardour/wscript index dfdb4a47ca..2b9151c385 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -423,13 +423,17 @@ def build(bld): testobj = bld(features = 'cxx cxxprogram') testobj.source = ''' test/dummy_lxvst.cc - test/bbt_test.cpp - test/interpolation_test.cpp - test/midi_clock_slave_test.cpp - test/resampled_source.cc - test/mantis_3356.cc - test/testrunner.cpp + test/bbt_test.cc + test/interpolation_test.cc + test/midi_clock_slave_test.cc + test/resampled_source_test.cc + test/framewalk_to_beats_test.cc + test/testrunner.cc '''.split() + +# Tests that don't work +# test/mantis_3356_test.cc + testobj.includes = obj.includes + ['test', '../pbd'] testobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD', 'SAMPLERATE','XML','LRDF','COREAUDIO'] |