예제 #1
0
int _tmain(int argc, _TCHAR* argv[])
{
	CppUnit::TextUi::TestRunner runner;

#ifdef _DEBUG
	std::ofstream outputFile("..\\output\\debug\\UnitTest_Results.xml");
#else
	std::ofstream outputFile("..\\output\\release\\UnitTest_Results.xml");
#endif

	CppUnit::Outputter *myoutputter;
	myoutputter = new CppUnit::XmlOutputter(&runner.result(), outputFile, "UTF-8");
	runner.setOutputter(myoutputter);

	CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry("UCUnitTest");
	runner.addTest( registry.makeTest() );

	runner.run();

	return 0;
}
예제 #2
0
int main(int argc, char* argv[])
{
// Get the top level suite from the registry
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();

CppUnit::TextUi::TestRunner runner;

//parse the SIMPLE soource code into the parser
//Parse();

//Call of DesignExtractor
//Extract();

runner.addTest(suite);
bool wasSucessful = runner.run();


//getchar();

return wasSucessful ? 0 : 1;
}
예제 #3
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;
} 
예제 #4
0
파일: UnitTest.cpp 프로젝트: khzaw/xcalibur
int main(int argc, char* argv[])
{
// Get the top level suite from the registry
//CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
	CppUnit::TestSuite *unitSuite = new CppUnit::TestSuite( "All unit test" );
	unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("VarTableTest").makeTest());	
	unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("ProcTableTest").makeTest());
	unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("ModifiesTest").makeTest());
	unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("UsesTest").makeTest());	
	CppUnit::TestFactoryRegistry::getRegistry().addTestToSuite(unitSuite);
	CppUnit::TextUi::TestRunner runner;


	runner.addTest(unitSuite);
	bool wasSucessful = runner.run();

//cin.get();
getchar();

return wasSucessful ? 0 : 1;
}
int 
main( int argc, char* argv[] )
{
  ProjetUnivers::Kernel::Parameters::load("display.config") ;
  ProjetUnivers::Kernel::Log::init() ;
  ProjetUnivers::Physic::start() ;
  
  // if command line contains "-selftest" then this is the post build check
  // => the output must be in the compiler error format.
  bool selfTest = (argc > 1)  &&  
                  (std::string("-selftest") == argv[1]);

  std::string test_name ;
  if (argc > 1)
    test_name = argv[1] ;

  CppUnit::TextUi::TestRunner runner;
  CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
  
  runner.addTest( registry.makeTest() );

  // Define the file that will store the XML output.
  std::ofstream outputFile("tests_display.xml");

  CppUnit::MultiOutputter* outputter = new CppUnit::MultiOutputter() ;
  outputter->add(new CppUnit::CompilerOutputter(&runner.result(),std::cerr,"test/%f:%l: ")) ;
  outputter->add(new ProjetUnivers::Kernel::XmlOutputter(&runner,outputFile,"Display")) ;
  runner.setOutputter(outputter);

  // Run the test.
  bool wasSucessful = runner.run(test_name);

  ProjetUnivers::Display::terminate() ;
  ProjetUnivers::Kernel::Log::close() ;


  // Return error code 1 if the one of test failed.
  return wasSucessful ? 0 : 1;
}
int main()
{
	CppUnit::TextUi::TestRunner runner;
	CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry();
	CppUnit::TestResult controller;
	CppUnit::TestResultCollector result;

	controller.addListener(&result);

	runner.addTest(registry.makeTest());

	std::ofstream xmlout("results.xml");
	CppUnit::XmlOutputter out(&result, xmlout);
	CppUnit::TextOutputter console(&result, std::cout);

	runner.run(controller, "");

	out.write();
	console.write();
	return result.wasSuccessful()? 0: 1;

}
예제 #7
0
int main(int argc, char* argv[]) {

	// Configure logging output
	brics_3d::Logger::setMinLoglevel(brics_3d::Logger::WARNING);

	/*see also: http://cppunit.sourceforge.net/doc/lastest/money_example.html#sec_running_test */
	// Get the top level suite from the registry
	CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

	// Adds the test to the list of test to run
	CppUnit::TextUi::TestRunner runner;
	runner.addTest(suite);

	// Check the set parameters.
	bool useXmlOutput = false;
	if (argc == 2) {
		std::string parameter = argv[1];
		if (parameter.compare("--report-xml") == 0) {
			useXmlOutput = true;
		}
	}

	// Decide which output format to take.
	std::ofstream outputStream;
	if (useXmlOutput) {
		// Change the default outputter to a XML outputter
		outputStream.open("unit_test_results.xml");
		runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), outputStream, std::string("ISO-8859-1")));
	} else {
		// Change the default outputter to a compiler error format outputter
		runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), std::cerr));
	}

	// Run the tests.
	bool wasSucessful = runner.run();

	// Return error code 1 if the one of test failed.
	return wasSucessful ? 0 : 1;
}
예제 #8
0
int main(int argc, char* argv[])
{
	/*
// Get the top level suite from the registry
CppUnit::TestSuite *unitSuite = new CppUnit::TestSuite( "All unit test" );
unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("VarTableTest").makeTest());	
unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("ParserTest").makeTest());
unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("QueryPreprocessorTest").makeTest());
unitSuite->addTest(CppUnit::TestFactoryRegistry::getRegistry("ProcTableTest").makeTest());	
CppUnit::TestFactoryRegistry::getRegistry().addTestToSuite(unitSuite);
CppUnit::TextUi::TestRunner runner;
*/
	CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
	CppUnit::TextUi::TestRunner runner;

runner.addTest(suite);
bool wasSucessful = runner.run();

//getchar();

return wasSucessful ? 0 : 1;
}
예제 #9
0
INITIALIZE_EASYLOGGINGPP


