summaryrefslogtreecommitdiffstats
path: root/tools/h5diff
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2006-10-26 17:48:36 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2006-10-26 17:48:36 (GMT)
commit469f6d30b1b6641f62bda85f31ca2b3c03dba428 (patch)
treea7defd1ebc6aa6ee4150f09a6cf16b7fa75005d6 /tools/h5diff
parent254262e35b538e09ff95eefc9a276fb390243861 (diff)
downloadhdf5-469f6d30b1b6641f62bda85f31ca2b3c03dba428.zip
hdf5-469f6d30b1b6641f62bda85f31ca2b3c03dba428.tar.gz
hdf5-469f6d30b1b6641f62bda85f31ca2b3c03dba428.tar.bz2
[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
Diffstat (limited to 'tools/h5diff')
-rw-r--r--tools/h5diff/h5diffgentest.c42
-rwxr-xr-xtools/h5diff/testh5diff.sh4
2 files changed, 32 insertions, 14 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index e283043..fa4884f 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -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
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 697de8d..ce16ecc 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -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