summaryrefslogtreecommitdiffstats
path: root/c++/test/h5cpputil.h
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2016-09-02 03:14:22 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2016-09-02 03:14:22 (GMT)
commit478f771243b4e7b7c416dde22b5dcde13e1f3541 (patch)
tree815047e9cb991d006270df7a599740ad8ea7e7d3 /c++/test/h5cpputil.h
parent130e0a6638351bbdb7e53a82e5bdb810fd13a903 (diff)
downloadhdf5-478f771243b4e7b7c416dde22b5dcde13e1f3541.zip
hdf5-478f771243b4e7b7c416dde22b5dcde13e1f3541.tar.gz
hdf5-478f771243b4e7b7c416dde22b5dcde13e1f3541.tar.bz2
Purpose: Code cleanup
Description: - Used FP_EPSILON in comparing float values to verify read data - Casted C macro to fix mismatched types in verify_val calls Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
Diffstat (limited to 'c++/test/h5cpputil.h')
-rw-r--r--c++/test/h5cpputil.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h
index b615194..50cde99 100644
--- a/c++/test/h5cpputil.h
+++ b/c++/test/h5cpputil.h
@@ -89,7 +89,7 @@ template <class Type1, class Type2>
{
cerr << endl;
cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line
- << ":" << msg << " different: " << x << ", should be " << value
+ << ": " << msg << " different: " << x << ", should be " << value
<< endl;
IncTestNumErrs();
throw TestFailedException(file_name, msg);
@@ -127,6 +127,19 @@ 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)
+{
+ if (x == value)
+ {
+ cerr << endl;
+ cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line
+ << ": " << msg << " different: " << x << ", should be " << value
+ << " (epsilon=" << epsilon << ")" << endl;
+ IncTestNumErrs();
+ throw TestFailedException(file_name, msg);
+ }
+}
/* Prototypes for the test routines */
#ifdef __cplusplus