本文整理汇总了C++中cppunit::textui::TestRunner::eventManager方法的典型用法代码示例。如果您正苦于以下问题:C++ TestRunner::eventManager方法的具体用法?C++ TestRunner::eventManager怎么用?C++ TestRunner::eventManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cppunit::textui::TestRunner
的用法示例。
在下文中一共展示了TestRunner::eventManager方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry("alltest");
ProgressListener listener;
runner.addTest(registry.makeTest());
runner.eventManager().addListener(&listener);
runner.run("", false, true, true);
return runner.result().testFailuresTotal() ? 1 : 0;
}
示例2: main
int main(){
CppUnit::TextUi::TestRunner runner;
runner.addTest(spIdxTest::suite());
runner.addTest(spBlasTest::suite());
runner.addTest(spIdxIOTest::suite());
CppUnit::BriefTestProgressListener listener;
runner.eventManager().addListener(&listener);
// Run all tests
runner.run();
return 0;
}
示例3: main
int main( int argc, char* argv[] )
{
std::string testPath = (argc > 1) ? std::string(argv[1]) : "";
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
// Outputs the name of each test when it is executed.
CppUnit::BriefTestProgressListener progress;
runner.eventManager().addListener( &progress );
runner.run();
}
示例4: main
int main(int argc, char **argv)
{
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
// Shows a message as each test starts
CppUnit::BriefTestProgressListener listener;
runner.eventManager().addListener(&listener);
bool wasSuccessful = runner.run("", false);
return !wasSuccessful;
}
示例5: main
int main( int argc, char **argv)
{
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) );
CppUnit::BriefTestProgressListener listener;
runner.eventManager().addListener(&listener);
return runner.run() ? 0 : 1;
}
示例6: main
int main(int argc, char **argv)
{
CppUnit::TestSuite *suite = new CppUnit::TestSuite("Test Suite");
CppUnit::TextUi::TestRunner runner;
suite->addTest(CppUnit::TestFactoryRegistry::getRegistry("tests").makeTest());
runner.addTest(suite);
OutputTestNameListener listener;
runner.eventManager().addListener(&listener);
bool success = runner.run();
return (success ? 0 : 1);
}
示例7: main
/**main function for CX unit tests.
* Perform system-wide init/deinit,
* run all registered tests.
*/
int main(int argc, char **argv)
{
QApplication app(argc, argv);
CppUnit::TextUi::TestRunner runner;
CppUnit::BriefTestProgressListener listener;
runner.eventManager().addListener( &listener );
#ifdef RUN_ALL_TESTS
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
#else
// runner.addTest( new CppUnit::TestCaller<cxTestSpeed>(
// "init",
// &cxTestSpeed::testKaisaSpeed ) );
//runner.addTest(TestVisualization::suite());
#endif
bool failed = runner.run();
return !failed;
}
示例8: main
/**main function for CX unit tests.
* Perform system-wide init/deinit,
* run all registered tests.
*/
int main(int argc, char **argv)
{
QApplication app(argc, argv);
CppUnit::TextUi::TestRunner runner;
CppUnit::BriefTestProgressListener listener;
runner.eventManager().addListener( &listener );
#ifdef RUN_ALL_TESTS
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
#else
runner.addTest( new CppUnit::TestCaller<cxTestExamples>(
"identity transform",
&cxTestExamples::testIdentityTransform ) );
runner.addTest(cxTestExamples::suite());
#endif
bool failed = runner.run();
return !failed;
}
示例9: run_cppunit
int run_cppunit(int argc, char **argv)
{
int ret = 1;
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactory ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
MyListener *listener = 0;
for (int i1 = 1; i1 < argc; ++i1)
if (strcmp (argv[1], "--show-name") == 0)
runner.eventManager().addListener(listener = new MyListener());
#ifndef __BORLANDC__ // @todo
for (int i2 = 1; i2 < argc; ++i2)
if (strcmp (argv[i2], "--compiler-output") == 0)
runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter(&runner.result(), MOCKPP_STD_NS::cerr ) );
#endif
ret = runner.run() ? 0 : 1;
delete listener;
return ret;
}
示例10: main
int main(int argc, char** argv)
{
// Commandline parameter is the test path to use
std::string test_path = (argc > 1) ? std::string(argv[1]) : "noninteractive";
// -------- CONFIGURE METRIC REGISTRY ------- //
CppUnit::MetricRegistry* metric_reg = CppUnit::MetricRegistry::instance();
std::string metric_prefix; // Prefix for all metric labels (mode/hostname)
std::string host_name = getHostname();
metric_prefix = host_name + "/";
#ifdef _DEBUG
metric_prefix += "Debug/";
#endif
#ifdef _OPT
metric_prefix += "Opt/";
#endif
std::cout << " host: " << host_name << " prefix: " << metric_prefix << std::endl;
metric_reg->setPrefix(metric_prefix);
metric_reg->setFilename("gmtl_metrics.txt");
metric_reg->setMetric("Main/MetricTest", 1221.75f);
// Print out what version of GMTL we're testing.
std::cout<<std::endl;
std::cout<<"GMTL Version: "<<gmtl::getVersion()<<std::endl;
std::cout<<std::endl;
//------------------------------------
// Test suites
//------------------------------------
CppUnit::TestFactoryRegistry& global_registry = CppUnit::TestFactoryRegistry::getRegistry();
// noninteractive
CppUnit::TestSuite* noninteractive_suite = new CppUnit::TestSuite("noninteractive");
noninteractive_suite->addTest(global_registry.makeTest());
// metric
CppUnit::TestSuite* metric_suite = new CppUnit::TestSuite(gmtlTest::Suites::metric());
metric_suite->addTest(CppUnit::TestFactoryRegistry::getRegistry(gmtlTest::Suites::metric()).makeTest());
//------------------------------------
// Test Runner
//------------------------------------
CppUnit::TextUi::TestRunner runner;
// Make it use a compiler outputter
CppUnit::Outputter* run_outputter =
CppUnit::CompilerOutputter::defaultOutputter(&runner.result(), std::cout);
runner.setOutputter(run_outputter);
// Add a listener that prints the test names as the tests progress
CppUnit::TestResult& result_event_manager = runner.eventManager();
CppUnit::BriefTestProgressListener progress;
result_event_manager.addListener(&progress);
runner.addTest(noninteractive_suite);
runner.addTest(metric_suite);
//------------------------------------
// Run Tests
//------------------------------------
bool success(false);
try
{
std::cout << "Running " << test_path << std::endl;
success = runner.run(test_path);
}
catch (std::invalid_argument& e)
{
// Test path was not resolved
std::cerr << std::endl
<< "ERROR: " << e.what()
<< std::endl;
success = false;
}
#ifdef WIN32
std::cin.get();
#endif
return (success ? 0 : 1);
}