KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
l_test.h File Reference
#include <l/l_sys_lib.h>
#include <l_cpp/l_exception.h>

Go to the source code of this file.

Macros

#define DOWN_IN_FLAMES(tst, src)   down_in_flames( (tst), __FILE__, __LINE__, (src) )
 
#define RETURN_VICTORIOUSLY()
 
#define TEST_TRUE(line)   do if (!(line)) { DOWN_IN_FLAMES( "TEST_TRUE", #line ); } while( 0 )
 
#define TEST_FALSE(line)   do if ( line ) { DOWN_IN_FLAMES( "TEST_FALSE", #line ); } while( 0 )
 
#define TEST_SUCCESS(line)
 
#define TEST_APPROX_EQUALITY(x, y)
 
#define TEST_APPROX_ZERO(z)   TEST_ZERO_WITH_TOLERANCE(z, 1e-10)
 
#define TEST_ZERO_WITH_TOLERANCE(z, t)
 
#define TEST_FAIL(line)
 

Functions

void down_in_flames (const char *test_kind, const char *filename, int line_num, const char *bad_line)
 
void print_victory (const char *)
 

Macro Definition Documentation

#define DOWN_IN_FLAMES (   tst,
  src 
)    down_in_flames( (tst), __FILE__, __LINE__, (src) )
#define RETURN_VICTORIOUSLY ( )
Value:
do { print_victory(__FILE__); \
return EXIT_SUCCESS; \
} while( 0 )
void print_victory(const char *)
Definition: l_test.cpp:39
#define TEST_APPROX_EQUALITY (   x,
 
)
Value:
do { \
const double a(x), b(y); \
if(!(a==b || fabs(a-b) <= (fabs(a)+fabs(b))*0.005 )) \
{ \
DOWN_IN_FLAMES( "TEST_APPROX_EQUALITY", #x " approx == " #y ); \
} \
} while(0)
if(ss(2)==3) grayIm
#define DOWN_IN_FLAMES(tst, src)
Definition: l_test.h:39
x
Definition: APPgetLargeConnectedEdges.m:100
#define TEST_APPROX_ZERO (   z)    TEST_ZERO_WITH_TOLERANCE(z, 1e-10)
#define TEST_FAIL (   line)
Value:
do { \
bool assert_fail_failed = false; \
try { line; } \
catch( kjb::Index_out_of_bounds& iob ) \
{ \
/* std::cout <<"Correctly caught: "; */ \
/* iob.print( std::cout ); */ \
assert_fail_failed = true; \
} \
catch(...) \
{ \
assert_fail_failed = true; \
} \
if (!assert_fail_failed) \
{ \
DOWN_IN_FLAMES( "TEST_FAIL", #line ); \
} \
} while( 0 )
Object thrown when an index argument exceeds the size of a container.
Definition: l_exception.h:399
if(ss(2)==3) grayIm
#define DOWN_IN_FLAMES(tst, src)
Definition: l_test.h:39
#define TEST_FALSE (   line)    do if ( line ) { DOWN_IN_FLAMES( "TEST_FALSE", #line ); } while( 0 )
#define TEST_SUCCESS (   line)
Value:
do { \
try { line; } \
catch(...) \
{ \
DOWN_IN_FLAMES( "TEST_SUCCESS", #line ); \
} \
} while ( 0 )
#define DOWN_IN_FLAMES(tst, src)
Definition: l_test.h:39
#define TEST_TRUE (   line)    do if (!(line)) { DOWN_IN_FLAMES( "TEST_TRUE", #line ); } while( 0 )
#define TEST_ZERO_WITH_TOLERANCE (   z,
 
)
Value:
do { \
if (!(fabs(z) <= (t))) \
{ \
DOWN_IN_FLAMES( "TEST_ZERO_WITH_TOLERANCE", "fabs(" #z ")<=" #t );\
} \
} while(0)
if(ss(2)==3) grayIm
#define DOWN_IN_FLAMES(tst, src)
Definition: l_test.h:39

Function Documentation

void down_in_flames ( const char *  test_kind,
const char *  filename,
int  line_num,
const char *  bad_line 
)
void print_victory ( const char *  )