[svn-r12819]

h5diff: print a message of "not comparable" in a case where the relative error
compare is not possible, due to the denominator being zero.  Modified
the test file generator program to include a example for this and a new
test on the shell script
This commit is contained in:
Pedro Vicente Nunes 2006-10-26 12:48:36 -05:00
parent 254262e35b
commit 469f6d30b1
8 changed files with 812 additions and 36 deletions

View File

@ -129,17 +129,31 @@ int test_basic(const char *fname1,
hid_t fid1, fid2;
hid_t gid1, gid2, gid3;
herr_t status;
hsize_t dims[2] = { 3,2 };
hsize_t dims32[2] = { 3,2 };
hsize_t dims42[2] = { 4,2 };
/* Test */
double data1[3][2] = {{1,1},{1,1},{1,1}};
double data2[3][2] = {{1,1.1},{1.01,1.001},{1.0001,1}};
double data3[3][2] = {{100,110},{100,100},{100,100}};
double data4[3][2] = {{110,100},{90,80},{140,200}};
int data5[3][2] = {{100,100},{100,100},{100,100}};
int data6[3][2] = {{101,102},{103,104},{150,200}};
unsigned long_long data7[3][2] = {{100,100},{100,100},{100,100}};
unsigned long_long data8[3][2] = {{101,102},{103,104},{150,200}};
double data3[3][2] = {{100,100},{100,100},{100,100}};
double data4[3][2] = {{105,120},{160,95},{80,40}};
double data9[4][2] = {{100,100},{100,100},{100,100},{1,0}}; /* compare divide by zero */
double data10[4][2] = {{105,120},{160,95},{80,40},{0,1}};
/*
A B 1-B/A %
100 105 0.05 5
100 120 0.2 20
100 160 0.6 60
100 95 0.05 5
100 80 0.2 20
100 40 0.6 60
1 0 1 100
0 1 #DIV/0!
*/
/*-------------------------------------------------------------------------
* Create two files
@ -154,18 +168,22 @@ int test_basic(const char *fname1,
gid2 = H5Gcreate(fid2, "g1", 0);
gid3 = H5Gcreate(fid2, "g2", 0);
write_dset(gid1,2,dims,"dset1",H5T_NATIVE_DOUBLE,data1);
write_dset(gid2,2,dims,"dset2",H5T_NATIVE_DOUBLE,data2);
write_dset(gid1,2,dims,"dset3",H5T_NATIVE_DOUBLE,data3);
write_dset(gid2,2,dims,"dset4",H5T_NATIVE_DOUBLE,data4);
write_dset(gid2,2,dims,"dset1",H5T_NATIVE_DOUBLE,data2);
write_dset(gid1,2,dims32,"dset1",H5T_NATIVE_DOUBLE,data1);
write_dset(gid2,2,dims32,"dset2",H5T_NATIVE_DOUBLE,data2);
write_dset(gid1,2,dims32,"dset3",H5T_NATIVE_DOUBLE,data3);
write_dset(gid2,2,dims32,"dset4",H5T_NATIVE_DOUBLE,data4);
write_dset(gid2,2,dims32,"dset1",H5T_NATIVE_DOUBLE,data2);
/* relative (int) */
write_dset(gid1,2,dims,"dset5",H5T_NATIVE_INT,data5);
write_dset(gid1,2,dims,"dset6",H5T_NATIVE_INT,data6);
write_dset(gid1,2,dims32,"dset5",H5T_NATIVE_INT,data5);
write_dset(gid1,2,dims32,"dset6",H5T_NATIVE_INT,data6);
/* relative (unsigned long_long) */
write_dset(gid1,2,dims,"dset7",H5T_NATIVE_ULLONG,data7);
write_dset(gid1,2,dims,"dset8",H5T_NATIVE_ULLONG,data8);
write_dset(gid1,2,dims32,"dset7",H5T_NATIVE_ULLONG,data7);
write_dset(gid1,2,dims32,"dset8",H5T_NATIVE_ULLONG,data8);
/* test divide by zero in percente case */
write_dset(gid1,2,dims42,"dset9",H5T_NATIVE_DOUBLE,data9);
write_dset(gid1,2,dims42,"dset10",H5T_NATIVE_DOUBLE,data10);
/*-------------------------------------------------------------------------
* Close

View File

@ -284,8 +284,8 @@ TOOLTEST h5diff_14.txt $FILE1 $FILE2 -r g1/dset1 g1/dset2
# 1.5 with -d
TOOLTEST h5diff_15.txt $FILE1 $FILE2 -r -d 5 g1/dset3 g1/dset4
# 1.6 with -p
TOOLTEST h5diff_16.txt $FILE1 $FILE2 -r -p 0.05 g1/dset3 g1/dset4
# 1.6 with -p (test divide by zero case)
TOOLTEST h5diff_16.txt $FILE1 $FILE1 g1/dset9 g1/dset10 -p 0.01 -v
# 1.7 verbose mode
TOOLTEST h5diff_17.txt $FILE1 $FILE2 -v

File diff suppressed because it is too large Load Diff

View File

@ -4,10 +4,8 @@ Expected output for 'h5diff h5diff_basic1.h5 h5diff_basic2.h5 -r -d 5 g1/dset3 g
Dataset: </g1/dset3> and </g1/dset4>
position dset3 dset4 difference
------------------------------------------------------------
[ 0 0 ] 100.000000 110.000000 10.000000
[ 0 1 ] 110.000000 100.000000 10.000000
[ 1 0 ] 100.000000 90.000000 10.000000
[ 1 1 ] 100.000000 80.000000 20.000000
[ 2 0 ] 100.000000 140.000000 40.000000
[ 2 1 ] 100.000000 200.000000 100.000000
6 differences found
[ 0 1 ] 100.000000 120.000000 20.000000
[ 1 0 ] 100.000000 160.000000 60.000000
[ 2 0 ] 100.000000 80.000000 20.000000
[ 2 1 ] 100.000000 40.000000 60.000000
4 differences found

View File

@ -1,13 +1,18 @@
#############################
Expected output for 'h5diff h5diff_basic1.h5 h5diff_basic2.h5 -r -p 0.05 g1/dset3 g1/dset4'
Expected output for 'h5diff h5diff_basic1.h5 h5diff_basic1.h5 g1/dset9 g1/dset10 -p 0.01 -v'
#############################
Dataset: </g1/dset3> and </g1/dset4>
position dset3 dset4 difference relative
Dataset: </g1/dset9> and </g1/dset10>
position dset9 dset10 difference relative
------------------------------------------------------------------------
[ 0 0 ] 100 110 10 0.1
[ 0 1 ] 110 100 10 0.09090909091
[ 1 0 ] 100 90 10 0.1
[ 1 1 ] 100 80 20 0.2
[ 2 0 ] 100 140 40 0.4
[ 2 1 ] 100 200 100 1
6 differences found
[ 0 0 ] 100 105 5 0.05
[ 0 1 ] 100 120 20 0.2
[ 1 0 ] 100 160 60 0.6
[ 1 1 ] 100 95 5 0.05
[ 2 0 ] 100 80 20 0.2
[ 2 1 ] 100 40 60 0.6
[ 3 0 ] 1 0 1 1
[ 3 1 ] 0 1 1 not comparable
8 differences found
--------------------------------
Some objects are not comparable
--------------------------------

View File

@ -6,6 +6,7 @@ file1 file2
---------------------------------------
x x /g1
x x /g1/dset1
x /g1/dset10
x /g1/dset2
x /g1/dset3
x /g1/dset4
@ -13,6 +14,7 @@ file1 file2
x /g1/dset6
x /g1/dset7
x /g1/dset8
x /g1/dset9
x /g2
Group: </g1> and </g1>

Binary file not shown.

Binary file not shown.