Files
@ 2626035bc26c
Branch filter:
Location: libtransport.git/src/tests/main.cpp - annotation
2626035bc26c
1.4 KiB
text/x-c++hdr
Disconnect if ping is not received for 30 seconds
a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 75bc454c85c2 75bc454c85c2 75bc454c85c2 75bc454c85c2 75bc454c85c2 75bc454c85c2 75bc454c85c2 a00d7859f663 a00d7859f663 a00d7859f663 75bc454c85c2 75bc454c85c2 75bc454c85c2 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 a00d7859f663 | #include "main.h"
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include <cppunit/BriefTestProgressListener.h>
#include "log4cxx/logger.h"
#include "log4cxx/fileappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
using namespace log4cxx;
int main (int argc, char* argv[])
{
LoggerPtr root = Logger::getRootLogger();
root->addAppender(new FileAppender(new PatternLayout("%d %-5p %c: %m%n"), "libtransport_test.log", false));
// informs test-listener about testresults
CPPUNIT_NS :: TestResult testresult;
// register listener for collecting the test-results
CPPUNIT_NS :: TestResultCollector collectedresults;
testresult.addListener (&collectedresults);
// register listener for per-test progress output
CPPUNIT_NS :: BriefTestProgressListener progress;
testresult.addListener (&progress);
// insert test-suite at test-runner by registry
CPPUNIT_NS :: TestRunner testrunner;
testrunner.addTest (CPPUNIT_NS :: TestFactoryRegistry :: getRegistry ().makeTest ());
testrunner.run (testresult);
// output results in compiler-format
CPPUNIT_NS :: CompilerOutputter compileroutputter (&collectedresults, std::cerr);
compileroutputter.write ();
// return 0 if tests were successful
return collectedresults.wasSuccessful () ? 0 : 1;
}
|