/* * Copyright (C) 1996-2017 The Squid Software Foundation and contributors * * Squid software is distributed under GPLv2+ license and includes * contributions from numerous individuals and organizations. * Please see the COPYING and CONTRIBUTORS files for details. */ #ifndef SQUID_INCLUDE_UNITTESTMAIN_H #define SQUID_INCLUDE_UNITTESTMAIN_H #include #include #include #include #include #include #include int main( int argc, char* argv[] ) { // Create the event manager and test controller CPPUNIT_NS::TestResult controller; // Add a listener that colllects test result CPPUNIT_NS::TestResultCollector result; controller.addListener( &result ); // Add a listener that print dots as test run. // use BriefTestProgressListener to get names of each test // even when they pass. // CPPUNIT_NS::BriefTestProgressListener progress; CPPUNIT_NS::TextTestProgressListener progress; controller.addListener( &progress ); // Add the top suite to the test runner CPPUNIT_NS::TestRunner runner; runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() ); runner.run( controller ); // Print test in a compiler compatible format. CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr ); outputter.write(); return result.wasSuccessful() ? 0 : 1; } #endif /* SQUID_INCLUDE_UNITTESTMAIN_H */