diff options
Diffstat (limited to 'c++/test/h5cpputil.h')
-rw-r--r-- | c++/test/h5cpputil.h | 106 |
1 files changed, 54 insertions, 52 deletions
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 6664d0c..97ed00b 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -28,94 +28,97 @@ using namespace H5; using std::cerr; using std::endl; -#define MESSAGE(V,A) {if (HDGetTestVerbosity()>(V)) print_func A;} -#define SUBTEST(TEST) {printf(" Subtest: %-52s",TEST); fflush(stdout);} +#define MESSAGE(V, A) \ + { \ + if (HDGetTestVerbosity() > (V)) \ + print_func A; \ + } +#define SUBTEST(TEST) \ + { \ + printf(" Subtest: %-52s", TEST); \ + fflush(stdout); \ + } -int check_values (hsize_t i, hsize_t j, int apoint, int acheck); -void check_values(const char *value, const char* msg, int line, const char* file_name); -int test_report (int, const H5std_string&); -void issue_fail_msg(const char* where, int line, const char* file_name, - const char* message=""); -void issue_fail_msg(const char* where, int line, const char* file_name, - const char* func_name, const char* message); +int check_values(hsize_t i, hsize_t j, int apoint, int acheck); +void check_values(const char *value, const char *msg, int line, const char *file_name); +int test_report(int, const H5std_string &); +void issue_fail_msg(const char *where, int line, const char *file_name, const char *message = ""); +void issue_fail_msg(const char *where, int line, const char *file_name, const char *func_name, + const char *message); class InvalidActionException : public Exception { - public: - InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); - InvalidActionException(); - virtual ~InvalidActionException() throw(); + public: + InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); + InvalidActionException(); + virtual ~InvalidActionException() throw(); }; class TestFailedException : public Exception { - public: - TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); - TestFailedException(); - virtual ~TestFailedException() throw(); + public: + TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); + TestFailedException(); + virtual ~TestFailedException() throw(); }; // Overloaded/Template functions to verify values and display proper info // Verifies -void verify_val(const char* x, const char* value, const char* where, int line, const char* file_name); +void verify_val(const char *x, const char *value, const char *where, int line, const char *file_name); template <class Type1, class Type2> - void verify_val(Type1 x, Type2 value, const char* where, int line, const char* file_name) +void +verify_val(Type1 x, Type2 value, const char *where, int line, const char *file_name) { - if (GetTestVerbosity()>=VERBO_HI) - { + if (GetTestVerbosity() >= VERBO_HI) { cerr << endl; - cerr << " Call to routine: " << where << " at line " << line - << " in " << file_name << " had value " << x << endl; + cerr << " Call to routine: " << where << " at line " << line << " in " << file_name << " had value " + << x << endl; } - if (x != value) - { + if (x != value) { cerr << endl; - cerr << "*** UNEXPECTED VALUE from " << where << " should be " - << value << ", but is " << x << " at line " << line - << " in " << file_name << endl; + cerr << "*** UNEXPECTED VALUE from " << where << " should be " << value << ", but is " << x + << " at line " << line << " in " << file_name << endl; IncTestNumErrs(); throw TestFailedException(where, ""); } } template <class Type1, class Type2> - void verify_val(Type1 x, Type2 value, const char* msg, const char* file_name, int line) +void +verify_val(Type1 x, Type2 value, const char *msg, const char *file_name, int line) { - if (x != value) - { + if (x != value) { cerr << endl; - cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line - << ": " << msg << " different: " << x << ", should be " << value - << endl; + cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line << ": " << msg + << " different: " << x << ", should be " << value << endl; IncTestNumErrs(); throw TestFailedException(file_name, msg); } } template <class Type1, class Type2> - void verify_val_noteq(Type1 x, Type2 value, const char* where, int line, const char* file_name) +void +verify_val_noteq(Type1 x, Type2 value, const char *where, int line, const char *file_name) { - if (GetTestVerbosity()>=VERBO_HI) - { + if (GetTestVerbosity() >= VERBO_HI) { cerr << endl; - cerr << " Call to routine: " << where << " at line " << line - << " in " << file_name << " had value " << x << endl; + cerr << " Call to routine: " << where << " at line " << line << " in " << file_name << " had value " + << x << endl; } - if (x == value) - { + if (x == value) { cerr << endl; - cerr << "*** UNEXPECTED VALUE from " << where << " should not be " - << value << " at line " << line << " in " << file_name << endl; + cerr << "*** UNEXPECTED VALUE from " << where << " should not be " << value << " at line " << line + << " in " << file_name << endl; IncTestNumErrs(); throw TestFailedException(where, ""); } } template <class Type1, class Type2> - void CHECK(Type1 x, Type2 value, const char* msg, int line, const char* file_name) +void +CHECK(Type1 x, Type2 value, const char *msg, int line, const char *file_name) { - if (x == value) - { + if (x == value) { cerr << endl; cerr << "*** Function " << msg << " FAILED at line " << line << endl; IncTestNumErrs(); @@ -124,14 +127,13 @@ template <class Type1, class Type2> } template <class Type1, class Type2> - void verify_val(Type1 x, Type2 value, float epsilon, const char* msg, int line, const char* file_name) +void +verify_val(Type1 x, Type2 value, float epsilon, const char *msg, int line, const char *file_name) { - if (x == value) - { + if (x == value) { cerr << endl; - cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line - << ": " << msg << " different: " << x << ", should be " << value - << " (epsilon=" << epsilon << ")" << endl; + cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line << ": " << msg + << " different: " << x << ", should be " << value << " (epsilon=" << epsilon << ")" << endl; IncTestNumErrs(); throw TestFailedException(file_name, msg); } |