From c7e1277ecaf40c6d8ee945418a306f5b15189b97 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 8 Aug 2023 16:33:38 -0700 Subject: Unit test augmentations and harness. Added some features to the mkunit program, including cleanup routine support. Added reporting modes for the UnitSuite class, and it can now generate machine readable reports. Added a new program, rununits that runs all unit tests and generates a synopsis of what you really care about at the end, issues! --- src/experimental/xmlreader.cpp | 2 +- src/stable/unitsuite.cpp | 337 +++++++++++++++++++++++++++++++---------- src/stable/unitsuite.h | 73 +++++++++ src/tools/mkunit.cpp | 34 ++++- src/tools/rununits.cpp | 186 +++++++++++++++++++++++ src/unit/file.unit | 5 + src/unit/xml.unit | 6 - src/unstable/blob.cpp | 2 +- 8 files changed, 552 insertions(+), 93 deletions(-) create mode 100644 src/tools/rununits.cpp (limited to 'src') diff --git a/src/experimental/xmlreader.cpp b/src/experimental/xmlreader.cpp index e1d9ca8..107b76d 100644 --- a/src/experimental/xmlreader.cpp +++ b/src/experimental/xmlreader.cpp @@ -48,7 +48,7 @@ void Bu::XmlReader::cleanupBuffer( int iUsed ) } } - printf("--Deleting %d bytes from front of buffer.\n", iUsed ); + //printf("--Deleting %d bytes from front of buffer.\n", iUsed ); sBuf.trimFront( iUsed ); } diff --git a/src/stable/unitsuite.cpp b/src/stable/unitsuite.cpp index a38c77a..b2544f2 100644 --- a/src/stable/unitsuite.cpp +++ b/src/stable/unitsuite.cpp @@ -9,6 +9,7 @@ #include "bu/file.h" #include "bu/sio.h" #include "bu/optparser.h" +#include "bu/json.h" #include #include @@ -18,28 +19,33 @@ using namespace Bu; Bu::UnitSuite::UnitSuite() : iOptions( 0 ), - iNameWidth( 0 ) + pReport( NULL ) { } Bu::UnitSuite::UnitSuite( int iOptions ) : - iOptions( iOptions ), - iNameWidth( 0 ) + iOptions( iOptions ) { } Bu::UnitSuite::~UnitSuite() { + delete pReport; } int Bu::UnitSuite::run( int argc, char *argv[] ) { bool bCleanup = true; + bool bInterop = false; OptParser p; p.addOption( Bu::slot( this, &Bu::UnitSuite::onListCases ), 'l', "list", "List available test cases." ); + p.addOption( Bu::slot( this, &Bu::UnitSuite::onPrintName ), "print-name", + "Print the internal name of this test suite."); p.addOption( bCleanup, "no-cleanup", "Don't erase temp files."); p.setOverride( "no-cleanup", false ); + p.addOption( bInterop, "interop", "Output machine parsable json."); + p.setOverride( "interop", true ); p.setNonOption( Bu::slot( this, &Bu::UnitSuite::onAddTest ) ); p.addHelpOption(); p.parse( argc, argv ); @@ -56,108 +62,58 @@ int Bu::UnitSuite::run( int argc, char *argv[] ) lTests = lSub; } - int iEPass = 0; - int iEFail = 0; - int iUPass = 0; - int iUFail = 0; + if( bInterop ) + pReport = new ReportJson(); + else + pReport = new ReportConsole(); + pReport->suiteStarting( *this, lTests ); + for( TestList::iterator i = lTests.begin(); i != lTests.end(); i++ ) { - sio << Fmt( iNameWidth+3, Fmt::Left ).fill('.') << i->sName - << sio.flush; try { iStepCount = -1; iProgress = 0; + if( pReport ) + pReport->testStarting( *i ); (this->*(i->fTest))(); - switch( i->eExpect ) - { - case expectPass: - sio << "pass." << sio.nl; - iEPass++; - break; - - case expectFail: - sio << "unexpected pass." << sio.nl; - iUPass++; - break; - } + if( pReport ) + pReport->testEnded( *i ); } catch( Failed &e ) { - switch( i->eExpect ) - { - case expectPass: - sio << "unexpected "; - iUFail++; - break; - - case expectFail: - sio << "expected "; - iEFail++; - break; - } - if( e.bFile ) - { - sio << "fail in unitTest(" << e.str << "). (" << e.sFile - << ":" << e.nLine << ")." << sio.nl; - } - else - { - sio << "fail in unitTest(" << e.str << ")." << sio.nl; - } + if( pReport ) + pReport->testEnded( *i, e ); if( (iOptions & optStopOnError) ) + { return 0; + } } catch( std::exception &e ) { - switch( i->eExpect ) - { - case expectPass: - sio << "unexpected "; - iUFail++; - break; - - case expectFail: - sio << "expected "; - iEFail++; - break; - } - sio << "fail with unknown exception. what: " << e.what() << sio.nl; + if( pReport ) + pReport->testException( *i, e ); if( (iOptions & optStopOnError) ) + { return 0; + } } catch( ... ) { - switch( i->eExpect ) - { - case expectPass: - sio << "unexpected "; - iUFail++; - break; - - case expectFail: - sio << "expected "; - iEFail++; - break; - } sio << "fail with external exception." << sio.nl; + return -1; if( (iOptions & optStopOnError) ) + { return 0; + } } } - sio << sio.nl - << "Report:" << sio.nl - << "\tTotal tests run: " << lTests.getSize() << sio.nl - << "\tExpected passes: " << iEPass << sio.nl - << "\tExpected failures: " << iEFail << sio.nl - << "\tUnexpected passes: " << iUPass << sio.nl - << "\tUnexpected failures: " << iUFail << sio.nl << sio.nl; - if( iUPass == 0 && iUFail == 0 ) - sio << "\tNothing unexpected." << sio.nl << sio.nl; + if( pReport ) + pReport->suiteEnded(); if( bCleanup ) { @@ -165,6 +121,8 @@ int Bu::UnitSuite::run( int argc, char *argv[] ) { unlink( (*i).getStr() ); } + + cleanup(); } return 0; @@ -191,8 +149,6 @@ void Bu::UnitSuite::add( Test fTest, const Bu::String &sName, Expect e ) } ti.fTest = fTest; lTests.append( ti ); - if( iNameWidth < ti.sName.getSize() ) - iNameWidth = ti.sName.getSize(); } void Bu::UnitSuite::setName( const String &sName ) @@ -200,12 +156,21 @@ void Bu::UnitSuite::setName( const String &sName ) sSuiteName = sName; } +Bu::String Bu::UnitSuite::getName() const +{ + return sSuiteName; +} + +void Bu::UnitSuite::cleanup() +{ +} + void Bu::UnitSuite::dispProgress() { if( tLastUpdate == time( NULL ) ) return; - sio << Fmt(3) << (iProgress*100/iStepCount) << "%" << "\b\b\b\b" - << sio.flush; + if( pReport ) + pReport->updateProgress( iProgress, iStepCount ); tLastUpdate = time( NULL ); } @@ -251,6 +216,13 @@ int Bu::UnitSuite::onListCases( StrArray ) return 0; } +int Bu::UnitSuite::onPrintName( StrArray ) +{ + Bu::println("%1").arg( sSuiteName ); + exit( 0 ); + return 0; +} + int Bu::UnitSuite::onAddTest( StrArray aParam ) { hSelTests.insert( aParam[0], true ); @@ -262,12 +234,213 @@ Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::UnitSuite::Expect &e switch( e ) { case Bu::UnitSuite::expectPass: - return f << "expect pass"; + return f << "pass"; case Bu::UnitSuite::expectFail: - return f << "expect fail"; + return f << "fail"; } return f << "**error**"; } +///////// +// Bu::UnitSuite::Report +//// + +Bu::UnitSuite::Report::Report() +{ +} + +Bu::UnitSuite::Report::~Report() +{ +} + +///////// +// Bu::UnitSuite::ReportConsole +//// + +Bu::UnitSuite::ReportConsole::ReportConsole() : + iTestCount( 0 ), + iNameWidth( 0 ), + iEPass( 0 ), + iEFail( 0 ), + iUPass( 0 ), + iUFail( 0 ) +{ +} + +Bu::UnitSuite::ReportConsole::~ReportConsole() +{ +} + +void Bu::UnitSuite::ReportConsole::suiteStarting( const UnitSuite & /*rSuite*/, + const TestList &lTests ) +{ + iTestCount = lTests.getSize(); + for( TestList::const_iterator i = lTests.begin(); i; i++ ) + { + if( iNameWidth < i->sName.getSize() ) + iNameWidth = i->sName.getSize(); + } +} + +void Bu::UnitSuite::ReportConsole::testStarting( const TestInfo &rTest ) +{ + sio << Fmt( iNameWidth+3, Fmt::Left ).fill('.') << rTest.sName + << sio.flush; +} + +void Bu::UnitSuite::ReportConsole::updateProgress( int iProgress, + int iStepCount ) +{ + sio << Fmt(3) << (iProgress*100/iStepCount) << "%" << "\b\b\b\b" + << sio.flush; +} + +void Bu::UnitSuite::ReportConsole::testEnded( const TestInfo &rTest ) +{ + switch( rTest.eExpect ) + { + case expectPass: + sio << "pass." << sio.nl; + iEPass++; + break; + + case expectFail: + sio << "unexpected pass." << sio.nl; + iUPass++; + break; + } +} + +void Bu::UnitSuite::ReportConsole::testEnded( const TestInfo &rTest, + const Bu::UnitSuite::Failed &rFail ) +{ + switch( rTest.eExpect ) + { + case expectPass: + sio << "unexpected "; + iUFail++; + break; + + case expectFail: + sio << "expected "; + iEFail++; + break; + } + if( rFail.bFile ) + { + sio << "fail in unitTest(" << rFail.str << "). (" << rFail.sFile + << ":" << rFail.nLine << ")." << sio.nl; + } + else + { + sio << "fail in unitTest(" << rFail.str << ")." << sio.nl; + } +} + +void Bu::UnitSuite::ReportConsole::testException( const TestInfo &rTest, + std::exception &e ) +{ + switch( rTest.eExpect ) + { + case expectPass: + sio << "unexpected "; + iUFail++; + break; + + case expectFail: + sio << "expected "; + iEFail++; + break; + } + sio << "fail with unknown exception. what: " << e.what() << sio.nl; +} + +void Bu::UnitSuite::ReportConsole::suiteEnded() +{ + sio << sio.nl + << "Report:" << sio.nl + << "\tTotal tests run: " << iTestCount << sio.nl; + + if( iEPass > 0 ) + sio << "\tExpected passes: " << iEPass << sio.nl; + if( iEFail > 0 ) + sio << "\tExpected failures: " << iEFail << sio.nl; + if( iUPass > 0 ) + sio << "\tUnexpected passes: " << iUPass << sio.nl; + if( iUFail > 0 ) + sio << "\tUnexpected failures: " << iUFail << sio.nl; + sio << sio.nl; + if( iUPass == 0 && iUFail == 0 ) + sio << "\tNothing unexpected." << sio.nl << sio.nl; +} + + +///////// +// Bu::UnitSuite::Report +//// + +Bu::UnitSuite::ReportJson::ReportJson() : + pReport( new Bu::Json( Bu::Json::Object ) ) +{ +} + +Bu::UnitSuite::ReportJson::~ReportJson() +{ + delete pReport; +} + +void Bu::UnitSuite::ReportJson::suiteStarting( const UnitSuite &rSuite, + const TestList & /*lTests*/ ) +{ + pReport->insert("type", "report"); + pReport->insert("suite", rSuite.getName() ); + pReport->insertArray("tests"); +} + +void Bu::UnitSuite::ReportJson::testStarting( const TestInfo & ) +{ +} + +void Bu::UnitSuite::ReportJson::updateProgress( int, int ) +{ +} + +void Bu::UnitSuite::ReportJson::testEnded( const TestInfo &rTest ) +{ + Bu::Json &rOb = (*pReport)["tests"].appendObject(); + rOb.insert("name", rTest.sName ); + rOb.insert("expected", Bu::String("%1").arg( rTest.eExpect ) ); + rOb.insert("result", "pass"); +} + +void Bu::UnitSuite::ReportJson::testEnded( const TestInfo &rTest, + const Bu::UnitSuite::Failed &rFail ) +{ + Bu::Json &rOb = (*pReport)["tests"].appendObject(); + rOb.insert("name", rTest.sName ); + rOb.insert("expected", Bu::String("%1").arg( rTest.eExpect ) ); + rOb.insert("result", "fail"); + Bu::Json &rFailOb = rOb.insertObject("fail"); + rFailOb.insert("action", rFail.str ); + rFailOb.insert("file", rFail.sFile ); + rFailOb.insert("line", (double)rFail.nLine ); +} + +void Bu::UnitSuite::ReportJson::testException( const TestInfo &rTest, + std::exception &e ) +{ + Bu::Json &rOb = (*pReport)["tests"].appendObject(); + rOb.insert("name", rTest.sName ); + rOb.insert("expected", Bu::String("%1").arg( rTest.eExpect ) ); + rOb.insert("result", "fail"); + Bu::Json &rFail = rOb.insertObject("fail"); + rFail.insert("what", e.what() ); +} + +void Bu::UnitSuite::ReportJson::suiteEnded() +{ + Bu::println("%1").arg( pReport->toString() ); +} + diff --git a/src/stable/unitsuite.h b/src/stable/unitsuite.h index ea5e389..b1e2953 100644 --- a/src/stable/unitsuite.h +++ b/src/stable/unitsuite.h @@ -17,6 +17,7 @@ namespace Bu { + class Json; /** * Provides a unit testing framework. This is pretty easy to use, probably * the best way to get started is to use ch to generate a template, or use @@ -96,6 +97,8 @@ namespace Bu protected: void add( Test fTest, const Bu::String &sName, Expect e=expectPass ); void setName( const String &sName ); + String getName() const; + virtual void cleanup(); void dispProgress(); void setStepCount( int iSteps ); @@ -104,6 +107,7 @@ namespace Bu private: int onListCases( Bu::Array aParam ); + int onPrintName( Bu::Array aParam ); int onAddTest( Bu::Array aParam ); private: @@ -128,6 +132,75 @@ namespace Bu time_t tLastUpdate; Bu::Hash hSelTests; + + public: + class Report + { + public: + Report(); + virtual ~Report(); + + virtual void suiteStarting( const UnitSuite &rSuite, + const TestList &lTests )=0; + virtual void testStarting( const TestInfo &rTest )=0; + virtual void updateProgress( int iProgress, int iStepCount )=0; + virtual void testEnded( const TestInfo &rTest )=0; + virtual void testEnded( const TestInfo &rTest, + const Failed &rFail )=0; + virtual void testException( const TestInfo &rTest, + std::exception &e )=0; + virtual void suiteEnded()=0; + }; + + class ReportConsole : public Report + { + public: + ReportConsole(); + virtual ~ReportConsole(); + + virtual void suiteStarting( const UnitSuite &rSuite, + const TestList &lTests ); + virtual void testStarting( const TestInfo &rTest ); + virtual void updateProgress( int iProgress, int iStepCount ); + virtual void testEnded( const TestInfo &rTest ); + virtual void testEnded( const TestInfo &rTest, + const Failed &rFail ); + virtual void testException( const TestInfo &rTest, + std::exception &e ); + virtual void suiteEnded(); + + private: + int iTestCount; + int iNameWidth; + int iEPass; + int iEFail; + int iUPass; + int iUFail; + }; + + class ReportJson : public Report + { + public: + ReportJson(); + virtual ~ReportJson(); + + virtual void suiteStarting( const UnitSuite &rSuite, + const TestList &lTests ); + virtual void testStarting( const TestInfo &rTest ); + virtual void updateProgress( int iProgress, int iStepCount ); + virtual void testEnded( const TestInfo &rTest ); + virtual void testEnded( const TestInfo &rTest, + const Failed &rFail ); + virtual void testException( const TestInfo &rTest, + std::exception &e ); + virtual void suiteEnded(); + + private: + class Bu::Json *pReport; + }; + + private: + Report *pReport; }; Bu::Formatter &operator<<( Bu::Formatter &f, const Bu::UnitSuite::Expect &e ); diff --git a/src/tools/mkunit.cpp b/src/tools/mkunit.cpp index f6ea669..5711c42 100644 --- a/src/tools/mkunit.cpp +++ b/src/tools/mkunit.cpp @@ -42,6 +42,7 @@ enum TokType tokTest, tokChar, tokBlock, + tokCleanup, tokEof }; @@ -54,6 +55,7 @@ Bu::Formatter &operator<<( Bu::Formatter &f, TokType t ) case tokTest: return f << "tokTest"; case tokChar: return f << "tokChar"; case tokBlock: return f << "tokBlock"; + case tokCleanup: return f << "tokCleanup"; case tokEof: return f << "tokEof"; } @@ -193,6 +195,8 @@ public: { if( sTok == "test" ) return tokTest; + else if( sTok == "cleanup" ) + return tokCleanup; else { v = sTok; @@ -361,6 +365,15 @@ public: s.lTest.append( t ); } break; + + case tokCleanup: + { + if( nextToken( v, sWs, iL, iC ) != tokBlock ) + throw Bu::ExceptionBase("%d:%d: Expected " + "{...} block.", + iL, iC ); + } + break; case tokChar: if( v.get() == '}' ) @@ -438,7 +451,7 @@ public: for( TestList::iterator i = s.lTest.begin(); i; i++ ) { f << "\t\tadd( static_cast(" - "&" << sClass << "::" << (*i).sName << "), \"" + "&" << sClass << "::_test_" << (*i).sName << "), \"" << (*i).sName << "\", Bu::UnitSuite::" "expectPass );" << f.nl; } @@ -481,9 +494,24 @@ public: "{...} block.", iL, iC ); - f << "\tvoid " << t.sName << "()" + f << "void _test_" << t.sName << "()" + << f.nl << "#line " << iL + << " \"" << sIn << "\"" << f.nl << " " + << v << f.nl; + } + break; + + case tokCleanup: + { + fOut.write( sWs ); + if( nextToken( v, sWs, iL, iC ) != tokBlock ) + throw Bu::ExceptionBase("%d:%d: Expected " + "{...} block.", + iL, iC ); + + f << "void cleanup()" << f.nl << "#line " << iL - << " \"" << sIn << "\"" << f.nl + << " \"" << sIn << "\"" << f.nl << " " << v << f.nl; } break; diff --git a/src/tools/rununits.cpp b/src/tools/rununits.cpp new file mode 100644 index 0000000..769d3ab --- /dev/null +++ b/src/tools/rununits.cpp @@ -0,0 +1,186 @@ +#include +#include +#include +#include +#include +#include + +#include +#include + +Bu::Blob getSuiteName( const Bu::Blob &bSuiteExec ) +{ + Bu::Process proc( + Bu::Process::StdOut, + bSuiteExec.getData(), + bSuiteExec.getData(), + "--print-name", + NULL + ); + + Bu::String sResult = proc.readAll().trimWhitespace(); + Bu::Blob bRet( sResult.getStr(), sResult.getSize() ); + return bRet; +} + +Bu::Json *runSuite( const Bu::Blob &bSuiteExec ) +{ + Bu::Process proc( + Bu::Process::StdOut, + bSuiteExec.getData(), + bSuiteExec.getData(), + "--interop", + NULL + ); + Bu::BlobBuilder bbReport; + while( proc.isRunning() ) + { + int iRead = 0; + char dRead[4096]; + iRead = proc.read( dRead, 4096 ); + if( iRead > 0 ) + { + bbReport.append( dRead, iRead ); + } + } + Bu::Json *pReport = new Bu::Json(); + pReport->parse( bbReport.getBlob() ); + return pReport; +} + +typedef Bu::List BlobList; + +BlobList getSuitePaths( const Bu::Blob &bDir ) +{ + BlobList lPaths; + DIR *dir = opendir( bDir.getData() ); + if( dir == NULL ) + { + Bu::println("Could not open directory: %1").arg( bDir ); + return lPaths; + } + struct dirent *de = NULL; + while( (de = readdir( dir )) != NULL ) + { + if( de->d_type != DT_REG ) + continue; + + Bu::BlobBuilder bbPath; + bbPath.append( bDir ); + bbPath.append("/"); + bbPath.append( de->d_name ); + Bu::Blob bPath = bbPath.getBlob(); + if( access( bPath.getData(), X_OK ) != 0 ) + continue; + + lPaths.append( bPath ); + } + closedir( dir ); + + return lPaths; +} + +int main( int /*argc*/, char * /*argv*/[] ) +{ + Bu::Blob bDir("unit"); + BlobList lPaths = getSuitePaths( bDir ); + + int iNumLen = Bu::String("%1").arg( lPaths.getSize() ).end().getSize(); + int iMaxSuiteName = 0; + Bu::Hash hName; + for( BlobList::iterator i = lPaths.begin(); i; i++ ) + { + Bu::Blob bSuiteName = getSuiteName( *i ); + if( iMaxSuiteName < bSuiteName.getSize() ) + iMaxSuiteName = bSuiteName.getSize(); + hName.insert( *i, bSuiteName ); + } + + Bu::List lReport; + + int iTest = 0; + for( BlobList::iterator i = lPaths.begin(); i; i++ ) + { + iTest++; + Bu::Blob bSuiteName = hName.get( *i ); + Bu::print("\rRunning test suite [%1/%2]: %3") + .arg( iTest, Bu::Fmt().width( iNumLen ).right() ) + .arg( lPaths.getSize(), Bu::Fmt().width( iNumLen ) ) + .arg( bSuiteName, Bu::Fmt().width( iMaxSuiteName ).fill(' ').left() ); + Bu::sio << Bu::sio.flush; + + Bu::Json *pReport = runSuite( (*i) ); + int iUnexpected = 0; + int iTotal = 0; + iTotal = (*pReport)["tests"].getSize(); + for( int j = 0; j < iTotal; j++ ) + { + if( !((*pReport)["tests"][j]["expected"].getString() == + (*pReport)["tests"][j]["result"].getString()) ) + { + iUnexpected++; + } + } + if( iUnexpected == 0 ) + { + delete pReport; + } + else + { + lReport.append( pReport ); + } + } + Bu::println("\rCompleted %1 unit test suites.%2") + .arg( lPaths.getSize(), Bu::Fmt().width( iNumLen ) ) + .arg( Bu::Blob(""), Bu::Fmt().width( iMaxSuiteName ).fill(' ').left() ); + + if( lReport.getSize() == 0 ) + { + Bu::println("\nNothing unexpected in unit tests."); + } + else + { + for( Bu::List::iterator i = lReport.begin(); i; i++ ) + { + Bu::println("\nUnexpected results in: %1") + .arg( (**i)["suite"].getString().get() ); + + for( Bu::Json::iterator iTest = (**i)["tests"].begin(); + iTest; iTest++ ) + { + if( (**iTest)["expected"].getString() == + (**iTest)["result"].getString() ) + { + continue; + } + + Bu::println(" %1: unexpected %2") + .arg( (**iTest)["name"].getString().get() ) + .arg( (**iTest)["result"].getString().get() ); + if( (**iTest).has("fail") ) + { + if( (**iTest)["fail"].has("action") ) + { + Bu::println(" unitTest( %1 );") + .arg( (**iTest)["fail"]["action"].getString().get() ); + Bu::println(" at %1:%2") + .arg( (**iTest)["fail"]["file"].getString().get() ) + .arg( (int)(**iTest)["fail"]["line"].getNumber() ); + } + else if( (**iTest)["fail"].has("what") ) + { + Bu::println(" Unexpected exception: %1") + .arg( (**iTest)["fail"]["what"].getString().get() ); + } + } + else + { + Bu::println(" No further details."); + } + } + delete *i; + } + } + + return 0; +} diff --git a/src/unit/file.unit b/src/unit/file.unit index ee69995..b8cb73f 100644 --- a/src/unit/file.unit +++ b/src/unit/file.unit @@ -14,6 +14,11 @@ suite File { + cleanup + { + unlink("testfile1"); + } + test writeFull { Bu::File sf("testfile1", Bu::File::WriteNew ); diff --git a/src/unit/xml.unit b/src/unit/xml.unit index 0d62b8b..21757cb 100644 --- a/src/unit/xml.unit +++ b/src/unit/xml.unit @@ -12,10 +12,4 @@ suite Xml { - test declaration - { - Bu::String sXml(" "); - Bu::MemBuf buf( sXml ); - Bu::XmlReader xr( buf ); - } } diff --git a/src/unstable/blob.cpp b/src/unstable/blob.cpp index a9cb99d..d343963 100644 --- a/src/unstable/blob.cpp +++ b/src/unstable/blob.cpp @@ -813,7 +813,7 @@ template<> void Bu::__tracer_format( const Bu::Blob &v ) #include "bu/formatter.h" Bu::Formatter &Bu::operator<<( Bu::Formatter &rOut, const Bu::Blob &b ) { - rOut.write( b.getData(), b.getSize() ); + rOut.writeAligned( b.getData(), b.getSize() ); return rOut; } -- cgit v1.2.3