core/testlib/testlib_test.h File Reference


Detailed Description

Testing software.

Author:
Tim Cootes
    Modifications
     Apr 2002, Amitha Perera: Copied from vil_test and moved into testlib in an
                    attempt to consolidate all the repeated test functionality.
     Sep.2004, Peter Vanroose: added testlib_test_assert_near_relative().
   

Definition in file testlib_test.h.

#include <vcl_string.h>
#include <vcl_complex.h>

Go to the source code of this file.


Defines

#define Assert   testlib_test_assert
#define AssertNear   testlib_test_assert_near
#define AssertFar   testlib_test_assert_far
#define TESTMAIN_ARGS(x)   int x ## _main(int argc, char*argv[]) { START(#x); x(argc,argv); SUMMARY(); }
#define TESTLIB_DEFINE_MAIN(x)   int main() { START(#x); x(); return testlib_test_summary(); }
#define TESTLIB_DEFINE_MAIN_ARGS(x)   int main(int argc, char * argv[]) { START(#x); x(argc,argv); SUMMARY(); }

Functions

void testlib_test_start (const char *name=0)
 initialise test counters, check test name 'name' exists.
void testlib_test_begin (const char *msg)
 increment number of tests, then output msg.
void testlib_test_perform (bool success)
 increment success/failure counters.
int testlib_test_summary ()
 output summary of tests performed.
void testlib_test_assert (const vcl_string &msg, bool expr)
 output msg, then perform test in expr.
void testlib_test_assert_near (const vcl_string &msg, double expr, double target=0, double tol=1e-12)
 output msg, then perform test to see if expr is within tol of target.
void testlib_test_assert_near (const vcl_string &msg, vcl_complex< double > expr, vcl_complex< double > target, double tol=1e-12)
 output msg, then perform test to see if expr is within tol of target.
void testlib_test_assert_near_relative (const vcl_string &msg, double expr, double target=0, double tol=1e-12)
 output msg, then test to see if expr is within relative tol of target.
void testlib_test_assert_near_relative (const vcl_string &msg, vcl_complex< double > expr, vcl_complex< double > target, double tol=1e-12)
 output msg, then test to see if expr is within relative tol of target.
void testlib_test_assert_far (const vcl_string &msg, double expr, double target=0, double tol=1e-12)
 output msg, then perform test to see if expr is not within tol of target.
void testlib_test_assert_far (const vcl_string &msg, vcl_complex< double > expr, vcl_complex< double > target, double tol=1e-12)
 output msg, then perform test to see if expr is not within tol of target.
void testlib_test_assert_equal (const vcl_string &msg, long expr, long target)
 output msg, then perform test to see if expr is equal to target.
 testlib_test_begin (s)
 testlib_test_perform ((p)==(v))
 while (false) testlib_test_begin(s)
 TEST function, s is message, test to see if p==v for integral values.
 testlib_test_assert_equal ("", p, v)
 testlib_test_assert_near ("", p, v, t)
 testlib_test_assert_near_relative ("", p, v, t)
 testlib_test_assert_far ("", p, v, t)

Variables

 x

Define Documentation

#define Assert   testlib_test_assert

Definition at line 52 of file testlib_test.h.

#define AssertFar   testlib_test_assert_far

Definition at line 54 of file testlib_test.h.

#define AssertNear   testlib_test_assert_near

Definition at line 53 of file testlib_test.h.

#define TESTLIB_DEFINE_MAIN ( x   )     int main() { START(#x); x(); return testlib_test_summary(); }

#define TESTLIB_DEFINE_MAIN_ARGS ( x   )     int main(int argc, char * argv[]) { START(#x); x(argc,argv); SUMMARY(); }

#define TESTMAIN_ARGS ( x   )     int x ## _main(int argc, char*argv[]) { START(#x); x(argc,argv); SUMMARY(); }


Function Documentation

void testlib_test_assert ( const vcl_string &  msg,
bool  expr 
)

output msg, then perform test in expr.

Definition at line 95 of file testlib_test.cxx.

testlib_test_assert_equal ( ""  ,
,
 
)

void testlib_test_assert_equal ( const vcl_string &  msg,
long  expr,
long  target 
)

output msg, then perform test to see if expr is equal to target.

Definition at line 159 of file testlib_test.cxx.

testlib_test_assert_far ( ""  ,
,
,
 
)

void testlib_test_assert_far ( const vcl_string &  msg,
vcl_complex< double >  expr,
vcl_complex< double >  target,
double  tol = 1e-12 
)

output msg, then perform test to see if expr is not within tol of target.

Definition at line 150 of file testlib_test.cxx.

void testlib_test_assert_far ( const vcl_string &  msg,
double  expr,
double  target = 0,
double  tol = 1e-12 
)

output msg, then perform test to see if expr is not within tol of target.

Definition at line 141 of file testlib_test.cxx.

testlib_test_assert_near ( ""  ,
,
,
 
)

void testlib_test_assert_near ( const vcl_string &  msg,
vcl_complex< double >  expr,
vcl_complex< double >  target,
double  tol = 1e-12 
)

output msg, then perform test to see if expr is within tol of target.

Definition at line 110 of file testlib_test.cxx.

void testlib_test_assert_near ( const vcl_string &  msg,
double  expr,
double  target = 0,
double  tol = 1e-12 
)

output msg, then perform test to see if expr is within tol of target.

Definition at line 101 of file testlib_test.cxx.

testlib_test_assert_near_relative ( ""  ,
,
,
 
)

void testlib_test_assert_near_relative ( const vcl_string &  msg,
vcl_complex< double >  expr,
vcl_complex< double >  target,
double  tol = 1e-12 
)

output msg, then test to see if expr is within relative tol of target.

Definition at line 130 of file testlib_test.cxx.

void testlib_test_assert_near_relative ( const vcl_string &  msg,
double  expr,
double  target = 0,
double  tol = 1e-12 
)

output msg, then test to see if expr is within relative tol of target.

Definition at line 119 of file testlib_test.cxx.

testlib_test_begin (  ) 

void testlib_test_begin ( const char *  msg  ) 

increment number of tests, then output msg.

Definition at line 40 of file testlib_test.cxx.

testlib_test_perform ( (p)  = =(v)  ) 

void testlib_test_perform ( bool  success  ) 

increment success/failure counters.

Definition at line 52 of file testlib_test.cxx.

void testlib_test_start ( const char *  name = 0  ) 

initialise test counters, check test name 'name' exists.

Definition at line 28 of file testlib_test.cxx.

int testlib_test_summary (  ) 

output summary of tests performed.

Definition at line 63 of file testlib_test.cxx.

while ( false   ) 

TEST function, s is message, test to see if p==v for integral values.


Variable Documentation

x

Definition at line 98 of file testlib_test.h.


Generated on Sat Nov 22 05:10:24 2008 for core/testlib by  doxygen 1.5.1