当前位置: 首页>>代码示例>>C++>>正文


C++ Tester::testsFinished方法代码示例

本文整理汇总了C++中Tester::testsFinished方法的典型用法代码示例。如果您正苦于以下问题:C++ Tester::testsFinished方法的具体用法?C++ Tester::testsFinished怎么用?C++ Tester::testsFinished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tester的用法示例。


在下文中一共展示了Tester::testsFinished方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: runTests

int KUnitTest::runTests()
{
    int globalSteps = 0;
    int globalPasses = 0;
    int globalFails = 0;
    int globalXFails = 0;
    int globalXPasses = 0;
    int globalSkipped = 0;

    cout << "# Running normal tests... #" << endl << endl;
    QAsciiDictIterator<Tester> it( m_tests );

    for( ; it.current(); ++it ) {
        Tester* test = it.current();
        test->allTests();
	cout << it.currentKey() << " - ";
	int numPass = test->testsFinished() - ( test->errorList().count() + test->xfailList().count() + test->skipList().count() );
	int numFail = test->errorList().count() + test->xfailList().count();
	int numXFail = test->xfailList().count();
	int numXPass = test->xpassList().count();
	int numSkip = test->skipList().count();

	globalSteps += test->testsFinished();
	globalPasses += numPass;
	globalFails += numFail;
	globalXFails += numXFail;
	globalXPasses += numXPass;
	globalSkipped += numSkip;

	cout << numPass << " test" << ( ( 1 == numPass )?"":"s") << " passed";
	if ( 0 < test->xpassList().count() ) {
	    cout << " (" << numXPass << " unexpected pass" << ( ( 1 == numXPass )?"":"es") << ")";
	}
	cout << ", " << numFail << " test" << ( ( 1 == numFail )?"":"s") << " failed";
	if ( 0 < numXFail  ) {
	    cout << " (" << numXFail << " expected failure" << ( ( 1 == numXFail )?"":"s") << ")";
	}
	if ( 0 < numSkip ) {
	    cout << "; also " << numSkip << " skipped";
	}	
	cout  << endl;

	if ( 0 < numXPass  ) {
	  cout << "    Unexpected pass" << ( ( 1 == numXPass )?"":"es") << ":" << endl;
	  QStringList list = test->xpassList();
	  for ( QStringList::Iterator itr = list.begin(); itr != list.end(); ++itr ) {
	    cout << "\t" << (*itr).latin1() << endl;
	  }
	}
	if ( 0 < (numFail - numXFail) ) {
	  cout << "    Unexpected failure" << ( ( 1 == numFail )?"":"s") << ":" << endl;
	  QStringList list = test->errorList();
	  for ( QStringList::Iterator itr = list.begin(); itr != list.end(); ++itr ) {
	    cout << "\t" << (*itr).latin1() << endl;
	  }
	}
	if ( 0 < numXFail ) {
	  cout << "    Expected failure" << ( ( 1 == numXFail)?"":"s") << ":" << endl;
	  QStringList list = test->xfailList();
	  for ( QStringList::Iterator itr = list.begin(); itr != list.end(); ++itr ) {
	    cout << "\t" << (*itr).latin1() << endl;
	  }
	}
	if ( 0 < numSkip ) {
	    cout << "    Skipped test" << ( ( 1 == numSkip )?"":"s") << ":" << endl;
	    QStringList list = test->skipList();
	    for ( QStringList::Iterator itr = list.begin(); itr != list.end(); ++itr ) {
		cout << "\t" << (*itr).latin1() << endl;
	    }
	}
	cout << endl;
    }

    cout << "# Done with normal tests:" << endl;
    cout << "  Total test cases: " << m_tests.count() << endl;
    cout << "  Total test steps                                 : " << globalSteps << endl;
    cout << "    Total passed test steps (including unexpected) : " << globalPasses << endl;
    cout << "      Total unexpected passed test steps           :  " << globalXPasses << endl;
    cout << "    Total failed test steps (including expected)   :  " << globalFails << endl;
    cout << "      Total expected failed test steps             :  " << globalXFails << endl;
    cout << "    Total skipped test steps                       :  " << globalSkipped << endl;

    return m_tests.count();
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:84,代码来源:kunittest.cpp


注:本文中的Tester::testsFinished方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。