diff options
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index fc75681..4d811ee 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -91,6 +91,7 @@ #define FILE61 "textlinksrc.h5" #define FILE62 "textlinktar.h5" #define FILE63 "textlinkfar.h5" +#define FILE64 "tarray8.h5" @@ -2812,6 +2813,51 @@ static void gent_array7(void) assert(ret >= 0); } +static void gent_array8(void) +{ + double *buf; /* information to write */ + hid_t fid; /* HDF5 File IDs */ + hid_t did; /* dataset ID */ + hid_t sid; /* dataspace ID */ + hid_t tid; /* datatype ID */ + size_t size; + hsize_t sdims[] = {1}; + hsize_t tdims[] = {H5TOOLS_BUFSIZE / sizeof(double) + 1}; + int i; + herr_t ret; + + size = ( H5TOOLS_BUFSIZE / sizeof(double) + 1 ) * sizeof(double); + buf = malloc( size ); + + for( i = 0; i < H5TOOLS_BUFSIZE / sizeof(double) + 1; i++) + buf[i] = i; + + /* create file */ + fid = H5Fcreate(FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* create a type larger than H5TOOLS_BUFSIZE */ + tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims); + size = H5Tget_size(tid); + sid = H5Screate_simple(1, sdims, NULL); + did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); +#if defined(WRITE_ARRAY) + ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + assert(ret >= 0); +#endif + + /* close */ + ret = H5Dclose(did); + assert(ret >= 0); + ret = H5Tclose(tid); + assert(ret >= 0); + ret = H5Sclose(sid); + assert(ret >= 0); + + ret = H5Fclose(fid); + assert(ret >= 0); + free( buf ); +} + static void gent_empty(void) { typedef struct { @@ -6330,6 +6376,7 @@ int main(void) gent_attr_creation_order(); gent_fpformat(); gent_extlinks(); + gent_array8(); return 0; |