int main(int argc, const char * argv[])
{
  START_EASYLOGGINGPP(argc, argv);

  el::Configurations defaultConf;
  defaultConf.setToDefault();
  // Values are always std::string
  defaultConf.setGlobally(el::ConfigurationType::Format, "%datetime %level %fbase:%line %msg");
  // default logger uses default configurations
  el::Loggers::reconfigureLogger("default", defaultConf);

  el::Configurations performanceConf;
  performanceConf.setToDefault();
  performanceConf.set(el::Level::Info, el::ConfigurationType::Format, "%msg");
  performanceConf.set(el::Level::Info,el::ConfigurationType::Filename,"../performance.log"); /// TODO make output file include version number of this upcoming release
  //performanceConf.set(el::Level::Info,el::ConfigurationType::MillisecondsWidth,"6");
  el::Loggers::reconfigureLogger("performance", performanceConf);
  el::Loggers::addFlag(el::LoggingFlag::FixedTimeFormat); // ensures performance numbers are always quoted as seconds, never formatted

  LOG(INFO) << "In tests main";

  /// TODO delete performance.csv before running tests

  //CppUnit::TestResult controller;

  //CppUnit::TestResultCollector collector;
  //controller.addListener(&collector);

  //CppUnit::BriefTestProgressListener progress;
  //controller.addListener(&progress);

  CppUnit::TextUi::TestRunner runner;
  runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
  bool wasSuccessful = runner.run( "", false );
  return wasSuccessful;
}
예제 #10
0
int main(int argc, char* argv[])
{
  if (argc > 2 || (argc > 1 && !strcmp(argv[1], "--help")))
  {
    printf("Usage: RunTestBin [--help|test_to_run]\n");
    exit(0);
  }

#ifdef SHOW_MEMORY_BREAK
  void* initialbreak = sbrk(0);
#endif

  // Get the top level suite from the registry
  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

  // Adds the test to the list of test to run
  CppUnit::TextUi::TestRunner runner;
  runner.addTest( suite );

  // Change the default outputter to a compiler error format outputter
  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
                                                       std::cerr ) );
  // Run the tests.
  bool wasSucessful = runner.run(argc > 1 ? argv[1] : "");

#ifdef SHOW_MEMORY_BREAK
  void* finalbreak = sbrk(0);

  uint32_t deltabreak = ((uint32_t)finalbreak) - ((uint32_t)initialbreak);
  printf("Change in memory break = %u kB\n", deltabreak / 1024);
#ifdef USE_MEMORY_DEBUGGER
  printf("Memory allocated at exit: %u\n", total_allocated);
