- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/svn-release/Smi-0.93.1/FlopCpp/unittest/TestItem.hpp

Go to the documentation of this file.

    00001 #ifndef _TESTITEM_HPP_
    00002 #define _TESTITEM_HPP_
    00003
    00004 #include <string>
    00005 #include <stdlib.h>
    00006 #include <ostream>
    00007
    00008 class TestBed;
    00009
    00010 #define __SPOT__ __FILE__,__LINE__
    00011
    00012 class TestItem {
    00013     static TestBed *theBed;
    00014     char *name;
    00015     bool success;
    00016     bool isSet;
    00017     char *fileName;
    00018     int lineNumber;
    00019     int compare(const TestItem &otherItem)const;
    00020 public:
    00021     static void setBed(TestBed *aBed){theBed=aBed;}
    00022     TestItem(const char *itemName);
    00023     ~TestItem();
    00024
    00025     void passItem(){if(!isSet) success=true;isSet=true;}
    00026
    00027     void failItem(const char *_fileName,
    00028                   const int lineNum);
    00029
    00030     void expectNonZero(const char *_fileName,
    00031                        const int lineNum,
    00032                        const int val);
    00033
    00034     void expectFalse(const char *_fileName,
    00035                      const int lineNum,
    00036                      const bool val);
    00037
    00038     void expectTrue(const char *_fileName,
    00039                     const int lineNum,
    00040                     const bool val);
    00041
    00042     void expectZero(const char *_fileName,
    00043                     const int lineNum,
    00044                     const int val);
    00045
    00046     void sameString(const char *fileName, const int lineNum,
    00047                     const char *string1,const char *string2);
    00048
    00049     bool passed(){ return success; }
    00050
    00051     friend std::ostream &operator<<(std::ostream &os, const TestItem &item);
    00052
    00053     friend bool operator<(const TestItem &item1, const TestItem &item2);
    00054     friend bool operator>(const TestItem &item1, const TestItem &item2);
    00055     friend bool operator<=(const TestItem &item1, const TestItem &item2);
    00056     friend bool operator>=(const TestItem &item1, const TestItem &item2);
    00057     friend bool operator==(const TestItem &item1, const TestItem &item2);
    00058     friend bool operator!=(const TestItem &item1, const TestItem &item2);
    00059 };
    00060 #endif