1999-08-16 21:50:52 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
2000-01-15 02:00:06 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 1998-2000, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*
|
1999-08-16 21:50:52 +00:00
|
|
|
*******************************************************************************
|
|
|
|
*
|
|
|
|
* File ieeetest.h
|
|
|
|
*
|
|
|
|
* Modification History:
|
|
|
|
*
|
|
|
|
* Date Name Description
|
2002-04-02 02:55:31 +00:00
|
|
|
* 08/21/98 stephen Creation.
|
1999-08-16 21:50:52 +00:00
|
|
|
*******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _IEEETEST
|
|
|
|
#define _IEEETEST
|
|
|
|
|
|
|
|
void usage(const char *execName);
|
|
|
|
|
|
|
|
// Very simple class for testing IEEE compliance
|
|
|
|
class IEEETest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
// additive constants for flags
|
|
|
|
enum EModeFlags {
|
2002-04-02 02:55:31 +00:00
|
|
|
kNone = 0x00,
|
|
|
|
kVerboseMode = 0x01
|
1999-08-16 21:50:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
IEEETest(int flags = kNone);
|
|
|
|
~IEEETest();
|
|
|
|
|
|
|
|
// method returns the number of errors
|
2002-04-02 02:55:31 +00:00
|
|
|
int run(void);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// utility function for running a test function
|
2002-04-02 02:55:31 +00:00
|
|
|
int runTest(const char *testName,
|
|
|
|
int (IEEETest::*testFunc)(void));
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// the actual tests; methods return the number of errors
|
2002-04-02 02:55:31 +00:00
|
|
|
int testNaN(void);
|
|
|
|
int testPositiveInfinity(void);
|
|
|
|
int testNegativeInfinity(void);
|
|
|
|
int testZero(void);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// subtests of testNaN
|
2002-04-02 02:55:31 +00:00
|
|
|
int testIsNaN(void);
|
|
|
|
int NaNGT(void);
|
|
|
|
int NaNLT(void);
|
|
|
|
int NaNGTE(void);
|
|
|
|
int NaNLTE(void);
|
|
|
|
int NaNE(void);
|
|
|
|
int NaNNE(void);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
// logging utilities
|
2002-04-02 02:55:31 +00:00
|
|
|
int getTestLevel(void) const;
|
|
|
|
void increaseTestLevel(void);
|
|
|
|
void decreaseTestLevel(void);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2002-04-02 02:55:31 +00:00
|
|
|
IEEETest& log(char c);
|
|
|
|
IEEETest& log(const char *s);
|
|
|
|
IEEETest& log(int i);
|
|
|
|
IEEETest& log(long l);
|
|
|
|
IEEETest& log(double d);
|
|
|
|
IEEETest& logln(void);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2002-04-02 02:55:31 +00:00
|
|
|
IEEETest& err(char c);
|
|
|
|
IEEETest& err(const char *s);
|
|
|
|
IEEETest& err(int i);
|
|
|
|
IEEETest& err(long l);
|
|
|
|
IEEETest& err(double d);
|
|
|
|
IEEETest& errln(void);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// data members
|
2002-04-02 02:55:31 +00:00
|
|
|
int mFlags; // flags - only verbose for now
|
|
|
|
int mTestLevel; // indent level
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2002-04-02 02:55:31 +00:00
|
|
|
short mNeedLogIndent;
|
|
|
|
short mNeedErrIndent;
|
1999-08-16 21:50:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
inline int
|
1999-12-22 22:57:04 +00:00
|
|
|
IEEETest::getTestLevel(void) const
|
1999-08-16 21:50:52 +00:00
|
|
|
{ return mTestLevel; }
|
|
|
|
|
|
|
|
inline void
|
1999-12-22 22:57:04 +00:00
|
|
|
IEEETest::increaseTestLevel(void)
|
1999-08-16 21:50:52 +00:00
|
|
|
{ mTestLevel++; }
|
|
|
|
|
|
|
|
inline void
|
1999-12-22 22:57:04 +00:00
|
|
|
IEEETest::decreaseTestLevel(void)
|
1999-08-16 21:50:52 +00:00
|
|
|
{ mTestLevel--; }
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//eof
|