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

TestSuiteFormatter.cc

Go to the documentation of this file.
00001 /* -*-Mode:C++ -*- */
00002 
00003 #include "TestSuiteFormatter.hh"
00004 #include "UnitTest.hh"
00005 #include "TestSuite.hh"
00006 
00007 #include <iostream>
00008 
00009 namespace ccunit
00010 {
00011 
00012   TestSuiteFormatter::~TestSuiteFormatter()
00013   {
00014   }
00015 
00016   void
00017   TestSuiteFormatter::header(ostream &ostr, const TestSuite &suite) const
00018   {
00019     ostr << "Suite \"" << suite.getName() << "\"\n=======";
00020   
00021     // Make the formating pretty....
00022     size_t i = suite.getName().size();
00023     string sep(i+1, '=');
00024 
00025     ostr << sep << '\n';
00026   }
00027 
00028   void
00029   TestSuiteFormatter::footer(ostream &ostr, const TestSuite &suite) const
00030   {
00031     ostr << "=======";
00032     // Make the formating pretty....
00033     size_t i = suite.getName().size();
00034     string sep(i+1, '=');
00035 
00036     ostr << sep << '\n';
00037   }
00038 
00039   void
00040   TestSuiteFormatter::printFailure(ostream &ostr, const TestComponent::ErrorReport &error_report) const
00041   {
00042     ostr << error_report;
00043   }
00044 
00045   void
00046   TestSuiteFormatter::printComponent(ostream &ostr, TestComponentPtr &comp) const
00047   {
00048     //  ostr << comp << '\n';
00049     comp->checkRun();
00050 
00051     if (! (comp->getFailures()).empty()) {
00052       ostr << "The following tests failed: \n";
00053       copy((comp->getFailures()).begin(),
00054            (comp->getFailures()).end(),
00055            ostream_iterator<TestComponent::ErrorReport>(ostr, "\n"));
00056     }
00057 
00058     ostr << "UnitTest \"" 
00059          << comp->getName() << "\":\n"
00060          << "\tPassed: " << comp->getNumPassed()
00061          << "\tFailed: " << comp->getNumFailed()
00062          << '\n';
00063   }
00064 }

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