#endif
#endif

  // Return error code 1 if the one of test failed.
  return wasSucessful ? 0 : 1;
}
예제 #11
0
int main(int argc, char* argv[])
{
// Get the top level suite from the registry
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
CppUnit::TextUi::TestRunner runner;

//parse the SIMPLE soource code into the parser
//Parse();
string t;
Parser* parser;
PKBController* controller;

parser = new Parser("../Debug/Sample-Source.txt");
controller = parser->controller;

//string query = "assign a; Select a pattern a(\"oSCar\", \"1 + beta + tmp\" )";
string query = "assign a; Select a pattern a(\"oSCar\", \"_\" )";

QueryParser* qp = new QueryParser(query);
QueryEvaluator* qe = new QueryEvaluator(controller);

qp->getQueryTree()->printTree();
cout << qp->getQueryTree()->getRootNode()->getChild(2)->getKey() << endl;;
cin >> t;



//Call of DesignExtractor
//Extract();

runner.addTest(suite);
bool wasSucessful = runner.run();


//getchar();

return wasSucessful ? 0 : 1;
}
예제 #12
0
파일: tests.cpp 프로젝트: Loveice/FPsolve
int main(int argc, char* argv[])
{
#ifdef USE_GENEPI
  SemilinSetNdd::genepi_init();
#endif

  // Get the top level suite from the registry
  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

  // Adds the test to the list of test to run
  CppUnit::TextUi::TestRunner runner;
  runner.addTest( suite );

  // Change the default outputter to a compiler error format outputter
  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) );

  // Run the tests.
  bool wasSucessful = runner.run();

  //SemilinSetNdd::genepi_dealloc();
  // Return error code 1 if the one of test failed.
  return wasSucessful ? 0 : 1;
}
예제 #13
0
파일: test_main.cpp 프로젝트: zwj/statana
//#include "singleton_testcase.h"
//#include "../patterns/worker.h"
//using namespace improve;
int main( int argc, char* argv[] )
{
    
    {
       // singleton_testcase::instance();
        CppUnit::TextUi::TestRunner runner;
        CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
        runner.addTest( registry.makeTest() );
        runner.run();
       /* 
        exception_collector* collector_ptr=exception_collector::instance();
        for (int i=collector_ptr->size(); i>0 ; --i)
        {
            std::cout<<collector_ptr->top()<<std::endl;
            collector_ptr->pop();
            
        }
       */ 
    }
    
//    system("pause");
    return 0;
}
예제 #14
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;
}
예제 #15
0
파일: tests.cpp 프로젝트: jingcmu/fastcode
int 
main(int argc, char **argv) 
{
  CppUnit::TestResult controller;
  CppUnit::TestResultCollector result;
  CppUnit::TextUi::TestRunner runner;
  
  runner.addTest(cuda::Tests::suite());
  strcpy(cuda::Tests::filename, argv[2]);     
  if (argc == 3 && strcmp(argv[1], "-i") == 0) 
    {
      controller.addListener(&result);
      runner.run(controller);
      std::ofstream xmlFileOut("cuda_results.xml");
      CppUnit::XmlOutputter xmlOut(&result, xmlFileOut);
      xmlOut.write();
    }
  else if (argc == 4 && strcmp(argv[3], "-o") == 0) 
    runner.run();
  else
    std::cout<<"Usage "<<argv[0]<<" -i <test filename>\n -o";
  return 0;
}
예제 #16
0
int main (int argc, char *argv[])
{
    // set up logger
    log4cxx::BasicConfigurator::configure();

    // set up test runner
    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();

    if (argc == 1)
        registry.addRegistry("unit");
    else
    {
        // run just the specified tests
        for (int i=1; i<argc; i++)
            registry.addRegistry(argv[i]);
    }

    runner.addTest(registry.makeTest());
    if (runner.run())
        return 0;
    return 1;
}
예제 #17
0
int main(int argc, char** argv)
{
    // Get the top level suite from the registry
    CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

    // Adds the test to the list of test to run
    CppUnit::TextUi::TestRunner runner;
    runner.addTest( suite );
#ifndef TESTNAME
    std::ofstream outputFile(std::string(suite->getName()+"-result.xml").c_str());
#else
    std::ofstream outputFile((std::string(TESTNAME)+std::string("-result.xml")).c_str());
#endif
    // Change the default outputter to a compiler error format outputter
    runner.setOutputter( new CppUnit::XmlOutputter( &runner.result(),outputFile ) );
    
    // Run the tests.
    bool wasSucessful = runner.run();

    outputFile.close();
    // Return error code 1 if the one of test failed.
    return wasSucessful ? 0 : 1;
}
예제 #18
0
int main(int argc, char* argv[]) {
  std::cout << "Attention! All wheels of the youBot will move during the test. \nThe youBot should NOT stand on the ground and the wheels should be in the air! \nAlso the arm will move please be carefull!" << std::endl;
  char input = 0;

  while (input != 'y' && input != 'n') {
    std::cout << "Are all wheels off the ground? [n/y]" << std::endl;
    input = getchar();
    if (input == 'n') {
      return 0;
    }
  }
  Logger::logginLevel = trace;
  
  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
  CppUnit::TextUi::TestRunner runner;
  runner.addTest( suite );
  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) );
  /** let the test run */
  bool wasSucessful = runner.run();
  
  /** check whether it was sucessfull or not */
  return wasSucessful ? 0 : 1;
}
예제 #19
0
int _tmain(int argc, _TCHAR* argv[])
{
	std::ofstream o("cadcommontestresult.xml");
	try
	{
		// Get the top level suite from the registry
		CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

		// Adds the test to the list of test to run
		CppUnit::TextUi::TestRunner runner;
		runner.addTest( suite );

		// Change the default outputter to a compiler error format outputter
		/*runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
															std::cerr ) );*/

		runner.setOutputter( new CppUnit::XmlOutputter( &runner.result(),
															o ) );

		// Run the tests.
		bool wasSucessful = runner.run();


		o.close();

		// Return error code 1 if the one of test failed.
		return wasSucessful ? 0 : -11;


	}
	//catch ( isis::application_exception& ex )
	catch ( isis::application_exception &)
	{
		o.close();
		return -1;
	}
} 
int	main(int argc, char *argv[]) {
	// install the segmentation fault handler
	signal(SIGSEGV, stderr_stacktrace);

	CppUnit::TextUi::TestRunner	runner;
	CppUnit::TestFactoryRegistry	&registry
		= CppUnit::TestFactoryRegistry::getRegistry();
	int	c;
	debugtimeprecision = 3;
	debugthreads = 1;
	while (EOF != (c = getopt(argc, argv, "d")))
		switch (c) {
		case 'd':
			debuglevel = LOG_DEBUG;
			break;
		}

	// perform the tests
	runner.addTest(registry.makeTest());

	// decide what return code to return
	bool	wasSuccessful = runner.run("", false);
	return (wasSuccessful) ? EXIT_SUCCESS : EXIT_FAILURE;
}
예제 #21
0
int main(int argc, char* argv[])
{
  // Get the top level suite from the registry
  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

  // Adds the test to the list of test to run
  CppUnit::TextUi::TestRunner runner;
  runner.addTest( suite );

  std::fstream outfile;
  outfile.open("testresult.xml",std::fstream::out);

  // Change the default outputter to a compiler error format outputter
  runner.setOutputter( new CppUnit::XmlOutputter( &runner.result(), outfile));

  //runner.setOutputter(new CppUnit::CompilerOutputter( &runner.result(),
  //                                                    std::cerr ));

  // Run the tests.
  bool wasSucessful = runner.run();

  // Return error code 1 if the one of test failed.
  return wasSucessful ? 0 : 1;
}
예제 #22
0
int main ( int argc, char * argv[] )
{
    CppUnit::Test * suite
        = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    CppUnit::TextUi::TestRunner runner;
    runner.addTest( suite );
    tape::Error error;

    CreateLogger("/tmp/bdt-test");
    bdt::Factory::ResetSchedule(new ScheduleNone());
    bdt::Factory::CreateConfigure();
    bdt::Factory::GetConfigure()->Refresh("./bdt.config");

    runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
                         std::cerr ) );
    bool ret = runner.run();

    Factory::ReleaseCacheManager();
    Factory::ReleaseTapeManager();
    Factory::ReleaseTapeLibraryManager();
    Factory::ReleaseMetaManager();

    return ret ? 0 : 1;
}
예제 #23
0
파일: main.cpp 프로젝트: MoLAoS/Mandate
int main(int argc, char **argv) {
	CppUnit::TextUi::TestRunner tester;

	tester.addTest(ReverseRectIteratorTest::suite());
	//tester.addTest(NodePoolTest::suite());
	tester.addTest(InfluenceMapTest::suite());
	tester.addTest(CircularBufferTest::suite());
	tester.addTest(FixedPointTest::suite());
//	tester.addTest(ChecksumTest::suite());
	tester.addTest(MinHeapTest::suite());
	tester.addTest(LineAlgorithmTest::suite());

	bool res = tester.run();

#ifdef WIN32
	char line[256];
	std::cout << "[Enter] to exit.";
	std::cin.getline(line,256);
#endif
	return (res)? 0: 1;  // for ctest
}
예제 #24
0
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);
}
예제 #25
0
int main() {
    CppUnit::TextUi::TestRunner runner;
    runner.addTest(ExampleClassTest::suite());
    runner.run();
}
예제 #26
0
void addNBitmask(CppUnit::TextUi::TestRunner& runner) {
    runner.addTest(NBitmaskTest::suite());
}
예제 #27
0
int main(int argc, char** argv) {
    CppUnit::TextUi::TestRunner runner;
    runner.addTest(PhysfsTest::suite());
    return runner.run() ? 0 : 1;
}
int main(int argc, char* argv[])
{

  FORMAT format = TEXT_OUT;
  int target = 0;
  std::string xsl;
  std::string ns;
  std::string fname;
  std::ofstream ofs;

  int i(1);
  while (i < argc)
    {
      std::string arg(argv[i]);
      std::string next_arg;
      if (i + 1 < argc) next_arg = argv[i + 1];
      else              next_arg = "";

      if (arg == "--text") { format = TEXT_OUT; break; }
      if (arg == "--xml")
	{
	  if (next_arg == "")
	    {
	      fname = argv[0];
	      fname += ".xml";
	    }
	  else
	    {
	      fname = next_arg;
	    }
	  format = XML_OUT;
	  ofs.open(fname.c_str());
	}
      if ( arg == "--compiler"  ) { format = COMPILER_OUT; break; }
      if ( arg == "--cerr"      ) { target = 1; break; }
      if ( arg == "--xsl"       )
	{
	  if (next_arg == "") xsl = "default.xsl"; 
	  else                xsl = next_arg;
	}
      if ( arg == "--namespace" )
	{
	  if (next_arg == "")
	    {
	      std::cerr << "no namespace specified" << std::endl;
	      exit(1); 
	    }
	  else
	    {
	      xsl = next_arg;
	    }
	}
      ++i;
    }
  CppUnit::TextUi::TestRunner runner;
  if ( ns.empty() )
    runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
  else
    runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
  CppUnit::Outputter* outputter = 0;
  std::ostream* stream = target ? &std::cerr : &std::cout;
  switch ( format )
    {
    case TEXT_OUT :
      outputter = new CppUnit::TextOutputter(&runner.result(),*stream);
      break;
    case XML_OUT :
      std::cout << "XML_OUT" << std::endl;
      outputter = new CppUnit::XmlOutputter(&runner.result(),
					    ofs, "shift_jis");
      static_cast<CppUnit::XmlOutputter*>(outputter)->setStyleSheet(xsl);
      break;
    case COMPILER_OUT :
      outputter = new CppUnit::CompilerOutputter(&runner.result(),*stream);
      break;
    }
  runner.setOutputter(outputter);
  runner.run();
  return 0; // runner.run() ? 0 : 1;
}
예제 #29
0
int main (int argc, char **argv) {
    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
    runner.addTest( registry.makeTest() );
    return !runner.run( "" );
}
예제 #30
0
void addNCensus(CppUnit::TextUi::TestRunner& runner) {
    runner.addTest(NCensusTest::suite());
}