diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-07-09 15:14:53 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-07-09 15:14:53 (GMT) |
commit | 6baa1ca5d29fbb877ec8b9a9f193bb5ec1515636 (patch) | |
tree | 9d0f1777c48db334f87409ed23fa8ce9eb4b77a3 /tools/h5dump/h5dumpgentest.c | |
parent | fc30490143366c4558e239d3e70d266760e9a0be (diff) | |
download | hdf5-6baa1ca5d29fbb877ec8b9a9f193bb5ec1515636.zip hdf5-6baa1ca5d29fbb877ec8b9a9f193bb5ec1515636.tar.gz hdf5-6baa1ca5d29fbb877ec8b9a9f193bb5ec1515636.tar.bz2 |
[svn-r8852] Purpose:
h5dump new tests
Description:
added new tests for the print of array indices (nested objects, several ranks)
Solution:
Platforms tested:
linux
AIX
solaris
Misc. update:
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 105 |
1 files changed, 80 insertions, 25 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 9e90aec..bc84d08 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -79,6 +79,7 @@ #define FILE47 "tfcontents2.h5" #define FILE48 "tfvalues.h5" #define FILE49 "tstr3.h5" +#define FILE50 "taindices.h5" @@ -4499,24 +4500,15 @@ static void gent_filters(void) unsigned szip_pixels_per_block=4; #endif hsize_t dims1[RANK] = {DIM1,DIM2}; - hsize_t dims3[3] = {2,2,100}; hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; int buf1[DIM1][DIM2]; - int buf3[2][2][100]; - int i, j, k, n, ret; + int i, j, n, ret; for (i=n=0; i<DIM1; i++){ for (j=0; j<DIM2; j++){ buf1[i][j]=n++; } } - for (i=n=0; i<2; i++){ - for (j=0; j<2; j++){ - for (k=0; k<100; k++){ - buf3[i][j][k]=n++; - } - } - } /* create a file */ fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -4750,12 +4742,6 @@ static void gent_filters(void) ret=H5Tclose(tid); assert(ret>=0); - -/*------------------------------------------------------------------------- - * a large 3D dataset - *------------------------------------------------------------------------- - */ - write_dset(fid,3,dims3,"3d",H5T_NATIVE_INT,buf3); /*------------------------------------------------------------------------- * close @@ -4828,13 +4814,6 @@ set_local_myfilter(hid_t dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id) * *------------------------------------------------------------------------- */ -/*------------------------------------------------------------------------- - * Function: gent_fcontents - * - * Purpose: generate several files to list its contents - * - *------------------------------------------------------------------------- - */ static void gent_fcontents(void) { hid_t fid; /* file id */ @@ -5206,6 +5185,80 @@ static void gent_string(void) } +/*------------------------------------------------------------------------- + * Function: gent_aindices + * + * Purpose: make several datasets for the array indices tests + * + *------------------------------------------------------------------------- + */ +static void gent_aindices(void) +{ + hid_t fid; /* file id */ + hid_t gid[6]; /* group ids */ + hsize_t dims1[1] = {100}; + hsize_t dims2[2] = {2,100}; + hsize_t dims3[3] = {2,2,100}; + int buf1[100]; + int buf2[2][100]; + int buf3[2][2][100]; + int i, j, k, n, ret; + + for (i=n=0; i<100; i++){ + buf1[i]=n++; + } + + for (i=n=0; i<2; i++){ + for (j=0; j<100; j++){ + buf2[i][j]=n++; + } + } + for (i=n=0; i<2; i++){ + for (j=0; j<2; j++){ + for (k=0; k<100; k++){ + buf3[i][j][k]=n++; + } + } + } + + /* create a file */ + fid = H5Fcreate(FILE50, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + assert(fid>=0); + +/*------------------------------------------------------------------------- + * root datasets + *------------------------------------------------------------------------- + */ + write_dset(fid,1,dims1,"1d",H5T_NATIVE_INT,buf1); + write_dset(fid,2,dims2,"2d",H5T_NATIVE_INT,buf2); + write_dset(fid,3,dims3,"3d",H5T_NATIVE_INT,buf3); + +/*------------------------------------------------------------------------- + * test with group indentation + *------------------------------------------------------------------------- + */ + gid[0] = H5Gcreate (fid, "/g1", 0); + gid[1] = H5Gcreate (fid, "g1/g2", 0); + gid[2] = H5Gcreate (fid, "g1/g2/g3", 0); + gid[3] = H5Gcreate (fid, "g1/g2/g3/g4", 0); + gid[4] = H5Gcreate (fid, "g1/g2/g3/g4/g5", 0); + gid[5] = H5Gcreate (fid, "g1/g2/g3/g4/g5/g6", 0); + write_dset(gid[5],1,dims1,"1d",H5T_NATIVE_INT,buf1); + write_dset(gid[5],2,dims2,"2d",H5T_NATIVE_INT,buf2); + write_dset(gid[5],3,dims3,"3d",H5T_NATIVE_INT,buf3); + for (i=0; i<6; i++) + H5Gclose(gid[i]); + +/*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + ret=H5Fclose(fid); + assert(ret>=0); +} + + + /*------------------------------------------------------------------------- * Function: main @@ -5259,11 +5312,13 @@ int main(void) gent_attr_all(); gent_compound_complex(); gent_named_dtype_attr(); - gent_filters(); gent_null_space(); - gent_fcontents(); + + gent_filters(); gent_fvalues(); + gent_fcontents(); gent_string(); + gent_aindices(); return 0; } |