home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / ieeetest / ieeetest.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  2.5 KB  |  108 lines

  1. /*
  2. *******************************************************************************
  3. *                                                                             *
  4. * COPYRIGHT:                                                                  *
  5. *   (C) Copyright International Business Machines Corporation,  1998          *
  6. *   Licensed Material - Program-Property of IBM - All Rights Reserved.        *
  7. *   US Government Users Restricted Rights - Use, duplication, or disclosure   *
  8. *   restricted by GSA ADP Schedule Contract with IBM Corp.                    *
  9. *                                                                             *
  10. *******************************************************************************
  11. *
  12. * File ieeetest.h
  13. *
  14. * Modification History:
  15. *
  16. *   Date        Name        Description
  17. *   08/21/98    stephen        Creation.
  18. *******************************************************************************
  19. */
  20.  
  21. #ifndef _IEEETEST
  22. #define _IEEETEST
  23.  
  24. int main(int argc, char **argv);
  25. void usage(const char *execName);
  26.  
  27. // Very simple class for testing IEEE compliance
  28. class IEEETest 
  29. {
  30.  public:
  31.   
  32.   // additive constants for flags
  33.   enum EModeFlags {
  34.     kNone        = 0x00,
  35.     kVerboseMode    = 0x01
  36.   };
  37.   
  38.   
  39.   IEEETest(int flags = kNone);
  40.   ~IEEETest();
  41.   
  42.   // method returns the number of errors
  43.   int            run();
  44.   
  45.  private:
  46.   // utility function for running a test function
  47.   int            runTest(const char *testName, 
  48.                 int (IEEETest::*testFunc)(void));
  49.   
  50.   // the actual tests; methods return the number of errors
  51.   int            testNaN();
  52.   int            testPositiveInfinity();
  53.   int            testNegativeInfinity();
  54.   int            testZero();
  55.   
  56.   // subtests of testNaN
  57.   int            testIsNaN();
  58.   int            NaNGT();
  59.   int            NaNLT();
  60.   int            NaNGTE();
  61.   int            NaNLTE();
  62.   int            NaNE();
  63.   int            NaNNE();
  64.   
  65.   
  66.   // logging utilities
  67.   int            getTestLevel()         const;
  68.   void            increaseTestLevel();
  69.   void            decreaseTestLevel();
  70.   
  71.   IEEETest&        log(char c);
  72.   IEEETest&        log(const char *s);
  73.   IEEETest&        log(int i);
  74.   IEEETest&        log(long l);
  75.   IEEETest&        log(double d);
  76.   IEEETest&        logln();
  77.   
  78.   IEEETest&        err(char c);
  79.   IEEETest&        err(const char *s);
  80.   IEEETest&        err(int i);
  81.   IEEETest&        err(long l);
  82.   IEEETest&        err(double d);
  83.   IEEETest&        errln();
  84.   
  85.   // data members
  86.   int            mFlags;            // flags - only verbose for now
  87.   int            mTestLevel;        // indent level
  88.   
  89.   short            mNeedLogIndent;
  90.   short            mNeedErrIndent;
  91. };
  92.  
  93. inline int
  94. IEEETest::getTestLevel() const
  95. { return mTestLevel; }
  96.  
  97. inline void
  98. IEEETest::increaseTestLevel()
  99. { mTestLevel++; }
  100.  
  101. inline void
  102. IEEETest::decreaseTestLevel()
  103. { mTestLevel--; }
  104.  
  105. #endif
  106.  
  107. //eof
  108.