version 1.8, 2007/07/02 11:01:13
|
version 1.9, 2007/07/12 10:48:00
|
|
|
#ifndef Pegasus_Assert_h | #ifndef Pegasus_Assert_h |
#define Pegasus_Assert_h | #define Pegasus_Assert_h |
| |
#ifdef PEGASUS_OS_ZOS |
|
#include <ctest.h> |
|
# define PEGASUS_ASSERT_CTRACE(COND) \ |
|
do \ |
|
{ \ |
|
if (!(COND)) \ |
|
{ \ |
|
char buffer[200]; \ |
|
sprintf(buffer, \ |
|
"PEGASUS_ASSERT failed in file %s at line %d\n", \ |
|
__FILE__, __LINE__); \ |
|
ctrace(buffer); \ |
|
} \ |
|
} while (0); |
|
#else |
|
# define PEGASUS_ASSERT_CTRACE(COND) |
|
#endif |
|
| |
// NOTE: | // NOTE: |
// | // |
|
|
defining the file, line and condition that was tested. | defining the file, line and condition that was tested. |
*/ | */ |
| |
//#define PEGASUS_ASSERT(COND) assert(COND) |
#define PEGASUS_ASSERT(COND) assert(COND) |
#define PEGASUS_ASSERT(COND) \ |
|
do \ |
|
{ \ |
|
PEGASUS_ASSERT_CTRACE(COND); \ |
|
assert(COND); \ |
|
} while (0) |
|
| |
/* define PEGASUS_DEBUG_ASSERT() assertion statement. This statement tests the | /* define PEGASUS_DEBUG_ASSERT() assertion statement. This statement tests the |
condition defined by the parameters and if not True executes an assert. | condition defined by the parameters and if not True executes an assert. |
|
|
*/ | */ |
| |
#ifdef PEGASUS_DEBUG | #ifdef PEGASUS_DEBUG |
//# define PEGASUS_DEBUG_ASSERT(COND) assert(COND) |
# define PEGASUS_DEBUG_ASSERT(COND) assert(COND) |
# define PEGASUS_DEBUG_ASSERT(COND) PEGASUS_ASSERT(COND) |
|
#else | #else |
# define PEGASUS_DEBUG_ASSERT(COND) | # define PEGASUS_DEBUG_ASSERT(COND) |
#endif | #endif |
|
|
{ \ | { \ |
if (!(COND)) \ | if (!(COND)) \ |
{ \ | { \ |
PEGASUS_ASSERT_CTRACE(COND) \ |
|
printf("PEGASUS_TEST_ASSERT failed in file %s at line %d\n", \ | printf("PEGASUS_TEST_ASSERT failed in file %s at line %d\n", \ |
__FILE__, __LINE__); \ | __FILE__, __LINE__); \ |
abort(); \ | abort(); \ |