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

TestSuiteFormatterDoxygen.cc

Go to the documentation of this file.
00001 /* -*-Mode:C++ -*- */
00002 
00003 #include "TestSuiteFormatterDoxygen.hh"
00004 #include "UnitTest.hh"
00005 #include "TestSuite.hh"
00006 
00007 #include <iostream>
00008 
00009 namespace ccunit
00010 {
00011 
00012   TestSuiteFormatterDoxygen::~TestSuiteFormatterDoxygen()
00013   {
00014   }
00015 
00016   void
00017   TestSuiteFormatterDoxygen::header(ostream &ostr, const TestSuite &suite) const
00018   {
00019     ostr << "/* AUTOMATICALLY GENERATED FILE -- DO NOT EDIT */\n";
00020 
00021     ostr << "/** \\page test_results Test Results\n"
00022          << "\n"
00023          << "Results for running the unit test in suite \""
00024          << suite.getName()
00025          << "\"\n"
00026          << endl;
00027   }
00028 
00029   void
00030   TestSuiteFormatterDoxygen::footer(ostream &ostr, const TestSuite &suite) const
00031   {
00032     ostr << "*/\n";
00033   }
00034 
00035   void
00036   TestSuiteFormatterDoxygen::printFailure(ostream &ostr, const TestComponent::ErrorReport &error_report) const
00037   {
00038     ostr << error_report;
00039   }
00040 
00041   class printER
00042   {
00043   public:
00044     printER(ostream &ostr) : _M_stream(&ostr) {}
00045 
00046     void operator()(const TestComponent::ErrorReport &er) {
00047       *_M_stream << "<li>" << er << "\n";
00048     }
00049 
00050   private:
00051     ostream* _M_stream;
00052   };
00053 
00054   void
00055   TestSuiteFormatterDoxygen::printComponent(ostream &ostr, TestComponentPtr &comp) const
00056   {
00057     //  ostr << comp << '\n';
00058     comp->checkRun();
00059 
00060     ostr << "\\section test_" << comp->getName()
00061          << " Unit Test \"" << comp->getName() << "\"\n"
00062          << "\n"
00063          << "Passed: " << comp->getNumPassed()
00064          << "<br>\n";
00065 
00066     if ((comp->getFailures()).empty()) {
00067       assert(comp->getNumFailed() == 0);
00068       ostr << "Failed: " << comp->getNumFailed();
00069     } else {
00070       ostr << "<strong><em>Failed: " << comp->getNumFailed()
00071            << "</em></strong>\n";
00072 
00073       ostr << "<ul>\n";
00074 
00075 //      copy((comp->getFailures()).begin(),
00076 //         (comp->getFailures()).end(),
00077 //         ostream_iterator<TestComponent::ErrorReport>(ostr, "\n"));
00078 
00079       for_each((comp->getFailures()).begin(),
00080                (comp->getFailures()).end(),
00081                printER(ostr));
00082 
00083       ostr << "</ul>\n";
00084     }
00085 
00086     ostr << '\n';
00087 
00088   }
00089 
00090 }

Generated on Tue Apr 2 15:33:23 2002 for libccunit by doxygen 1.2.14 written by Dimitri van Heesch, © 1997-2002

Project hosted on sourceforge SourceForge Logo