Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

vnl_test.h

Go to the documentation of this file.
00001 #ifndef vnl_test_h_
00002 #define vnl_test_h_
00003 
00004 // This is vxl/vnl/vnl_test.h
00005 
00006 //
00007 // Copyright (C) 1991 Texas Instruments Incorporated.
00008 //
00009 // Permission is granted to any individual or institution to use, copy, modify,
00010 // and distribute this software, provided that this complete copyright and
00011 // permission notice is maintained, intact, in all copies and supporting
00012 // documentation.
00013 //
00014 // Texas Instruments Incorporated provides this software "as is" without
00015 // express or implied warranty.
00016 //
00017 
00018 //: \file
00019 //: \brief
00020 //  \author Copyright (C) 1991 Texas Instruments Incorporated.
00021 //
00022 // Permission is granted to any individual or institution to use, copy, modify,
00023 // and distribute this software, provided that this complete copyright and
00024 // permission notice is maintained, intact, in all copies and supporting
00025 // documentation.
00026 //
00027 // Texas Instruments Incorporated provides this software "as is" without
00028 // express or implied warranty.
00029 //
00030 
00031 #include <vcl_string.h>
00032 
00033 void vnl_test_start(const char* name);
00034 void vnl_test_begin(const char* msg);
00035 void vnl_test_perform(int success);
00036 int  vnl_test_summary();
00037 
00038 void vnl_test_assert(const vcl_string& msg, bool expr);
00039 void vnl_test_assert_near(const vcl_string& msg, double expr, double target = 0, double tol = 1e-12);
00040 
00041 //#define Assert *** vnl_test_assert
00042 //#define AssertNear *** vnl_test_assert_near
00043 
00044 #define START(s) vnl_test_start(s);
00045 
00046 #define TEST(s,p,v) \
00047  {  \
00048   vnl_test_begin(s);  \
00049   vnl_test_perform(p==v); \
00050  }
00051 
00052 #define TEST_RUN(s,x,p,v) \
00053  {  \
00054   x;  \
00055   vnl_test_begin(s);  \
00056   vnl_test_perform(p==v); \
00057  }
00058 
00059 #define SUMMARY() vnl_test_summary();
00060 
00061 #undef TESTMAIN
00062 //#define TESTMAIN(x) int main() { vnl_test_start(#x); x(); return vnl_test_summary(); }
00063 #define TESTMAIN(x) int x(int, char* [] ) { vnl_test_start(#x); x(); return vnl_test_summary(); }
00064 
00065 // ---------------------------------------- handy for generating test data
00066 
00067 #include <vcl_complex_fwd.h>
00068 #define macro(T) void vnl_test_fill_random(T *begin, T *end)
00069 macro(float);
00070 macro(double);
00071 macro(long double);
00072 macro(vcl_complex<float>);
00073 macro(vcl_complex<double>);
00074 macro(vcl_complex<long double>);
00075 #undef macro
00076 
00077 #endif // vnl_test_h_

Generated at Fri May 21 01:15:53 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000