diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2003-05-29 21:53:46 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2003-05-29 21:53:46 (GMT) |
commit | 4eb8aa7d83874005717867ffc8374daa1ad0423b (patch) | |
tree | de4824e31a0db06f55a7a04824792b5f52da8669 /tools/h5diff/h5difftst.c | |
parent | f632b5dc37ff600fb29a00d292c5350364ad9244 (diff) | |
download | hdf5-4eb8aa7d83874005717867ffc8374daa1ad0423b.zip hdf5-4eb8aa7d83874005717867ffc8374daa1ad0423b.tar.gz hdf5-4eb8aa7d83874005717867ffc8374daa1ad0423b.tar.bz2 |
[svn-r6925] Purpose:
bug fix
Description:
the signed / unsigned comparison was not properly handled.
the fixtype function sets the sign for the memory type the same sign as found on disk
and the array_diff function only handled signed cases
Solution:
addded for each INTEGER size type an OR condition with the unsigned version
if the datatypes have different signs , comparison is NOT supported
Platforms tested:
Windows 2000 (octopus)
Linux 2.4 (rockaway)
SunOS 5.7 (arabica)
IRIX 6.5 (modi4)
Misc. update:
Diffstat (limited to 'tools/h5diff/h5difftst.c')
-rw-r--r-- | tools/h5diff/h5difftst.c | 72 |
1 files changed, 53 insertions, 19 deletions
diff --git a/tools/h5diff/h5difftst.c b/tools/h5diff/h5difftst.c index 844d534..968365b 100644 --- a/tools/h5diff/h5difftst.c +++ b/tools/h5diff/h5difftst.c @@ -17,19 +17,27 @@ #include "hdf5.h" +#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus +# undef __attribute__ +# define __attribute__(X) /*void*/ +# define UNUSED /*void*/ +#else +# define UNUSED __attribute__((unused)) +#endif + /* diff test*/ -int do_test_1(const char *file1, const char *file2); -int do_test_2(const char *file1, const char *file2); -int do_test_3(const char *file1, const char *file2); -int do_test_4(const char *file1, const char *file2); -int do_test_5(const char *file1, const char *file2); -int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, - hid_t type_id, void *buf ); +static int do_test_1(const char *file1, const char *file2); +static int do_test_2(const char *file1, const char *file2); +static int do_test_3(const char *file1, const char *file2); +static int do_test_4(const char *file1, const char *file2); +static int do_test_5(const char *file1, const char *file2); +static int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, + hid_t type_id, void *buf ); -int main(int argc, const char *argv[]) +int main(int UNUSED argc, const UNUSED char *argv[]) { do_test_1("file1.h5","file2.h5"); @@ -56,6 +64,7 @@ int main(int argc, const char *argv[]) *------------------------------------------------------------------------- */ +static int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t type_id, void *buf ) { @@ -317,14 +326,14 @@ int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, file1.h6 file2.h6 -/* +*/ /*------------------------------------------------------------------------- * Basic review tests *------------------------------------------------------------------------- */ - +static int do_test_1(const char *file1, const char *file2) { @@ -374,8 +383,8 @@ int do_test_1(const char *file1, const char *file2) * Compare different types: H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK *------------------------------------------------------------------------- */ - -int do_test_2(const char *file1, const char *file2) +static +int do_test_2(const char *file1, const char UNUSED *file2) { hid_t file1_id; @@ -447,8 +456,8 @@ int do_test_2(const char *file1, const char *file2) * H5T_ENUM, H5T_VLEN, H5T_ARRAY *------------------------------------------------------------------------- */ - -int do_test_3(const char *file1, const char *file2) +static +int do_test_3(const char *file1, const char UNUSED *file2) { hid_t file1_id; @@ -573,8 +582,8 @@ int do_test_3(const char *file1, const char *file2) * Dimension issues *------------------------------------------------------------------------- */ - -int do_test_4(const char *file1, const char *file2) +static +int do_test_4(const char *file1, const char UNUSED *file2) { hid_t file1_id; @@ -637,8 +646,8 @@ int do_test_4(const char *file1, const char *file2) * Datasets datatypes *------------------------------------------------------------------------- */ - -int do_test_5(const char *file1, const char *file2) +static +int do_test_5(const char *file1, const char UNUSED *file2) { hid_t file1_id; @@ -657,7 +666,16 @@ int do_test_5(const char *file1, const char *file2) double buf6a[3][2] = {{1,1},{1,1},{1,1}}; double buf6b[3][2] = {{1,1},{3,4},{5,6}}; - + /*unsigned/signed test + signed char -128 to 127 + unsigned char 0 to 255 + */ + char buf7a[3][2] = {{-1,-128},{-1,-1},{-1,-1}}; + unsigned char buf7b[3][2] = {{1,128},{1,1},{1,1}}; + unsigned char buf8a[3][2] = {{1,1},{1,1},{1,1}}; + unsigned char buf8b[3][2] = {{1,1},{3,4},{5,6}}; + + /*------------------------------------------------------------------------- * Create a file *------------------------------------------------------------------------- @@ -716,6 +734,22 @@ int do_test_5(const char *file1, const char *file2) write_dataset(file1_id,2,dims,"dset6b",H5T_NATIVE_DOUBLE,buf6b); /*------------------------------------------------------------------------- + * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR + *------------------------------------------------------------------------- + */ + + write_dataset(file1_id,2,dims,"dset7a",H5T_NATIVE_CHAR,buf7a); + write_dataset(file1_id,2,dims,"dset7b",H5T_NATIVE_UCHAR,buf7b); + +/*------------------------------------------------------------------------- + * H5T_NATIVE_UCHAR + *------------------------------------------------------------------------- + */ + + write_dataset(file1_id,2,dims,"dset8a",H5T_NATIVE_UCHAR,buf8a); + write_dataset(file1_id,2,dims,"dset8b",H5T_NATIVE_UCHAR,buf8b); + +/*------------------------------------------------------------------------- * Close *------------------------------------------------------------------------- */ |