diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2018-02-05 16:47:05 +0000 |
|---|---|---|
| committer | Tavmjong Bah <tavmjong@free.fr> | 2018-02-05 16:47:05 +0000 |
| commit | 3def0ee6af06917b5332bc345c3b9fadc363eb1c (patch) | |
| tree | bbc50a3350aec50833acb52c02063e63f491dacc /src | |
| parent | Improve/fix error reporting when executing script extensions (diff) | |
| download | inkscape-3def0ee6af06917b5332bc345c3b9fadc363eb1c.tar.gz inkscape-3def0ee6af06917b5332bc345c3b9fadc363eb1c.zip | |
Remove unused cxxtest files.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/MultiPrinter.h | 112 | ||||
| -rw-r--r-- | src/PylogFormatter.h | 386 | ||||
| -rw-r--r-- | src/TRPIFormatter.h | 194 |
4 files changed, 0 insertions, 695 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 730138ff4..6e6c49c88 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -102,9 +102,6 @@ set(inkscape_SRC # ------- # Headers - MultiPrinter.h - PylogFormatter.h - TRPIFormatter.h attribute-rel-css.h attribute-rel-svg.h attribute-rel-util.h diff --git a/src/MultiPrinter.h b/src/MultiPrinter.h deleted file mode 100644 index 0d97b2ee9..000000000 --- a/src/MultiPrinter.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef SEEN_MULTI_PRINTER_H -#define SEEN_MULTI_PRINTER_H - - -#include <cxxtest/Flags.h> - -#ifndef _CXXTEST_HAVE_STD -# define _CXXTEST_HAVE_STD -#endif // _CXXTEST_HAVE_STD - -#include <cxxtest/ErrorFormatter.h> -#include <cxxtest/StdValueTraits.h> - -#ifdef _CXXTEST_OLD_STD -# include <iostream.h> -# include <fstream.h> -# include <string.h> -#else // !_CXXTEST_OLD_STD -# include <iostream> -# include <fstream> -# include <string> -#endif // _CXXTEST_OLD_STD - - -#include <cxxtest/TeeListener.h> -#include "TRPIFormatter.h" -#include "PylogFormatter.h" - -namespace CxxTest { - -class MultiPrinter : public TeeListener -{ -public: - MultiPrinter( const char* baseName = "result" ) : - TeeListener(), - _baseName( baseName ), - _xmlName( _baseName + ".xml" ), - _logName( _baseName + ".log" ), - _xmlFile( _xmlName.c_str(), CXXTEST_STD(ios::out)), - _logFile( _logName.c_str(), CXXTEST_STD(ios::out)), - _dstOne( new FileAdapter( CXXTEST_STD(cout) ) ), - _dstXml( new FileAdapter( _xmlFile ) ), - _dstPylog( new FileAdapter( _logFile ), _baseName.c_str() ) - { - setFirst( _dstOne ); - setSecond( _subTee ); - _subTee.setFirst( _dstXml ); - _subTee.setSecond( _dstPylog ); - } - - virtual ~MultiPrinter() - { - _xmlFile.close(); - _logFile.close(); - } - - int run() - { - TestRunner::runAllTests( *this ); - return tracker().failedTests(); - } - -protected: - CXXTEST_STD(string) _baseName; - CXXTEST_STD(string) _xmlName; - CXXTEST_STD(string) _logName; - CXXTEST_STD(fstream) _xmlFile; - CXXTEST_STD(fstream) _logFile; - - TeeListener _subTee; - ErrorFormatter _dstOne; - TRPIFormatter _dstXml; - PylogFormatter _dstPylog; - -private: - class FileAdapter : public OutputStream - { - FileAdapter( const FileAdapter & ); - FileAdapter &operator=( const FileAdapter & ); - - CXXTEST_STD(ostream) &_o; - - public: - FileAdapter( CXXTEST_STD(ostream) &o ) : _o(o) {} - void flush() { _o.flush(); } - OutputStream &operator<<( const char *s ) { _o << s; return *this; } - OutputStream &operator<<( Manipulator m ) { return OutputStream::operator<<( m ); } - OutputStream &operator<<( unsigned i ) - { - char s[1 + 3 * sizeof(unsigned)]; - numberToString( i, s ); - _o << s; - return *this; - } - }; - -}; - -} - -/* - 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:fileencoding=utf-8:textwidth=99 : - -#endif //SEEN_MULTI_PRINTER_H diff --git a/src/PylogFormatter.h b/src/PylogFormatter.h deleted file mode 100644 index 94dba050c..000000000 --- a/src/PylogFormatter.h +++ /dev/null @@ -1,386 +0,0 @@ -#ifndef PYLOG_FORMATTER_H_SEEN -#define PYLOG_FORMATTER_H_SEEN - -#include <cstring> -#include <cxxtest/Flags.h> - -#ifndef _CXXTEST_HAVE_STD -# define _CXXTEST_HAVE_STD -#endif // _CXXTEST_HAVE_STD - -#include <cxxtest/ErrorFormatter.h> -#include <cxxtest/StdValueTraits.h> - -#ifdef _CXXTEST_OLD_STD -# include <iostream.h> -#else // !_CXXTEST_OLD_STD -# include <iostream> -#endif // _CXXTEST_OLD_STD - -namespace CxxTest -{ -class PylogFormatter : public TestListener -{ -public: - PylogFormatter( OutputStream *o, const char* name = "test" ) : - _o(o), - _base( _chompPath( name ) ), - _runPassed(true), - _suiteIndex(-1), - _testIndex(-1) - {} - virtual ~PylogFormatter() { delete outputStream(); } - - virtual void enterWorld( const WorldDescription & /*desc*/ ) - { - (*_o) << "**************************************************" << endl; - _o->flush(); - } - - virtual void leaveWorld( const WorldDescription & desc ) - { - using std::strlen; - unsigned int skippedCount = 0; - unsigned int failedCount = 0; - unsigned int warnedCount = 0; - unsigned int passedCount = 0; - - 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); - - // Test Name - (*_o) << _base.c_str() << "_"; - _padOut( i, 3 ); - (*_o) << "_"; - _padOut( j, 3); - (*_o) << " "; - - // Test Description - (*_o) << test.suiteName() << "_|_" << test.testName(); - (*_o) << " "; - - unsigned const sent = strlen( test.suiteName() ) + strlen( test.testName() ) + 1; - for ( unsigned z = sent; z < 56; z++ ) { - (*_o) << " "; - } - - (*_o) << " : "; - - switch ( _status[i][j] ) { - case OK: - (*_o) << "PASS"; - passedCount++; - break; - case SKIPPED: - (*_o) << "OMIT"; - skippedCount++; - break; - case WARNING: - (*_o) << "WARNING"; - warnedCount++; - break; - case ERROR: - (*_o) << "FAILURE"; - failedCount++; - break; - } - - (*_o) << endl; - for ( CXXTEST_STD(vector)<CXXTEST_STD(string)>::iterator it = _messages[i][j].begin(); it < _messages[i][j].end(); ++it ) { - (*_o) << " " << (*it).c_str() << endl; - } - } - } - - (*_o) << "**************************************************" << endl; - (*_o) << "Command line asked for " << desc.numTotalTests() << " of " << desc.numTotalTests() << " tests" << endl; - (*_o) << "Of those: " - << skippedCount << " Skipped, " - << failedCount << " Failed, " - << warnedCount << " Warned, " - << passedCount << " Passed" - << endl; - } - - - virtual void enterSuite( const SuiteDescription & desc ) - { - (void)desc; - _suiteIndex++; - _testIndex = -1; - while ( (_suiteIndex >= 0) && ((int)_status.size() <= _suiteIndex) ) { - CXXTEST_STD(vector)<ErrorLevel> tmp; - _status.push_back(tmp); - CXXTEST_STD(vector)<CXXTEST_STD(vector)<CXXTEST_STD(string)> > tmp2; - _messages.push_back(tmp2); - } - } - - 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) ) { - ErrorLevel tmp = OK; - _status[_suiteIndex].push_back(tmp); - CXXTEST_STD(vector)<CXXTEST_STD(string)> tmp2; - _messages[_suiteIndex].push_back(tmp2); - } - } - } - - virtual void leaveTest( const TestDescription & desc ) - { - (void)desc; - } - - virtual void trace( const char * file, unsigned line, - const char * expression ) - { - CXXTEST_STD(string)tmp(expression); - _traceCurrent( file, line, tmp ); - } - - virtual void warning( const char * file, unsigned line, - const char * expression ) - { - CXXTEST_STD(string)tmp(expression); - _warnCurrent( file, line, tmp ); - } - - virtual void failedTest( const char * file, unsigned line, - const char * expression ) - { - CXXTEST_STD(string)tmp(expression); - _failCurrent( file, line, tmp ); - } - - virtual void failedAssert( const char * file, unsigned line, - const char * expression ) - { - CXXTEST_STD(string)tmp(expression); - _failCurrent( file, line, tmp ); - } - - virtual void failedAssertEquals( const char * file, unsigned line, - const char * xStr, const char * yStr, - const char * x, const char * y ) - { - CXXTEST_STD(string)tmp; - tmp += "Expected ("; - tmp += xStr; - tmp += " == "; - tmp += yStr; - tmp += "), found ("; - tmp += x; - tmp += " != "; - tmp += y; - tmp += ")"; - _failCurrent( file, line, tmp ); - } - - 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*/ ) - { - CXXTEST_STD(string)tmp("TODO - fill in error details"); - _failCurrent( file, line, tmp ); - } - - 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*/ ) - { - CXXTEST_STD(string)tmp("TODO - fill in error details"); - _failCurrent( file, line, tmp ); - } - - virtual void failedAssertDiffers( const char * file, unsigned line, - const char * xStr, const char * yStr, - const char * value ) - { - CXXTEST_STD(string)tmp; - tmp += "Expected ("; - tmp += xStr; - tmp += " != "; - tmp += yStr; - tmp += "), found ("; - tmp += value; - tmp += ")"; - _failCurrent( file, line, tmp ); - } - - virtual void failedAssertLessThan( const char * file, unsigned line, - const char * xStr, const char * yStr, - const char * x, const char * y ) - { - CXXTEST_STD(string)tmp; - tmp += "Expected ("; - tmp += xStr; - tmp += " < "; - tmp += yStr; - tmp += "), found ("; - tmp += x; - tmp += " >= "; - tmp += y; - tmp += ")"; - _failCurrent( file, line, tmp ); - } - - virtual void failedAssertLessThanEquals( const char * file, unsigned line, - const char * xStr, const char * yStr, - const char * x, const char * y ) - { - CXXTEST_STD(string)tmp; - tmp += "Expected ("; - tmp += xStr; - tmp += " <= "; - tmp += yStr; - tmp += "), found ("; - tmp += x; - tmp += " > "; - tmp += y; - tmp += ")"; - _failCurrent( file, line, tmp ); - } - - virtual void failedAssertPredicate( const char * file, unsigned line, - const char * /*predicate*/, const char * /*xStr*/, const char * /*x*/ ) - { - CXXTEST_STD(string)tmp("TODO - fill in error details"); - _failCurrent( file, line, tmp ); - } - - virtual void failedAssertRelation( const char * file, unsigned line, - const char * /*relation*/, const char * /*xStr*/, const char * /*yStr*/, - const char * /*x*/, const char * /*y*/ ) - { - CXXTEST_STD(string)tmp("TODO - fill in error details"); - _failCurrent( file, line, tmp); - } - - virtual void failedAssertThrows( const char * file, unsigned line, - const char * /*expression*/, const char * /*type*/, - bool /*otherThrown*/ ) - { - CXXTEST_STD(string)tmp("TODO - fill in error details"); - _failCurrent( file, line, tmp ); - } - - virtual void failedAssertThrowsNot( const char * file, unsigned line, - const char * expression ) - { - CXXTEST_STD(string)tmp(expression); - _failCurrent( file, line, tmp ); - } - -protected: - - enum ErrorLevel { - OK, - SKIPPED, - WARNING, - ERROR - }; - - OutputStream *outputStream() const - { - return _o; - } - - void _traceCurrent( const char* /*file*/, unsigned /*line*/, const CXXTEST_STD(string)& errMsg ) { - _runPassed = false; - if ( _suiteIndex < (int)_status.size() ) { - if ( _testIndex < (int)_status[_suiteIndex].size() ) { - _messages[_suiteIndex][_testIndex].push_back( errMsg ); - } - } - } - - void _warnCurrent( const char* /*file*/, unsigned /*line*/, const CXXTEST_STD(string)& errMsg ) { - _runPassed = false; - if ( _suiteIndex < (int)_status.size() ) { - if ( _testIndex < (int)_status[_suiteIndex].size() ) { - if ( _status[_suiteIndex][_testIndex] != ERROR ) { - _status[_suiteIndex][_testIndex] = WARNING; - } - - _messages[_suiteIndex][_testIndex].push_back( errMsg ); - } - } - } - - void _failCurrent( const char* /*file*/, unsigned /*line*/, const CXXTEST_STD(string)& errMsg ) { - _runPassed = false; - if ( _suiteIndex < (int)_status.size() ) { - if ( _testIndex < (int)_status[_suiteIndex].size() ) { - _status[_suiteIndex][_testIndex] = ERROR; - - _messages[_suiteIndex][_testIndex].push_back( errMsg ); - } - } - } - - void _padOut( unsigned int num, int digits ) - { - int match = 1; - for ( int j = 1; j < digits; j++ ) { - match *= 10; - } - - for ( unsigned int i = match; i > 1 && i > num; i /= 10 ) - { - (*_o) << "0"; - } - (*_o) << num; - } - -private: - static void endl( OutputStream &o ) - { - OutputStream::endl( o ); - } - - static CXXTEST_STD(string) _chompPath( const char* str ) - { - CXXTEST_STD(string) tmp( str ); - if ( tmp.length() > 2 && tmp[0] == '.' && tmp[1] == '/' ) { - tmp = tmp.substr( 2 ); - } - return tmp; - } - - OutputStream *_o; - CXXTEST_STD(string) _base; - CXXTEST_STD(vector)< CXXTEST_STD(vector)<ErrorLevel> > _status; - CXXTEST_STD(vector)< CXXTEST_STD(vector)< CXXTEST_STD(vector)<CXXTEST_STD(string)> > > _messages; - - 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:fileencoding=utf-8:textwidth=99 : - -#endif // PYLOG_FORMATTER_H_SEEN diff --git a/src/TRPIFormatter.h b/src/TRPIFormatter.h deleted file mode 100644 index 4aa9ed2e6..000000000 --- a/src/TRPIFormatter.h +++ /dev/null @@ -1,194 +0,0 @@ -#ifndef TRPI_FORMATTER_H_SEEN -#define TRPI_FORMATTER_H_SEEN - -#include <cxxtest/Flags.h> - -#ifndef _CXXTEST_HAVE_STD -# define _CXXTEST_HAVE_STD -#endif // _CXXTEST_HAVE_STD - -#include <cxxtest/ErrorFormatter.h> -#include <cxxtest/StdValueTraits.h> - -#ifdef _CXXTEST_OLD_STD -# include <iostream.h> -#else // !_CXXTEST_OLD_STD -# include <iostream> -#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) << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" << endl; - (*_o) << "<component name=\"inkscape\" version=\"0.43+svn\" xmlns=\"http://www.spikesource.com/xsd/2005/04/TRPI\">" << endl; - (*_o) << " <description>TBD</description>" << endl; - (*_o) << " <summary>single-line info</summary>" << endl; - (*_o) << " <license></license>" << endl; - (*_o) << " <vendor></vendor>" << endl; - (*_o) << " <release>devel SVN</release>" << endl; - (*_o) << " <url>http://www.inkscape.org/</url>" << endl; -// (*_o) << " <root></root>" << endl; - (*_o) << " <platform>\?\?\?</platform>" << endl; - _o->flush(); - } - - virtual void leaveWorld( const WorldDescription & desc ) - { - (*_o) << " <build status=\"" << (_runPassed?"pass":"fail") << "\"/>" << 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) << " <test suite-type=\"unit\">" << endl; - (*_o) << " <result executed=\"" << (unsigned)1 - << "\" passed=\"" << (unsigned)(_status[i][j] ? 1:0) - << "\" failed=\"" << (unsigned)(_status[i][j] ? 0:1) - << "\" skipped=\"" << (unsigned)0 - << "\"/>" << endl; - - (*_o) << " <suiteName>" << test.suiteName() << "</suiteName>" << endl; - (*_o) << " <testName>" << test.testName() << "</testName>" << endl; - -// (*_o) << " <report name=\"" << test.suiteName() << "|" << test.testName() << "\" path=\"index.html\"/>" << endl; - - (*_o) << " <expected-result executed=\"" << (unsigned)1 - << "\" passed=\"" << (unsigned)1 - << "\" failed=\"" << (unsigned)0 - << "\" skipped=\"" << (unsigned)0 - << "\"/>" << endl; - (*_o) << " </test>" << endl; - } - } - -// (*_o) << " <coverage-report />" << endl; -// (*_o) << " <code-convention-report />" << endl; - (*_o) << "</component>" << endl; - } - - virtual void enterSuite( const SuiteDescription & desc ) - { - (void)desc; - _suiteIndex++; - _testIndex = -1; - while ( (_suiteIndex >= 0) && ((int)_status.size() <= _suiteIndex) ) { - std::vector<bool> 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<bool> > _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:fileencoding=utf-8:textwidth=99 : - -#endif // TRPI_FORMATTER_H_SEEN |
