diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-07-10 20:16:42 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-07-10 20:16:42 (GMT) |
commit | 0f6a8fbaad992aa3392889042fb6ba828fbde15e (patch) | |
tree | a3b5793aaae719bf72557c8a0330c56d55e553df /test | |
parent | 6b269cb0d74bf72b392129d50b2a819712de8218 (diff) | |
download | hdf5-0f6a8fbaad992aa3392889042fb6ba828fbde15e.zip hdf5-0f6a8fbaad992aa3392889042fb6ba828fbde15e.tar.gz hdf5-0f6a8fbaad992aa3392889042fb6ba828fbde15e.tar.bz2 |
[svn-r4177] Purpose:
Bug fix
Description:
Accommodate v1.2.x behavior when --enable-hdf5v1_2 is enabled.
Platforms tested:
FreeBSD 4.3 (hawkwind)
Diffstat (limited to 'test')
-rw-r--r-- | test/tarray.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/test/tarray.c b/test/tarray.c index 7a1f27b..4175d9f 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -710,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 */ @@ -770,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 */ @@ -888,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"); @@ -920,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); @@ -940,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"); @@ -951,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 */ @@ -1831,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 */ @@ -2014,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"); @@ -2050,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); @@ -2064,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"); @@ -2100,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); |