Beispiel #1
0
int main(int argc, char **argv) {
    if (argc != 2) {
        cerr << "ERROR: Path to unit test folder is not given!" << endl;
        cerr << "Exit the unit test!" << endl;
        exit(EXIT_FAILURE);
    } else {
        pathToFolderOfFiles = argv[1];
        pathToFolderOfFiles.append("/files/");
    }
    std::ofstream file("unitTestResult.xml");
    EMPIRE::Message::userSetOutputLevel = EMPIRE::Message::DEBUG; // may output some data for checking

    // 1. add registered tests to testRunner
    CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
    CppUnit::TextUi::TestRunner runner;
    runner.addTest(registry.makeTest());

    // 2. set listener which outputs the progress to shell
    EMPIRE::ProgressOutputter testProgressOutputter;
    runner.eventManager().addListener(&testProgressOutputter);

    // 3. run
    runner.run();

    // 4. output to xml file
    CppUnit::XmlOutputter xmlOutputter(&runner.result(), file);
    xmlOutputter.write();

    return 0;
}
Beispiel #2
0
int main(void)
{
   CppUnit::TextUi::TestRunner runner;
   CppUnit::TestFactoryRegistry &registry = 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;
}
Beispiel #3
0
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;
}
Beispiel #4
0
int main( int argc, char* argv[] )
{
  std::string testPath = (argc > 1) ? std::string(argv[1]) : "";
  CppUnit::TextUi::TestRunner runner;
  CppUnit::TestFactoryRegistry &registry = 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();
}
Beispiel #5
0
int main(int argc, char **argv)
{
	CppUnit::TextUi::TestRunner runner;
	CppUnit::TestFactoryRegistry &registry = 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;
}
Beispiel #6
0
int main( int argc, char **argv)
{
    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestFactoryRegistry &registry = 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;
}
Beispiel #7
0
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);
}
Beispiel #8
0
VOID CTestRunner::StartTest(XMessage_StartTest* msg)
{
    CppUnit::TestResult    controller;
    CppUnit::TestResultCollector result;

    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
    runner.addTest( registry.makeTest() );
    runner.eventManager().addListener( &result );
    runner.run();
 
    std::ofstream xmlFileOut("cpptestresults.xml");
    CppUnit::XmlOutputter xmlOut(&result, xmlFileOut);
    xmlOut.write();
}
Beispiel #9
0
/**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 &registry = 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;
} 
Beispiel #10
0
/**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 &registry = 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;
} 
Beispiel #11
0
int run_cppunit(int argc, char **argv)
{
  int ret = 1;
  CppUnit::TextUi::TestRunner runner;
  CppUnit::TestFactory &registry = 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;
}
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);
}