summaryrefslogtreecommitdiffstats
path: root/test/testhdf5.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/testhdf5.h')
-rw-r--r--test/testhdf5.h115
1 files changed, 54 insertions, 61 deletions
diff --git a/test/testhdf5.h b/test/testhdf5.h
index 156aa78..5a12cc1 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -29,159 +29,142 @@
/* Include generic testing header also */
#include "h5test.h"
-#ifdef HDF5_TEST_MASTER
-/* Global variables */
-int num_errs = 0;
-int Verbosity = 4; /* Default Verbosity is Low */
-#else /* HDF5_TEST_MASTER */
-extern int num_errs;
-extern int Verbosity;
-#endif /* HDF5_TEST_MASTER */
-
/* Use %ld to print the value because long should cover most cases. */
/* Used to make certain a return value _is_not_ a value */
#ifdef H5_WANT_H5_V1_6_COMPAT
#define CHECK(ret, val, where) do { \
- if (Verbosity>9) print_func(" Call to routine: %15s at line %4d " \
+ if (GetTestVerbosity()>9) print_func(" Call to routine: %15s at line %4d " \
"in %s returned %ld \n", \
where, (int)__LINE__, __FILE__, \
(long)(ret)); \
- if ((ret) == (val)) { \
- print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
- "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
- num_errs++; \
+ if ((ret) == (val)) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
+ "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
} \
} while(0)
#define CHECK_I(ret,where) { \
- if (Verbosity>9) { \
+ if (GetTestVerbosity()>9) { \
print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \
(where), (int)__LINE__, __FILE__, (long)(ret)); \
} \
if ((ret)<0) { \
- print_func ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \
+ TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \
(where), (long)(ret), (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
- num_errs++; \
} \
}
#define CHECK_PTR(ret,where) { \
- if (Verbosity>9) { \
+ if (GetTestVerbosity()>9) { \
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
(where), (int)__LINE__, __FILE__, (ret)); \
} \
if (!(ret)) { \
- print_func ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \
+ TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \
(where), (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
- num_errs++; \
} \
}
/* Used to make certain a return value _is_ a value */
#define VERIFY(x, val, where) do { \
- if (Verbosity>9) { \
+ if (GetTestVerbosity()>9) { \
print_func(" Call to routine: %15s at line %4d in %s had value " \
- "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \
+ "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \
} \
if ((x) != (val)) { \
- print_func("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
- "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \
+ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
+ "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
- num_errs++; \
} \
} while(0)
/* Used to document process through a test and to check for errors */
#define RESULT(ret,func) do { \
- if (Verbosity>8) { \
+ if (GetTestVerbosity()>8) { \
print_func(" Call to routine: %15s at line %4d in %s returned " \
- "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
+ "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
} \
- if (Verbosity>9) HEEprint(stdout); \
- if ((ret) == FAIL) { \
- print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
- "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \
+ if (GetTestVerbosity()>9) \
+ H5Eprint(stdout); \
+ if ((ret) == FAIL) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
+ "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \
H5Eprint (stdout); \
- num_errs++; \
} \
} while(0)
#else
#define CHECK(ret, val, where) do { \
- if (Verbosity>9) print_func(" Call to routine: %15s at line %4d " \
+ if (GetTestVerbosity()>9) print_func(" Call to routine: %15s at line %4d " \
"in %s returned %ld \n", \
where, (int)__LINE__, __FILE__, \
(long)(ret)); \
- if ((ret) == (val)) { \
- print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
- "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
- num_errs++; \
- H5Eprint (H5E_DEFAULT, stdout); \
+ if ((ret) == (val)) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
+ "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
+ H5Eprint (H5E_DEFAULT, stdout); \
} \
} while(0)
#define CHECK_I(ret,where) { \
- if (Verbosity>9) { \
+ if (GetTestVerbosity()>9) { \
print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \
(where), (int)__LINE__, __FILE__, (long)(ret)); \
} \
if ((ret)<0) { \
- print_func ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \
+ TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \
(where), (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint (H5E_DEFAULT, stdout); \
- num_errs++; \
+ H5Eprint (H5E_DEFAULT, stdout); \
} \
}
#define CHECK_PTR(ret,where) { \
- if (Verbosity>9) { \
+ if (GetTestVerbosity()>9) { \
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
(where), (int)__LINE__, __FILE__, (ret)); \
} \
if (!(ret)) { \
- print_func ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \
+ TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \
(where), (int)__LINE__, __FILE__); \
- H5Eprint (H5E_DEFAULT, stdout); \
- num_errs++; \
+ H5Eprint (H5E_DEFAULT, stdout); \
} \
}
/* Used to make certain a return value _is_ a value */
#define VERIFY(x, val, where) do { \
- if (Verbosity>9) { \
+ if (GetTestVerbosity()>9) { \
print_func(" Call to routine: %15s at line %4d in %s had value " \
- "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \
+ "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \
} \
if ((x) != (val)) { \
- print_func("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
- "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \
- H5Eprint (H5E_DEFAULT, stdout); \
- num_errs++; \
+ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
+ "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \
+ H5Eprint (H5E_DEFAULT, stdout); \
} \
} while(0)
/* Used to document process through a test and to check for errors */
#define RESULT(ret,func) do { \
- if (Verbosity>8) { \
+ if (GetTestVerbosity()>8) { \
print_func(" Call to routine: %15s at line %4d in %s returned " \
- "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
+ "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
} \
- if (Verbosity>9) H5Eprint(H5E_DEFAULT, stdout); \
- if ((ret) == FAIL) { \
- print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
- "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint (H5E_DEFAULT, stdout); \
- num_errs++; \
+ if (GetTestVerbosity()>9) \
+ H5Eprint(H5E_DEFAULT, stdout); \
+ if ((ret) == FAIL) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
+ "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \
+ H5Eprint (H5E_DEFAULT, stdout); \
} \
} while(0)
#endif /* H5_WANT_H5_V1_6_COMPAT */
/* Used to document process through a test */
-#define MESSAGE(V,A) {if (Verbosity>(V)) print_func A;}
+#define MESSAGE(V,A) {if (GetTestVerbosity()>(V)) print_func A;}
/* definitions for command strings */
#define VERBOSITY_STR "Verbosity"
@@ -189,6 +172,10 @@ extern int Verbosity;
#define TEST_STR "Test"
#define CLEAN_STR "Cleanup"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Routines for operating on the list of tests (for the "all in one" tests) */
H5TEST_DLL void TestUsage(void);
H5TEST_DLL void AddTest(const char *TheName, void (*TheCall) (void),
@@ -199,6 +186,9 @@ H5TEST_DLL void PerformTests(void);
H5TEST_DLL void TestSummary(void);
H5TEST_DLL void TestCleanup(void);
H5TEST_DLL void TestInit(void);
+H5TEST_DLL int GetTestVerbosity(void);
+H5TEST_DLL int GetTestNumErrs(void);
+H5TEST_DLL int TestErrPrintf(const char *format, ...);
/* Prototypes for the test routines */
void test_metadata(void);
@@ -238,4 +228,7 @@ void cleanup_genprop(void);
void cleanup_configure(void);
void cleanup_misc(void);
+#ifdef __cplusplus
+}
+#endif
#endif /* TESTHDF5_H */