diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2011-04-20 20:51:22 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2011-04-20 20:51:22 (GMT) |
commit | 614e46f270a2acc01a9d15c456420320f207086b (patch) | |
tree | 284b19d2abb4231f366169835d2965a653de7f93 /tools/h5dump/h5dumpgentest.c | |
parent | 27be7d1e2d95618c72bbefbed54e644b3b2d21ae (diff) | |
download | hdf5-614e46f270a2acc01a9d15c456420320f207086b.zip hdf5-614e46f270a2acc01a9d15c456420320f207086b.tar.gz hdf5-614e46f270a2acc01a9d15c456420320f207086b.tar.bz2 |
[svn-r20577] Bug 1386 - allowing dimension size to be zero. I added test cases in the tests for h5dump and h5diff. I also added the
test cases in the CMAKE script.
Tested on jam, linew, and amani. Tested CMAKE on jam.
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index ebdff41..d2af91c 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -96,6 +96,7 @@ #define FILE64 "tattrreg.h5" #define FILE65 "file_space.h5" #define FILE66 "packedbits.h5" +#define FILE67 "zerodim.h5" @@ -177,6 +178,11 @@ const H5L_class_t UD_link_class[1] = {{ #define CDIM2 DIM2/2 #define RANK 2 +/* Dataspace of 0 dimension size */ +#define SPACE3_RANK 2 +#define SPACE3_DIM1 0 +#define SPACE3_DIM2 0 + /* Element selection information */ #define POINT1_NPOINTS 10 @@ -5103,7 +5109,41 @@ static void gent_null_space(void) H5Fclose(fid); } +/*------------------------------------------------------------------------- + * Function: gent_zero_dim_size + * + * Purpose: generates dataset and attribute with dataspace of 0 dimension size + *------------------------------------------------------------------------- + */ +static void gent_zero_dim_size(void) +{ + hid_t fid, root, dataset, space, attr; + hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2}; + int dset_buf = 10; + int point = 4; + + fid = H5Fcreate(FILE67, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + root = H5Gopen2(fid, "/", H5P_DEFAULT); + + /* dataspace of 0 dimension size */ + space = H5Screate_simple(SPACE3_RANK, dims1, NULL); + /* dataset */ + dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); + /* nothing should be written */ + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf); + + /* attribute */ + attr = H5Acreate2(root, "attr of 0 dimension size", H5T_NATIVE_UINT, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_INT, &point); /* Nothing can be written */ + + H5Dclose(dataset); + H5Aclose(attr); + H5Gclose(root); + H5Sclose(space); + H5Fclose(fid); +} /*------------------------------------------------------------------------- * Function: make_dset @@ -7144,6 +7184,7 @@ int main(void) gent_compound_complex(); gent_named_dtype_attr(); gent_null_space(); + gent_zero_dim_size(); gent_filters(); gent_fvalues(); |