-Updated tests, updated QUnit

This commit is contained in:
Harry van Haaren 2013-09-17 12:24:58 +01:00
parent a3020cf1e2
commit 827b4a1f14
3 changed files with 30 additions and 9 deletions

View file

@ -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;
}

View file

@ -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 );

View file

@ -25,6 +25,8 @@
#include <sstream>
#include <string>
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <libgen.h>
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 << "} "