diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2008-06-04 17:14:23 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2008-06-04 17:14:23 (GMT) |
commit | 018ba9a701cdc28e59256b5fdd3f03fa910b60f0 (patch) | |
tree | 76b57abef8e446dd1242cb8f2f689f859f753f69 /tools/h5diff | |
parent | 6e196a7b669ed5edeb3a1329e1cb158b8df75a95 (diff) | |
download | hdf5-018ba9a701cdc28e59256b5fdd3f03fa910b60f0.zip hdf5-018ba9a701cdc28e59256b5fdd3f03fa910b60f0.tar.gz hdf5-018ba9a701cdc28e59256b5fdd3f03fa910b60f0.tar.bz2 |
[svn-r15136] Purpose:
bug fixes.
Description:
Added code to create an empty hdf5 (named h5diff_empty.h5) in order to test
if h5diff compares correctly an empty hdf5 vs. a non-empty one.
Tested:
Tested in kagiso of h5diffgentest itself.
Verified by h5dump that h5diff_empty.h5 was indeed empty.
Then "h5diff h5diff_empty.h5 h5diff_basic1.h5" returned 0 (should have
returned non-zero).
Diffstat (limited to 'tools/h5diff')
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 2a95ce0..74b3aa2 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -40,6 +40,7 @@ #define FILE8 "h5diff_dset2.h5" #define FILE9 "h5diff_hyper1.h5" #define FILE10 "h5diff_hyper2.h5" +#define FILE11 "h5diff_empty.h5" #define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */ #define STR_SIZE 3 #define GBLL ((unsigned long_long) 1024 * 1024 *1024 ) @@ -71,7 +72,7 @@ const H5L_class_t UD_link_class[1] = {{ */ /* tests called in main() */ -static int test_basic(const char *fname1,const char *fname2); +static int test_basic(const char *fname1, const char *fname2, const char *fname3); static int test_types(const char *fname); static int test_datatypes(const char *fname); static int test_attributes(const char *fname,int make_diffs); @@ -96,7 +97,7 @@ static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t int main(void) { - if ( test_basic (FILE1,FILE2) < 0 ) + if (test_basic(FILE1, FILE2, FILE11) < 0 ) goto out; test_types (FILE3); @@ -122,20 +123,30 @@ out: /*------------------------------------------------------------------------- * Function: test_basic * - * Purpose: basic tests + * Purpose: Create basic test files, first two contains different data, the + * third one is just an empty file. * *------------------------------------------------------------------------- */ static -int test_basic(const char *fname1, - const char *fname2) +int test_basic(const char *fname1, const char *fname2, const char *fname3) { hid_t fid1, fid2; hid_t gid1, gid2, gid3; hsize_t dims1[1] = { 6 }; hsize_t dims2[2] = { 3,2 }; + /* create the empty file */ + if ((fid1=H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0){ + fprintf(stderr, "empty file (%s) creation failed.\n", fname3); + goto out; + } + if (H5Fclose(fid1) < 0){ + fprintf(stderr, "empty file (%s) close failed.\n", fname3); + goto out; + } + /*------------------------------------------------------------------------- * create two files *------------------------------------------------------------------------- |