~ubuntu-branches/ubuntu/oneiric/squid3/oneiric-security

« back to all changes in this revision

Viewing changes to lib/cppunit-1.10.0/examples/cppunittest/CppUnitTestMain.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2007-05-13 16:03:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070513160316-2h6kn6h1z0q1fvyo
Tags: 3.0.PRE6-1
* New upstream release
  - Removed patches integrated upsteam:
    + 04-m68k-ftbfs

* debian/rules
  - Enable delay pools (Closes: #410785)
  - Enable cache digests (Closes: #416631)
  - Enable ICAP client
  - Raised Max Filedescriptor limit to 65536

* debian/control
  - Added real package dependency for httpd in squid3-cgi

* debian/patches/02-makefile-defaults
  - Fix default configuration file for cachemgr.cgi (Closes: #416630)

* debian/squid3.postinst
  - Fixed bashish in postinst (Closes: #411797)

* debian/patches/05-helpers-typo
  - Added upstream patch fixing compilation error in src/helpers.cc

* debian/patches/06-mem-obj-reference
  - Added upstream patch fixing a mem_obj reference in src/store.cc

* debian/patches/07-close-icap-connections
  - Added upstream patch fixing icap connection starvation

* debian/squid3.rc
  - Added LSB-compliant description to rc script

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <cppunit/CompilerOutputter.h>
2
 
#include <cppunit/TestResult.h>
3
 
#include <cppunit/TestResultCollector.h>
4
 
#include <cppunit/TestRunner.h>
5
 
#include <cppunit/TextTestProgressListener.h>
6
 
#include <cppunit/BriefTestProgressListener.h>
7
 
#include <cppunit/XmlOutputter.h>
8
 
#include <cppunit/extensions/TestFactoryRegistry.h>
9
 
#include <stdexcept>
10
 
#include <fstream>
11
 
 
12
 
 
13
 
int 
14
 
main( int argc, char* argv[] )
15
 
{
16
 
  // Retreive test path from command line first argument. Default to "" which resolve
17
 
  // to the top level suite.
18
 
  std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string("");
19
 
 
20
 
  // Create the event manager and test controller
21
 
  CPPUNIT_NS::TestResult controller;
22
 
 
23
 
  // Add a listener that colllects test result
24
 
  CPPUNIT_NS::TestResultCollector result;
25
 
  controller.addListener( &result );        
26
 
 
27
 
  // Add a listener that print dots as test run.
28
 
#ifdef WIN32
29
 
  CPPUNIT_NS::TextTestProgressListener progress;
30
 
#else
31
 
  CPPUNIT_NS::BriefTestProgressListener progress;
32
 
#endif
33
 
  controller.addListener( &progress );      
34
 
 
35
 
  // Add the top suite to the test runner
36
 
  CPPUNIT_NS::TestRunner runner;
37
 
  runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );   
38
 
  try
39
 
  {
40
 
    std::cout << "Running "  <<  testPath;
41
 
    runner.run( controller, testPath );
42
 
 
43
 
    std::cerr << std::endl;
44
 
 
45
 
    // Print test in a compiler compatible format.
46
 
    CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
47
 
    outputter.write(); 
48
 
 
49
 
// Uncomment this for XML output
50
 
//    std::ofstream file( "tests.xml" );
51
 
//    CPPUNIT_NS::XmlOutputter xml( &result, file );
52
 
//    xml.setStyleSheet( "report.xsl" );
53
 
//    xml.write();
54
 
//    file.close();
55
 
  }
56
 
  catch ( std::invalid_argument &e )  // Test path not resolved
57
 
  {
58
 
    std::cerr  <<  std::endl  
59
 
               <<  "ERROR: "  <<  e.what()
60
 
               << std::endl;
61
 
    return 0;
62
 
  }
63
 
 
64
 
  return result.wasSuccessful() ? 0 : 1;
65
 
}
66