A few basic tests for AudioEngine

This commit is contained in:
Tim Mayberry 2013-10-11 21:54:40 +10:00
parent e9529d26e1
commit be376350b5
3 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,53 @@
#include <iostream>
#include "ardour/audioengine.h"
#include "ardour/audio_backend.h"
#include "ardour/backend_search_path.h"
#include "audio_engine_test.h"
#include "test_common.h"
CPPUNIT_TEST_SUITE_REGISTRATION (AudioEngineTest);
using namespace std;
using namespace ARDOUR;
using namespace PBD;
void
print_audio_backend_info (AudioBackendInfo const* abi)
{
cerr << "Audio Backend, name:" << abi->name << endl;
}
void
AudioEngineTest::test_backends ()
{
AudioEngine* engine = AudioEngine::create ();
CPPUNIT_ASSERT (engine);
std::vector<AudioBackendInfo const *> backends = engine->available_backends ();
CPPUNIT_ASSERT (backends.size () != 0);
for (std::vector<AudioBackendInfo const *>::const_iterator i = backends.begin();
i != backends.end(); ++i) {
print_audio_backend_info(*i);
}
}
void
AudioEngineTest::test_start ()
{
AudioEngine* engine = AudioEngine::create ();
CPPUNIT_ASSERT_NO_THROW (engine->set_default_backend ());
init_post_engine ();
CPPUNIT_ASSERT (engine->start () == 0);
// sleep
// stop
// destroy
}

View File

@ -0,0 +1,14 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
class AudioEngineTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE (AudioEngineTest);
CPPUNIT_TEST (test_backends);
CPPUNIT_TEST (test_start);
CPPUNIT_TEST_SUITE_END ();
public:
void test_backends ();
void test_start ();
};

View File

@ -434,6 +434,7 @@ def build(bld):
testcommon.source += [ 'sse_functions_64bit.s' ]
if bld.env['SINGLE_TESTS']:
create_ardour_test_program(bld, obj.includes, 'audio_engine_test', 'test_audio_engine', ['test/audio_engine_test.cc'])
create_ardour_test_program(bld, obj.includes, 'automation_list_property_test', 'test_automation_list_property', ['test/automation_list_property_test.cc'])
create_ardour_test_program(bld, obj.includes, 'bbt', 'test_bbt', ['test/bbt_test.cc'])
create_ardour_test_program(bld, obj.includes, 'tempo', 'test_tempo', ['test/tempo_test.cc'])
@ -452,6 +453,7 @@ def build(bld):
create_ardour_test_program(bld, obj.includes, 'session_test', 'test_session', ['test/session_test.cc'])
test_sources = '''
test/audio_engine_test.cc
test/automation_list_property_test.cc
test/bbt_test.cc
test/tempo_test.cc