diff --git a/src/looperclip.cxx b/src/looperclip.cxx index 537d854..57b7748 100644 --- a/src/looperclip.cxx +++ b/src/looperclip.cxx @@ -170,6 +170,9 @@ void LooperClip::record(int count, float* L, float* R) sprintf (buffer, "LooperClip t %i, s %i, Error: out of mem!",track, scene ); EventGuiPrint e( buffer ); writeToGuiRingbuffer( &e ); +#ifdef BUILD_TESTS + LUPPP_WARN("%s","buffer has no space"); +#endif break; } diff --git a/src/tests/gridlogictests.cxx b/src/tests/gridlogictests.cxx index a430cca..62688b3 100644 --- a/src/tests/gridlogictests.cxx +++ b/src/tests/gridlogictests.cxx @@ -15,7 +15,7 @@ extern Jack* jack; int GridLogic::runTests() { - QUnit::UnitTest qunit( QUnit::normal ); + QUnit::UnitTest qunit( QUnit::normal, true ); int t = 0; int s = 0; LooperClip* lc = jack->getLooper( t )->getClip( s ); @@ -35,6 +35,10 @@ int GridLogic::runTests() QUNIT_IS_TRUE( lc->getState() == GridLogic::STATE_RECORD_QUEUED ); jack->getGridLogic()->bar(); QUNIT_IS_TRUE( lc->getState() == GridLogic::STATE_RECORDING ); + + float buffer[64]; + lc->record(64, &buffer[0], &buffer[0]); + // recording -> playing jack->getGridLogic()->pressed( t, s ); jack->getGridLogic()->released( t, s ); diff --git a/src/tests/qunit.hxx b/src/tests/qunit.hxx index a666c0f..e87e5e8 100644 --- a/src/tests/qunit.hxx +++ b/src/tests/qunit.hxx @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include using namespace std; @@ -53,7 +55,7 @@ namespace QUnit { class UnitTest { public: - UnitTest( int verboseLevel ); + UnitTest( int verboseLevel, bool openFail = false ); ~UnitTest(); void verboseLevel(int level); @@ -71,10 +73,12 @@ namespace QUnit { int verboseLevel_; int errors_; int tests_; + + bool openFileOnFail; }; - inline UnitTest::UnitTest( int verboseLevel) - : verboseLevel_(verboseLevel) , errors_(0) , tests_(0) { + inline UnitTest::UnitTest( int verboseLevel, bool openFail ) + : verboseLevel_(verboseLevel) , errors_(0) , tests_(0), openFileOnFail(openFail) { } inline UnitTest::~UnitTest() { @@ -123,12 +127,22 @@ namespace QUnit { char* baseFile = strdup(file); cout << basename(baseFile) << " " << line << " : "; free( baseFile ); - if ( ok ) { - cout << QUNIT_COLOUR_PASS; - } else { - cout << QUNIT_COLOUR_ERROR; + if ( ok ) + { + cout << QUNIT_COLOUR_PASS << "OK"; } - cout << ( ok ? "OK" : "FAILED" ) << QUNIT_COLOUR_RESET << " : "; + else + { + cout << QUNIT_COLOUR_ERROR << "FAILED"; + if ( openFileOnFail ) + { + std::stringstream s; + + s << "geany" << file << " --line " << line; + system( s.str().c_str() ); + } + } + cout << QUNIT_COLOUR_RESET << " : "; if( compare ) { const std::string cmp = ( result ? "==" : "!=" ); cout << "compare {" << str1 << "} " << cmp << " {" << str2 << "} "