⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 countinglistenerproxy.h

📁 symbian 3rd下的单元测试工具 里面包括一个框架 一个实例程序 还有使用手册 很好用的 我自己用过 有问题的可以交流奥
💻 H
字号:
#ifndef __COUNTINGLISTENERPROXY_H
#define __COUNTINGLISTENERPROXY_H

//
// The CountingListenerProxy helps writing TestListener's by
// taking care of the "dirty" work.
// See YesNoRunner and ErrorPrinter for examples.
//

//Changed by Penrillian Ltd 14 August 2002
//failedAssertDiffers now prints both values compared

#include <cxxtest/TestListenerProxy.h>

namespace CxxTest
{
    class CountingListenerProxy : public TestListenerProxy
    {
        bool _testFailed, _suiteFailed, _worldFailed;
        unsigned _failedTestsNo;

        void failed()
        {
            _testFailed = _suiteFailed = _worldFailed = true;
        }
        
    public:
        CountingListenerProxy( TestListener *l ) : TestListenerProxy(l) {}

        bool testFailed() const { return _testFailed; }
        bool suiteFailed() const { return _suiteFailed; }
        bool worldFailed() const { return _worldFailed; }
        unsigned failedTestsNo() const { return _failedTestsNo; }

	void enterWorld( const WorldDescription &wd, TInt aSuite )
        {
            _worldFailed = false;
            _failedTestsNo = 0;
            TestListenerProxy::enterWorld(wd, aSuite);
        }

        void enterSuite( const SuiteDescription &sd )
        {
            _suiteFailed = false;
            TestListenerProxy::enterSuite(sd);
        }
        
	void enterTest( const TestDescription &td )
        {
            _testFailed = false;
            TestListenerProxy::enterTest(td);
        }

        void leaveTest( const TestDescription &td )
        {
            if ( _testFailed )
                ++ _failedTestsNo;
            TestListenerProxy::leaveTest(td);
        }

        void failedTest( const char *suiteName, const char *file, unsigned line, const char *expression )
        {
            failed();
            TestListenerProxy::failedTest( suiteName, file, line, expression );
        }
        
	void failedAssert( const char *suiteName, const char *file, unsigned line, const char *expression )
        {
            failed();
            TestListenerProxy::failedAssert( suiteName, file, line, expression );
        }

	void failedAssertThrows( const char *suiteName, const char *file, unsigned line, const char *expression,
                                 const char *type, bool otherThrown )
        {
            failed();
            TestListenerProxy::failedAssertThrows( suiteName, file, line, expression, type, otherThrown );
        }
        
	void failedAssertEquals( const char *suiteName, const char *file, unsigned line,
                                 const char *xStr, const char *yStr,
                                 const char *x, const char *y )
        {
            failed();
            TestListenerProxy::failedAssertEquals( suiteName, file, line, xStr, yStr, x, y );
        }

	void failedAssertDelta( const char *suiteName, const char *file, unsigned line,
                                const char *xStr, const char *yStr, const char *dStr,
                                const char *x, const char *y, const char *d )
        {
            failed();
            TestListenerProxy::failedAssertDelta( suiteName, file, line, xStr, yStr, dStr, x, y, d );
        }
	void failedAssertDiffers( const char *suiteName, const char *file, unsigned line,
                                  const char *xStr, const char *yStr,
                                  const char *x,const char *y )
        {
            failed();
            TestListenerProxy::failedAssertDiffers( suiteName, file, line, xStr, yStr, x,y );
        }
        
        void failedExpectation( const char *suiteName, const char *file, unsigned line,
                                const char *expected, const char *found )
        {
            failed();
            TestListenerProxy::failedExpectation( suiteName, file, line, expected, found );
        }
    };
}


#endif // __COUNTINGLISTENERPROXY_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -