00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00021 #ifndef _ASSERTIONS_H
00022 #define _ASSERTIONS_H
00023
00024 #include <cassert>
00025 #include <stdio.h>
00026
00027 #ifndef NDEBUG
00028
00029
00030 #define Require( expr ) \
00031 (__ASSERT_VOID_CAST ((expr) ? 0 : fprintf( stderr, "Require: %s failed in %s:%s at line %d\n", \
00032 __STRING( expr ), __FILE__, __ASSERT_FUNCTION, __LINE__) ) )
00033
00034 #define Ensure( expr ) \
00035 (__ASSERT_VOID_CAST ((expr) ? 0 : fprintf( stderr, "Ensure: %s failed in %s:%s at line %d\n", \
00036 __STRING( expr ), __FILE__, __ASSERT_FUNCTION, __LINE__) ) )
00037
00038
00039 #else
00040
00041 #define Require( expr ) ;
00042 #define Ensure( expr ) ;
00043
00044 #endif
00045
00046 #endif
00047
00048