00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _h5cpputil_h
00025 #define _h5cpputil_h
00026
00027 #include "h5test.h"
00028
00029 #ifndef H5_NO_NAMESPACE
00030 using namespace H5;
00031 #endif
00032
00033 #ifndef H5_NO_STD
00034 using std::cerr;
00035 using std::endl;
00036 #endif
00037
00038 #define MESSAGE(V,A) {if (HDGetTestVerbosity()>(V)) print_func A;}
00039 #define SUBTEST(TEST) {printf(" Subtest: %-52s",TEST); fflush(stdout);}
00040
00041 int check_values (hsize_t i, hsize_t j, int apoint, int acheck);
00042 int test_report (int, const H5std_string&);
00043 void issue_fail_msg(const char* where, int line, const char* file_name,
00044 const char* message="");
00045
00046 class InvalidActionException : public Exception {
00047 public:
00048 InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
00049 InvalidActionException();
00050 virtual ~InvalidActionException();
00051 };
00052
00053 class TestFailedException : public Exception {
00054 public:
00055 TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
00056 TestFailedException();
00057 virtual ~TestFailedException();
00058 };
00059
00060 template <class Type1, class Type2>
00061 void verify_val(Type1 x, Type2 value, const char* where, int line, const char* file_name)
00062 {
00063 if (GetTestVerbosity()>=VERBO_HI)
00064 {
00065 cerr << endl;
00066 cerr << " Call to routine: " << where << " at line " << line
00067 << " in " << file_name << " had value " << x << endl;
00068 }
00069 if (x != value)
00070 {
00071 cerr << endl;
00072 cerr << "*** UNEXPECTED VALUE from " << where << " should be "
00073 << value << ", but is " << x << " at line " << line
00074 << " in " << file_name << endl;
00075 IncTestNumErrs();
00076 throw TestFailedException(where, "");
00077 }
00078 }
00079
00080 template <class Type1, class Type2>
00081 void verify_val(Type1 x, Type2 value, const char* msg, const char* file_name, int line)
00082 {
00083 if (x != value)
00084 {
00085 cerr << endl;
00086 cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line
00087 << ":" << msg << " different: " << x << ", should be " << value
00088 << endl;
00089 IncTestNumErrs();
00090 throw TestFailedException(file_name, msg);
00091 }
00092 }
00093
00094 template <class Type1, class Type2>
00095 void verify_val_noteq(Type1 x, Type2 value, const char* where, int line, const char* file_name)
00096 {
00097 if (GetTestVerbosity()>=VERBO_HI)
00098 {
00099 cerr << endl;
00100 cerr << " Call to routine: " << where << " at line " << line
00101 << " in " << file_name << " had value " << x << endl;
00102 }
00103 if (x == value)
00104 {
00105 cerr << endl;
00106 cerr << "*** UNEXPECTED VALUE from " << where << " should not be "
00107 << value << " at line " << line << " in " << file_name << endl;
00108 IncTestNumErrs();
00109 throw TestFailedException(where, "");
00110 }
00111 }
00112
00113
00114 #ifdef __cplusplus
00115 extern "C" {
00116 #endif
00117 void test_attr();
00118 void test_compound();
00119 void test_file();
00120 void test_filters();
00121 void test_links();
00122 void test_h5s();
00123 void test_reference();
00124 void test_types();
00125 void test_vlstrings();
00126 void test_dset();
00127
00128
00129 void cleanup_attr();
00130 void cleanup_compound();
00131 void cleanup_dsets();
00132 void cleanup_file();
00133 void cleanup_filters();
00134 void cleanup_links();
00135 void cleanup_h5s();
00136 void cleanup_reference();
00137 void cleanup_types();
00138 void cleanup_vlstrings();
00139
00140 #ifdef __cplusplus
00141 }
00142 #endif
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 #endif