diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-07-10 20:18:52 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-07-10 20:18:52 (GMT) |
commit | 0c1c23245d103927c5d59c67b84526974e6217af (patch) | |
tree | eeaa0829d0ba6a98a91f5c1e224f91a049b54d99 /test/tarray.c | |
parent | d7bb1d0c0752461dc0e4316c85c72867490b8532 (diff) | |
download | hdf5-0c1c23245d103927c5d59c67b84526974e6217af.zip hdf5-0c1c23245d103927c5d59c67b84526974e6217af.tar.gz hdf5-0c1c23245d103927c5d59c67b84526974e6217af.tar.bz2 |
[svn-r4180] Purpose:
Documentation
Description:
Accommodate v1.2.x behavior when --enable-hdf5v1_2 is enabled.
Platforms tested:
FreeBSD 4.3 (hawkwind)
Diffstat (limited to 'test/tarray.c')
-rw-r--r-- | test/tarray.c | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/test/tarray.c b/test/tarray.c index bb59d72..4175d9f 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -21,6 +21,7 @@ *************************************************************/ #include "testhdf5.h" + #include "hdf5.h" #define FILENAME "tarray1.h5" @@ -709,11 +710,13 @@ test_array_compound_array(void) hsize_t sdims1[] = {SPACE1_DIM1}; hsize_t tdims1[] = {ARRAY1_DIM1}; #ifdef WANT_H5_V1_2_COMPAT + size_t msize; size_t otdims1[] = {ARRAY1_DIM1}; #endif /* WANT_H5_V1_2_COMPAT */ int ndims; /* Array rank for reading */ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ #ifdef WANT_H5_V1_2_COMPAT + size_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */ size_t ordims1[H5S_MAX_RANK]; /* Array dimensions for reading */ #endif /* WANT_H5_V1_2_COMPAT */ int nmemb; /* Number of compound members */ @@ -769,7 +772,7 @@ test_array_compound_array(void) /* Compatibility code to verify that the old API functions are still working */ #ifdef WANT_H5_V1_2_COMPAT - /* Insert float array field */ + /* Insert double array field */ ret = H5Tinsert_array (tid2, "d", HOFFSET(s1_t,d), ARRAY1_RANK,otdims1,NULL,H5T_NATIVE_DOUBLE); CHECK(ret, FAIL, "H5Tinsert_array"); #endif /* WANT_H5_V1_2_COMPAT */ @@ -887,6 +890,29 @@ test_array_compound_array(void) mtid=H5Tget_member_type(tid2,1); CHECK(mtid, FAIL, "H5Tget_member_type"); +#ifdef WANT_H5_V1_2_COMPAT + /* H5Tget_member_type() returns the base type in v1.2 */ + /* Get the 2nd field's class */ + mclass=H5Tget_class(mtid); + VERIFY(mclass, H5T_FLOAT, "H5Tget_class"); + + /* Get the 2nd field's size */ + msize=H5Tget_size(mtid); + VERIFY(msize, sizeof(float), "H5Tget_size"); + + /* Get the array dimensions */ + ndims=H5Tget_member_dims(tid2,1,rdims2,NULL); + VERIFY(ndims, ARRAY1_RANK, "H5Tget_member_dims"); + VERIFY(rdims2[0], ARRAY1_DIM1, "H5Tget_member_dims"); + + /* Check the array dimensions */ + for(i=0; i<ndims; i++) + if(rdims2[i]!=tdims1[i]) { + num_errs++; + printf("Nested array dimension information doesn't match!, rdims2[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims2[i],(int)i,(int)tdims1[i]); + continue; + } /* end if */ +#else /* WANT_H5_V1_2_COMPAT */ /* Get the 2nd field's class */ mclass=H5Tget_class(mtid); VERIFY(mclass, H5T_ARRAY, "H5Tget_class"); @@ -919,6 +945,7 @@ test_array_compound_array(void) /* Close the array's base type datatype */ ret=H5Tclose(tid3); CHECK(mtid, FAIL, "H5Tclose"); +#endif /* WANT_H5_V1_2_COMPAT */ /* Close the member datatype */ ret=H5Tclose(mtid); @@ -939,6 +966,19 @@ test_array_compound_array(void) off=H5Tget_member_offset(tid2,2); VERIFY(off, HOFFSET(s1_t,d), "H5Tget_member_offset"); + /* Check the 2nd field's datatype */ + mtid=H5Tget_member_type(tid2,2); + CHECK(mtid, FAIL, "H5Tget_member_type"); + + /* H5Tget_member_type() returns the base type in v1.2 */ + /* Get the 3rd field's class */ + mclass=H5Tget_class(mtid); + VERIFY(mclass, H5T_FLOAT, "H5Tget_class"); + + /* Get the 3rd field's size */ + msize=H5Tget_size(mtid); + VERIFY(msize, sizeof(double), "H5Tget_size"); + /* Check the array rank */ ndims=H5Tget_member_dims(tid2,2,ordims1,NULL); VERIFY(ndims,ARRAY1_RANK,"H5Tget_member_dims"); @@ -950,6 +990,11 @@ test_array_compound_array(void) printf("Nested array dimension information doesn't match!, ordims1[%d]=%d, otdims1[%d]=%d\n",(int)i,(int)ordims1[i],(int)i,(int)otdims1[i]); continue; } /* end if */ + + /* Close the member datatype */ + ret=H5Tclose(mtid); + CHECK(mtid, FAIL, "H5Tclose"); + #endif /* WANT_H5_V1_2_COMPAT */ /* Close Compound Datatype */ @@ -1830,16 +1875,20 @@ test_compat(void) hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ hid_t tid1; /* Array Datatype ID */ +#ifndef WANT_H5_V1_2_COMPAT hid_t tid2; /* Datatype ID */ hsize_t tdims1[] = {ARRAY1_DIM1}; int ndims; /* Array rank for reading */ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ +#endif /* !WANT_H5_V1_2_COMPAT */ H5T_class_t mclass; /* Datatype class for VL */ int nmemb; /* Number of compound members */ char *mname; /* Name of compound field */ size_t off; /* Offset of compound field */ hid_t mtid; /* Datatype ID for field */ +#ifndef WANT_H5_V1_2_COMPAT intn i; /* Index variables */ +#endif /* !WANT_H5_V1_2_COMPAT */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -2013,6 +2062,7 @@ test_compat(void) off=H5Tget_member_offset(tid1,1); VERIFY(off, 4, "H5Tget_member_offset"); +#ifndef WANT_H5_V1_2_COMPAT /* Check the 2nd field's datatype */ mtid=H5Tget_member_type(tid1,1); CHECK(mtid, FAIL, "H5Tget_member_type"); @@ -2049,6 +2099,7 @@ test_compat(void) CHECK(ret, FAIL, "H5Tclose"); ret=H5Tclose(mtid); CHECK(ret, FAIL, "H5Tclose"); +#endif /* !WANT_H5_V1_2_COMPAT */ /* Check the 3rd field's name */ mname=H5Tget_member_name(tid1,2); @@ -2063,6 +2114,7 @@ test_compat(void) off=H5Tget_member_offset(tid1,2); VERIFY(off, 20, "H5Tget_member_offset"); +#ifndef WANT_H5_V1_2_COMPAT /* Check the 3rd field's datatype */ mtid=H5Tget_member_type(tid1,2); CHECK(mtid, FAIL, "H5Tget_member_type"); @@ -2099,6 +2151,7 @@ test_compat(void) CHECK(ret, FAIL, "H5Tclose"); ret=H5Tclose(mtid); CHECK(ret, FAIL, "H5Tclose"); +#endif /* !WANT_H5_V1_2_COMPAT */ /* Check the 4th field's name */ mname=H5Tget_member_name(tid1,3); |