summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Cao <xcao@hdfgroup.org>2009-07-28 20:08:09 (GMT)
committerPeter Cao <xcao@hdfgroup.org>2009-07-28 20:08:09 (GMT)
commit3bbdfcd5f75e6c0a2d215dbf3e4ad4140b339cfe (patch)
tree52f143691a35a8e3678263f5581f1807323451ba
parent0e50d368cdba00f2139737134b33d177e12a782b (diff)
downloadhdf5-3bbdfcd5f75e6c0a2d215dbf3e4ad4140b339cfe.zip
hdf5-3bbdfcd5f75e6c0a2d215dbf3e4ad4140b339cfe.tar.gz
hdf5-3bbdfcd5f75e6c0a2d215dbf3e4ad4140b339cfe.tar.bz2
[svn-r17255] Fixed Bug 1563 - h5diff and Infinity
Added test cases.
-rw-r--r--tools/h5diff/h5diffgentest.c17
-rw-r--r--tools/h5diff/testfiles/h5diff_17.txt4
-rw-r--r--tools/h5diff/testfiles/h5diff_171.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_172.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_basic1.h5bin9664 -> 11432 bytes
-rwxr-xr-xtools/h5diff/testh5diff.sh10
-rw-r--r--tools/lib/h5diff_array.c18
7 files changed, 45 insertions, 8 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 95b28ee..cae79b6 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -331,7 +331,24 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1,1,dims1,"fp17",H5T_NATIVE_DOUBLE,data17);
write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18);
+ }
+
+ /*------------------------------------------------------------------------
+ * INFINITY values
+ *------------------------------------------------------------------------
+ */
+ {
+ float data19[6];
+ double data20[6];
+
+ data19[0] = data19[1] = data19[2] = log(0);
+ data19[3] = data19[4] = data19[5] = -log(0);
+
+ data20[0] = data20[1] = data20[2] = log(0);
+ data20[3] = data20[4] = data20[5] = -log(0);
+ write_dset(gid1,1,dims1,"fp19",H5T_NATIVE_FLOAT,data19);
+ write_dset(gid1,1,dims1,"fp20",H5T_NATIVE_DOUBLE,data20);
}
/*-------------------------------------------------------------------------
diff --git a/tools/h5diff/testfiles/h5diff_17.txt b/tools/h5diff/testfiles/h5diff_17.txt
index ac04bd4..dce5ef5 100644
--- a/tools/h5diff/testfiles/h5diff_17.txt
+++ b/tools/h5diff/testfiles/h5diff_17.txt
@@ -7,6 +7,8 @@ file1 file2
x /g1/d2
x x /g1/dset1
x /g1/dset10
+ x /g1/dset11
+ x /g1/dset12
x /g1/dset2
x /g1/dset3
x /g1/dset4
@@ -20,7 +22,9 @@ file1 file2
x /g1/fp16
x /g1/fp17
x /g1/fp18
+ x /g1/fp19
x /g1/fp2
+ x /g1/fp20
x /g1/ld
x /g2
x /g2/dset1
diff --git a/tools/h5diff/testfiles/h5diff_171.txt b/tools/h5diff/testfiles/h5diff_171.txt
new file mode 100644
index 0000000..7ee0711
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_171.txt
@@ -0,0 +1,2 @@
+dataset: </g1/fp19> and </g1/fp19>
+0 differences found
diff --git a/tools/h5diff/testfiles/h5diff_172.txt b/tools/h5diff/testfiles/h5diff_172.txt
new file mode 100644
index 0000000..e2d1b7d
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_172.txt
@@ -0,0 +1,2 @@
+dataset: </g1/fp20> and </g1/fp20>
+0 differences found
diff --git a/tools/h5diff/testfiles/h5diff_basic1.h5 b/tools/h5diff/testfiles/h5diff_basic1.h5
index fd7e16e..7a0b63a 100644
--- a/tools/h5diff/testfiles/h5diff_basic1.h5
+++ b/tools/h5diff/testfiles/h5diff_basic1.h5
Binary files differ
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index e112ed8..4167243 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -326,6 +326,14 @@ TOOLTEST h5diff_16_3.txt -v -p 0.02 $FILE1 $FILE1 g1/dset9 g1/dset10
TESTING $H5DIFF -v $SRCFILE1 $SRCFILE2
TOOLTEST h5diff_17.txt -v $FILE1 $FILE2
+# 1.8 test 32-bit INFINITY
+TESTING $H5DIFF $SRCFILE1 $SRCFILE1 /g1/fp19
+TOOLTEST h5diff_171.txt -v $SRCFILE1 $SRCFILE1 /g1/fp19
+
+# 1.8 test 64-bit INFINITY
+TESTING $H5DIFF $SRCFILE1 $SRCFILE1 /g1/fp20
+TOOLTEST h5diff_172.txt -v $SRCFILE1 $SRCFILE1 /g1/fp20
+
# 1.8 quiet mode
TESTING $H5DIFF -q $SRCFILE1 $SRCFILE2
TOOLTEST h5diff_18.txt -q $FILE1 $FILE2
@@ -541,7 +549,7 @@ TOOLTEST h5diff_627.txt --count=200 $FILE1 $FILE2 g1/dset3 g1/dset4
TESTING $H5DIFF -n 1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4
TOOLTEST h5diff_628.txt -n 1 $FILE1 $FILE2 g1/dset3 g1/dset4
-# Disabling this test as it hangs in parallel tests - LRK 20090618
+# Disabling this test as it hangs - LRK 20090618
# 6.29 non valid files
#TESTING $H5DIFF file1.h6 file2.h6
#TOOLTEST h5diff_629.txt file1.h6 file2.h6
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 2cda3ba..735ea70 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -20,7 +20,6 @@
#include "h5tools.h"
-
#include <sys/timeb.h>
#include <time.h>
@@ -364,9 +363,9 @@ hsize_t diff_array( void *_mem1,
* H5T_COMPOUND
* Recursively call this function for each member
* H5T_ARRAY
- * Recursively call this function for each element�
+ * Recursively call this function for each element
* H5T_VLEN
- * Recursively call this function for each element�
+ * Recursively call this function for each element
* H5T_STRING
* compare byte by byte in a cycle from 0 to type_size. this type_size is the
* value obtained by the get_size function but it is the string lenght for
@@ -3056,15 +3055,11 @@ hsize_t diff_float(unsigned char *mem1,
*/
else
{
-
-
-
for ( i = 0; i < nelmts; i++)
{
memcpy(&temp1_float, mem1, sizeof(float));
memcpy(&temp2_float, mem2, sizeof(float));
-
if (equal_float(temp1_float,temp2_float,options)==FALSE)
{
if ( print_data(options) )
@@ -5548,6 +5543,9 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options)
if (is_zero)
return(equal_double(expected,value,options));
+ if (value == expected)
+ return TRUE;
+
if ( ABS( (value-expected) / expected) < H5DIFF_DBL_EPSILON)
return TRUE;
else
@@ -5609,6 +5607,9 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
if (is_zero)
return(equal_ldouble(expected,value,options));
+ if (value == expected)
+ return TRUE;
+
if ( ABS( (value-expected) / expected) < H5DIFF_DBL_EPSILON)
return TRUE;
else
@@ -5673,6 +5674,9 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options)
if (is_zero)
return(equal_float(expected,value,options));
+ if (value == expected)
+ return TRUE;
+
if ( ABS( (value-expected) / expected) < H5DIFF_FLT_EPSILON)
return TRUE;
else