#ifndef TRPI_FORMATTER_H_SEEN #define TRPI_FORMATTER_H_SEEN #include #ifndef _CXXTEST_HAVE_STD # define _CXXTEST_HAVE_STD #endif // _CXXTEST_HAVE_STD #include #include #ifdef _CXXTEST_OLD_STD # include #else // !_CXXTEST_OLD_STD # include #endif // _CXXTEST_OLD_STD namespace CxxTest { class TRPIFormatter : public TestListener { public: TRPIFormatter( OutputStream *o ) : _o(o), _runPassed(true), _suiteIndex(-1), _testIndex(-1) {} virtual ~TRPIFormatter() { delete outputStream(); } virtual void enterWorld( const WorldDescription & desc ) { _status.clear(); (*_o) << "" << endl; (*_o) << "" << endl; (*_o) << " TBD" << endl; (*_o) << " single-line info" << endl; (*_o) << " " << endl; (*_o) << " " << endl; (*_o) << " devel SVN" << endl; (*_o) << " http://www.inkscape.org/" << endl; // (*_o) << " " << endl; (*_o) << " \?\?\?" << endl; _o->flush(); } virtual void leaveWorld( const WorldDescription & desc ) { (*_o) << " " << endl; for ( unsigned int i = 0; i < desc.numSuites(); i++ ) { const SuiteDescription& suite = desc.suiteDescription(i); for ( unsigned int j = 0; j < suite.numTests(); j++ ) { const TestDescription& test = suite.testDescription(j); (*_o) << " " << endl; (*_o) << " " << endl; (*_o) << " " << test.suiteName() << "" << endl; (*_o) << " " << test.testName() << "" << endl; // (*_o) << " " << endl; (*_o) << " " << endl; (*_o) << " " << endl; } } // (*_o) << " " << endl; // (*_o) << " " << endl; (*_o) << "" << endl; } virtual void enterSuite( const SuiteDescription & desc ) { (void)desc; _suiteIndex++; _testIndex = -1; while ( (_suiteIndex >= 0) && ((int)_status.size() <= _suiteIndex) ) { std::vector tmp; _status.push_back(tmp); } } virtual void leaveSuite( const SuiteDescription & desc ) { (void)desc; } virtual void enterTest( const TestDescription & desc ) { (void)desc; if ( _suiteIndex >= 0 && (int)_status.size() > _suiteIndex ) { _testIndex++; while ( (_testIndex >= 0) && ((int)_status[_suiteIndex].size() <= _testIndex) ) { bool tmp = true; _status[_suiteIndex].push_back(tmp); } } } virtual void leaveTest( const TestDescription & desc ) { (void)desc; } virtual void failedTest( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { _failCurrent(); } virtual void failedAssert( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { _failCurrent(); } virtual void failedAssertEquals( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { _failCurrent(); } virtual void failedAssertSameData( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*sizeStr*/, const void * /*x*/, const void * /*y*/, unsigned /*size*/ ) { _failCurrent(); } virtual void failedAssertDelta( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*dStr*/, const char * /*x*/, const char * /*y*/, const char * /*d*/ ) { _failCurrent(); } virtual void failedAssertDiffers( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*value*/ ) { _failCurrent(); } virtual void failedAssertLessThan( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { _failCurrent(); } virtual void failedAssertLessThanEquals( const char * /*file*/, unsigned /*line*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { _failCurrent(); } virtual void failedAssertPredicate( const char * /*file*/, unsigned /*line*/, const char * /*predicate*/, const char * /*xStr*/, const char * /*x*/ ) { _failCurrent(); } virtual void failedAssertRelation( const char * /*file*/, unsigned /*line*/, const char * /*relation*/, const char * /*xStr*/, const char * /*yStr*/, const char * /*x*/, const char * /*y*/ ) { _failCurrent(); } virtual void failedAssertThrows( const char * /*file*/, unsigned /*line*/, const char * /*expression*/, const char * /*type*/, bool /*otherThrown*/ ) { _failCurrent(); } virtual void failedAssertThrowsNot( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) { _failCurrent(); } protected: OutputStream *outputStream() const { return _o; } void _failCurrent() { _runPassed = false; if ( _suiteIndex < (int)_status.size() ) { if ( _testIndex < (int)_status[_suiteIndex].size() ) { _status[_suiteIndex][_testIndex] = false; } } } private: static void endl( OutputStream &o ) { OutputStream::endl( o ); } OutputStream *_o; std::vector< std::vector > _status; bool _runPassed; int _suiteIndex; int _testIndex; }; } // namespace CxxTest /* Local Variables: mode:c++ c-file-style:"stroustrup" c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : #endif // TRPI_FORMATTER_H_SEEN