Main Page | Directories | File List | File Members

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(); }
 A simplified version of the main test, with parameter passing.
#define TESTLIB_DEFINE_MAIN(x)   int main() { START(#x); x(); return testlib_test_summary(); }
 Another simplified main test. To be used in a standalone executable.
#define TESTLIB_DEFINE_MAIN_ARGS(x)   int main(int argc, char * argv[]) { START(#x); x(argc,argv); SUMMARY(); }
 A simplified main test with parameter passing. To be used in a standalone executable.

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.


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  )     int main() { START(#x); x(); return testlib_test_summary(); }
 

Another simplified main test. To be used in a standalone executable.

Definition at line 129 of file testlib_test.h.

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

A simplified main test with parameter passing. To be used in a standalone executable.

Definition at line 134 of file testlib_test.h.

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

A simplified version of the main test, with parameter passing.

Definition at line 124 of file testlib_test.h.


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.

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.

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.

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.

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.

void testlib_test_begin const char *  msg  ) 
 

increment number of tests, then output msg.

Definition at line 40 of file testlib_test.cxx.

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.


Generated on Thu Jan 10 14:42:50 2008 for core/testlib by  doxygen 1.4.4