diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2009-02-11 15:57:25 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2009-02-11 15:57:25 (GMT) |
commit | 96a0892ba8ea603835459b0104fb8b91432110a3 (patch) | |
tree | 99acde79358f18e20d2e40bbbd84936e7092e03d /tools/h5diff/h5diffgentest.c | |
parent | d4ea5fbfb279e879d57c01cabd9c7ad9f30eda25 (diff) | |
download | hdf5-96a0892ba8ea603835459b0104fb8b91432110a3.zip hdf5-96a0892ba8ea603835459b0104fb8b91432110a3.tar.gz hdf5-96a0892ba8ea603835459b0104fb8b91432110a3.tar.bz2 |
[svn-r16461] Bug fix: for compound types, the not comparable test for members was not done
Solution: for compound types, recursively apply that check
Two new cases are added
1) the compound type has a different number of members. Message printed is
<obj1> has X members <obj2> has Y members
Where X and Y are the number of members of each compound type being compared
2) the compound type has not comparable types (for example a double and an int at the same index)
In this case the message
Comparison not possible: object1 is of class1 and object2 is of class2
Is replaced with
Comparison not possible: object1 has a class1 and object2 has a class2
Modified the test generator program to have these 2 cases
Added a shell run for these 2 cases
Tested: windows, h5committest
Diffstat (limited to 'tools/h5diff/h5diffgentest.c')
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index ec379be..141c96f 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -331,12 +331,37 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) /* not comparable objects */ { + + typedef struct cmp1_t + { + double d; + int i; + } cmp1_t; + + typedef struct cmp2_t + { + int i; + double d; + } cmp2_t; + + typedef struct cmp3_t + { + int i; + } cmp3_t; + double data2[6] = {0,0,0,0,0,0}; int data3[6] = {0,0,0,0,0,0}; int data4[3][2] = {{0,0},{0,0},{0,0}}; - hsize_t dims3[2] = { 2,2 }; int data5[2][2] = {{0,0},{0,0}}; unsigned int data6[3][2] = {{0,0},{0,0},{0,0}}; + cmp1_t data7[1] = {1,2}; + cmp2_t data8[1] = {1,2}; + hsize_t dims3[2] = { 2,2 }; + hsize_t dims4[1] = { 1 }; + size_t type_size; + hid_t tid; + + write_dset(gid3,1,dims1,"dset1",H5T_NATIVE_DOUBLE,NULL); write_dset(gid3,1,dims1,"dset2",H5T_NATIVE_DOUBLE,data2); @@ -344,7 +369,28 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) write_dset(gid3,2,dims2,"dset4",H5T_NATIVE_INT,data4); write_dset(gid3,2,dims3,"dset5",H5T_NATIVE_INT,data5); write_dset(gid3,2,dims2,"dset6",H5T_NATIVE_UINT,data6); - + + /* case of compound with different type members */ + type_size = sizeof( cmp1_t ); + tid = H5Tcreate (H5T_COMPOUND, type_size ); + H5Tinsert(tid, "d", HOFFSET( cmp1_t, d ), H5T_NATIVE_DOUBLE ); + H5Tinsert(tid, "i", HOFFSET( cmp1_t, i ), H5T_NATIVE_INT ); + write_dset(gid3,1,dims4,"dset7",tid,data7); + H5Tclose(tid); + + type_size = sizeof( cmp2_t ); + tid = H5Tcreate (H5T_COMPOUND, type_size ); + H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT ); + H5Tinsert(tid, "d", HOFFSET( cmp2_t, d ), H5T_NATIVE_DOUBLE ); + write_dset(gid3,1,dims4,"dset8",tid,data8); + H5Tclose(tid); + + /* case of compound with different number of members */ + type_size = sizeof( cmp3_t ); + tid = H5Tcreate (H5T_COMPOUND, type_size ); + H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT ); + write_dset(gid3,1,dims4,"dset9",tid,NULL); + H5Tclose(tid); } |