[svn-r17254] Fixed Bug 1563 - h5diff and Infinity

Added test cases
This commit is contained in:
Peter Cao 2009-07-28 14:40:18 -05:00
parent c9b33f6dd4
commit a6676de3c8
7 changed files with 43 additions and 5 deletions

View File

@ -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);
}
/*-------------------------------------------------------------------------

View File

@ -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

View File

@ -0,0 +1,2 @@
dataset: </g1/fp19> and </g1/fp19>
0 differences found

View File

@ -0,0 +1,2 @@
dataset: </g1/fp20> and </g1/fp20>
0 differences found

View File

@ -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

View File

@ -3055,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) )
@ -5547,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
@ -5608,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
@ -5672,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
@ -6024,4 +6029,4 @@ static void h5diff_print_char(char ch)
break;
}
}
}