本文整理汇总了C++中cppunit_ns::textui::TestRunner类的典型用法代码示例。如果您正苦于以下问题:C++ TestRunner类的具体用法?C++ TestRunner怎么用?C++ TestRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestRunner类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char**argv) {
CPPUNIT_NS::TextUi::TestRunner runner;
CPPUNIT_NS::TestFactoryRegistry ®istry = CPPUNIT_NS::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
bool wasSuccessful = runner.run();
return wasSuccessful ? 0 : 1;
}
开发者ID:nekenyu,项目名称:libBsdSockets,代码行数:7,代码来源:main.cpp
示例2: main
int main() {
#if defined (_MSC_VER) && defined (CHECK_HEAP) && _MSC_VER >= 1200
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) |
_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF |
_CRTDBG_CHECK_ALWAYS_DF);
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR );
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR );
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
#endif
// Get the top level suite from the registry
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
// Adds the test to the list of test to run
CPPUNIT_NS::TextUi::TestRunner runner;
runner.addTest( suite );
// Change the default outputter to a compiler error format outputter
runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(), std::cout ) );
// Run the test.
bool wasSucessful = runner.run();
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
}
开发者ID:grote,项目名称:Online-ASP,代码行数:30,代码来源:test_main.cpp
示例3: main
int main() {
CPPUNIT_NS::TextUi::TestRunner runner;
CppUnit::BriefTestProgressListener listener;
runner.eventManager().addListener(&listener);
runner.setOutputter(new CPPUNIT_NS::CompilerOutputter(&runner.result(),
CPPUNIT_NS::stdCOut()));
bool wasSucessful = runner.run();
return wasSucessful ? 0 : 1;
}
开发者ID:eidolonsystems,项目名称:beam,代码行数:9,代码来源:main.cpp
示例4: main
int main()
{
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
CPPUNIT_NS::TextUi::TestRunner runner;
runner.addTest( suite );
runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
CPPUNIT_NS::stdCOut() ) );
bool wasSucessful = runner.run();
return wasSucessful ? 0 : 1;
}
开发者ID:Distrotech,项目名称:cppunit,代码行数:10,代码来源:DllPlugInTesterTest.cpp
示例5: main
int main( int argc, char* argv[] )
{
std::ofstream oTestRst("TestQBase.xml");
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
CPPUNIT_NS::TextUi::TestRunner runner;
runner.addTest(suite);
runner.setOutputter(new CPPUNIT_NS::XmlOutputter(&runner.result(), oTestRst));
runner.run();
return 0;
}
开发者ID:CN-Zxcv,项目名称:QService,代码行数:12,代码来源:Main.cpp
示例6:
int
main(int argc, char** argv)
{
CPPUNIT_NS::TextUi::TestRunner runner;
runner.addTest( BoardGameTest<BoardGame>::suite() );
runner.addTest( ChessTest<Chess>::suite() );
bool wasSuccessful = runner.run();
return wasSuccessful ? 0 : 1;
}
开发者ID:Amazao2,项目名称:CPPUnitDemo,代码行数:12,代码来源:main.cpp
示例7: main
int main (int argc, char* argv[])
{
//wxLog::AddTraceMask (_T("wxGuiTestCallTrace"));
// Configure unit testing:
wxTst::WxGuiTestHelper::SetShowModalDialogsNonModalFlag (true);
wxTst::WxGuiTestHelper::SetShowPopupMenusFlag (false);
// Disable interactivity for really running automatic tests:
//wxTst::WxGuiTestHelper::SetDisableTestInteractivity (true);
// Likewise, prevent pop-up warning message box on failing assertions:
//wxTst::WxGuiTestHelper::SetPopupWarningForFailingAssert (false);
// But do check provoked warnings in testing mode:
wxTst::WxGuiTestHelper::SetCheckForProvokedWarnings (true);
// Which requires the correct CppUnit warning asserter:
wxTst::WxGuiTestHelper::SetWarningAsserter (
new wxTst::CppUnitWarningAsserter ());
// Record wxVtk interaction:
//wxTst::VtkWxGuiTestHelper::SetUseWxVtkInteractionRecording (true);
// Create AUT:
MyApp* myApp = new MyApp ();
// wxTst::InitWxGuiTest, which "packs" all registered wxWidgets GUI tests
// into decorated shape, must not use CPPUNIT_TEST_SUITE_REGISTRATION macro
// when WxGuiTesting is built as an independent and reusable library.
// Thus, in order to use the remaining standard infrastructure, we create a
// new test suite named equal to the usual top level registry or suite name
// "All Tests". Then all registered wxGui tests are added to it by means of
// directly using InitWxGuiTest class:
CPPUNIT_NS::TestSuite *suite = new CPPUNIT_NS::TestSuite ("All Tests");
suite->addTest (wxTst::InitWxGuiTest::suite ());
// Adds the test to the list of test to run
CPPUNIT_NS::TextUi::TestRunner runner;
runner.addTest (suite);
// Change the default outputter to a compiler error format outputter
runner.setOutputter (new CPPUNIT_NS::CompilerOutputter (&runner.result (),
OUTPUT));
// Run the test - don't close window in debug mode at the end
bool wasSucessful = runner.run ();
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
}
开发者ID:jralls,项目名称:wxGuiTesting,代码行数:47,代码来源:CppTextTestApp.cpp
示例8: main
int main(int argc, char* argv[])
{
// Get the top level suite from the registry
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
// Adds the test to the list of test to run
CPPUNIT_NS::TextUi::TestRunner runner;
runner.addTest( suite );
// Change the default outputter to a compiler error format outputter
runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(), std::cerr ) );
// Run the test.
bool wasSucessful = runner.run();
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
}
开发者ID:einon,项目名称:affymetrix-power-tools,代码行数:17,代码来源:test.cpp
示例9:
int
main(int argc, char** argv)
{
wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "program");
wxInitializer initializer;
if ( !initializer )
{
fprintf(stderr, "Failed to initialize the wxWidgets library, aborting.");
return -1;
}
// We are using .png files for some extra bitmaps.
wxImageHandler * pnghandler = new wxPNGHandler;
wxImage::AddHandler(pnghandler);
wxImage::AddHandler(new wxGIFHandler);
mutaborGUI::initMutIconShapes();
mutaborGUI::InitGUIRouteFactories();
#ifdef _GLIBCXX_DEBUG
std::clog << "In case of segmentation faults assure that cppunit is compiled using -D_GLIBCXX_DEBUG" << std::endl;
#endif
CPPUNIT_NS::TextUi::TestRunner runner;
CppUnit::BriefTestProgressListener listener;
runner.eventManager().addListener(&listener);
runner.addTest( MkIDlist::suite() );
bool wasSuccessful = runner.run();
return wasSuccessful ? 0 : 1;
}
开发者ID:BackupTheBerlios,项目名称:mutabor,代码行数:39,代码来源:main.cpp
示例10: _CppUnit_RunAllTests_ByName
EXPORTAPI _CppUnit_RunAllTests_ByName(
IN int argc,
IN WCHAR** wargv,
IN const std::string& strName)
{
USES_CONVERSION;
LPCWSTR pwszFileName = NULL;
if (wargv != NULL)
{
LPCWSTR pwszModule = CPPUNIT_NOFILTER_MODULE;
LPSTR pszTestClass = CPPUNIT_NOFILTER_TESTCLASS;
LPSTR pszTestMethod = CPPUNIT_NOFILTER_TESTMETHOD;
for (int i = 1; i < argc; ++i)
{
if (wargv[i][0] == '/' || wargv[i][0] == '-')
{
if (_wcsnicmp(wargv[i]+1, _g_outputsw, countof(_g_outputsw)) == 0)
{
pwszFileName = wargv[i] + (1 + countof(_g_outputsw)); // 测试结果文件
}
else if (_wcsnicmp(wargv[i]+1, _g_runsw, countof(_g_runsw)) == 0)
{
LPCWSTR pwszRunParam = wargv[i] + (1 + countof(_g_runsw));
pszTestClass = W2A(pwszRunParam);
pszTestMethod = strchr(pszTestClass, '.');
if (pszTestMethod)
*pszTestMethod++ = '\0';
}
}
}
if (_g_runtype == rununitNone)
{
pwszModule = _CppUnit_ModuleFilterName(wargv[0]);
}
_CppUnit_FilterCase(pwszModule, pszTestClass, pszTestMethod);
}
// 创建案例
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry(strName).makeTest();
CPPUNIT_NS::TextUi::TestRunner runner;
runner.addTest( suite );
CPPUNIT_NS::Outputter* outputter = NULL;
std::ofstream outfile;
if (pwszFileName)
outfile.open(W2A(pwszFileName), std::ios::out | std::ios::app);
if (outfile.is_open())
outputter = new CPPUNIT_NS::XmlOutputter(&runner.result(), outfile);
else
outputter = new CPPUNIT_NS::CompilerOutputter(&runner.result(), std::cerr);
runner.setOutputter(outputter);
try {
std::for_each(
_g_regProcs.begin(),
_g_regProcs.end(),
_RunInitializeProc());
}
catch (...) {
if (outfile.is_open()) {
outfile << "<Exception_In__RunInitializeProc/>" << std::endl;
}
else {
std::cerr << " Caught an exception in _RunInitializeProc()!" << std::endl;
}
return E_FAIL;
}
bool wasSucessful = runner.run();
try {
std::for_each(
_g_regProcs.rbegin(),
_g_regProcs.rend(),
_RunTerminateProc());
}
catch (...) {
if (outfile.is_open()) {
outfile << "<Exception_In__RunTerminateProc/>" << std::endl;
}
else {
std::cerr << " Caught an exception in _RunTerminateProc()!" << std::endl;
}
return E_FAIL;
}
return wasSucessful ? S_OK : E_FAIL;
}
开发者ID:LTears,项目名称:rktotal,代码行数:92,代码来源:run.cpp
注:本文中的cppunit_ns::textui::TestRunner类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论