Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

tester.cc

00001 #include <ostream.h>
00002 
00003 #include <cppunit/TestSuite.h>
00004 #include <cppunit/TestResult.h>
00005 #include <cppunit/extensions/HelperMacros.h>
00006 
00007 #include <CORE/Expr.h>
00008 
00009 #include <CGAL/basic.h>
00010 #include <CGAL/IO/Verbose_ostream.h>
00011 
00012 
00013 // Use verr.set_verbose(true) to enable this.
00014 CGAL::Verbose_ostream verr;
00015 
00016 
00017 
00018 namespace CppUnit {
00019 
00020     class Exception;
00021     class Test;
00022 
00023     class VerboseTestResult : public TestResult 
00024     {
00025     public:
00026         virtual void startTest     (Test *test) 
00027         {
00028             verr.set_verbose(false);
00029             //cerr << test->getName() << endl;
00030             TestResult::startTest( test );
00031         }
00032         virtual void addError      (Test *test, Exception *e) 
00033         {
00034             cerr << e->fileName() << ":"
00035                  << e->lineNumber() << ":"
00036                  << e->what() << "  *** ERROR ***" << endl;
00037             TestResult::addError( test, e );
00038         }
00039             
00040         virtual void addFailure    (Test *test, Exception *e) {
00041             cerr << e->fileName() << ":"
00042                  << e->lineNumber() << ":"
00043                  << e->what() << endl;
00044             TestResult::addFailure( test, e );
00045         }
00046 
00047         std::ostream& printSummary  (std::ostream& os) {
00048             return os << "  #test = " << runTests() 
00049                       << " #failed = " << testFailures()
00050                       << " #error = " << testErrors();
00051         }
00052     };
00053 
00054     ostream& operator<< ( ostream& os, VerboseTestResult& res ) {
00055         return res.printSummary(os);
00056     }
00057 
00058 }
00059 
00060 
00061 int main( int argc, char* argv[] )
00062 {
00063     CppUnit::Test* tp =
00064         CppUnit::TestFactoryRegistry::getRegistry().makeTest();
00065 
00066     CppUnit::VerboseTestResult result;
00067     tp->run( &result );
00068     cout << result << endl;
00069 
00070     return !result.wasSuccessful();
00071 }
00072 
00073 
00074 /* Hack workaround for NYU CORE library.  
00075    Without this, Expr values are output with a single digit of precision.
00076 */
00077 void switchon()
00078 {
00079     CORE::Expr e(3.3);
00080     e.approx();
00081 }

Generated on Fri Oct 26 23:38:13 2001 for bicobj-intersection by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001