Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

TestBase.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Test_TestBase_h
00002 #define Impala_Core_Test_TestBase_h
00003 
00004 #include <iostream>
00005 #include <string>
00006 #include <list>
00007 
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace Test
00013 {
00014 
00015 
00016 class TestBase
00017 {
00018 public:
00019     TestBase() : mResult(true), mNr(mCnt++)
00020     {
00021     }
00022 
00023     virtual
00024     ~TestBase()
00025     {
00026     }
00027 
00028     virtual void
00029     Run()
00030     {
00031     }
00032 
00033     virtual bool
00034     Result() const
00035     {
00036         return mResult;
00037     }
00038 
00039     virtual String
00040     Name() const
00041     {
00042         static String theName("empty test");
00043         return theName;
00044     }
00045 
00046     virtual void
00047     Report(std::ostream& os) const
00048     {
00049         std::list<String>::const_iterator slPtr;
00050         for (slPtr = mReport.begin(); slPtr != mReport.end(); slPtr++)
00051             os << "    " << *slPtr << std::endl;
00052     }
00053 
00054     int
00055     GetNr() const
00056     {
00057         return mNr;
00058     }
00059 
00060 protected:
00061 
00062     void
00063     SetFailure(String msg)
00064     {
00065         mResult = false;
00066         AddReport(msg);
00067     }
00068 
00069     void
00070     AddReport(String msg)
00071     {
00072         mReport.push_back(msg);
00073     }
00074 
00075 private:
00076 
00077     bool               mResult;
00078     std::list<String>  mReport;
00079     int                mNr;
00080     static int         mCnt;
00081 };
00082 
00083 int TestBase::mCnt = 1;
00084 
00085 } // namespace Test
00086 } // namespace Core
00087 } // namespace Impala
00088 
00089 #endif

Generated on Fri Mar 19 09:31:21 2010 for ImpalaSrc by  doxygen 1.5.1