summaryrefslogtreecommitdiffstats
path: root/test/dtypes.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2009-12-09 17:06:02 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2009-12-09 17:06:02 (GMT)
commit58c8ac33a81b6feed41bab0db6ac3d7dbe98a9be (patch)
treec38aa744dc9a7f268c90fce1d81f97c8d84461d7 /test/dtypes.c
parent94a00c768c32a49100d499e90a83e73d11a3ac12 (diff)
downloadhdf5-58c8ac33a81b6feed41bab0db6ac3d7dbe98a9be.zip
hdf5-58c8ac33a81b6feed41bab0db6ac3d7dbe98a9be.tar.gz
hdf5-58c8ac33a81b6feed41bab0db6ac3d7dbe98a9be.tar.bz2
[svn-r17977] Bug fix for 1584. H5Tdetect_class said a VL string is a string type. But when it's in a
compound type, it says it's a VL type. We want to tell user a VL string is a string. But internally we treat it as a VL type. I added a flag as a parameter of H5T_detect_class. It tells whether the caller is the public function H5Tdetect_class. I also added a detection for VL string in the private function for the compound case (or array or nested VL type). Tested on jam and amani - I tested the same change for 1.8 with h5committest.
Diffstat (limited to 'test/dtypes.c')
-rw-r--r--test/dtypes.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index 2619f1b..d2db20b 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -325,7 +325,10 @@ test_copy(void)
* Saturday, August 30, 2003
*
* Modifications:
- *
+ * Raymond Lu
+ * 8 December 2009
+ * I added a field of VL string in the compound type to test
+ * H5Tdetect_class correctly detect it as string type.
*-------------------------------------------------------------------------
*/
static int
@@ -342,6 +345,7 @@ test_detect(void)
hobj_ref_t arr_r[3][3];
int i;
hvl_t vl_f;
+ hvl_t vl_s;
char c;
short s;
};
@@ -441,6 +445,7 @@ test_detect(void)
if (H5Tinsert(cplx_cmpd_id, "arr_r", HOFFSET(struct complex, arr_r), atom_arr_id) < 0) TEST_ERROR
if (H5Tinsert(cplx_cmpd_id, "i", HOFFSET(struct complex, i), H5T_NATIVE_INT) < 0) TEST_ERROR
if (H5Tinsert(cplx_cmpd_id, "vl_f", HOFFSET(struct complex, vl_f), atom_vlf_id) < 0) TEST_ERROR
+ if (H5Tinsert(cplx_cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), atom_vls_id) < 0) TEST_ERROR
if (H5Tinsert(cplx_cmpd_id, "c", HOFFSET(struct complex, c), H5T_NATIVE_CHAR) < 0) TEST_ERROR
if (H5Tinsert(cplx_cmpd_id, "s", HOFFSET(struct complex, s), H5T_NATIVE_SHORT) < 0) TEST_ERROR
@@ -450,12 +455,12 @@ test_detect(void)
if(H5Tdetect_class(cplx_cmpd_id,H5T_REFERENCE)!=TRUE) TEST_ERROR
if(H5Tdetect_class(cplx_cmpd_id,H5T_INTEGER)!=TRUE) TEST_ERROR
if(H5Tdetect_class(cplx_cmpd_id,H5T_FLOAT)!=TRUE) TEST_ERROR
+ if(H5Tdetect_class(cplx_cmpd_id,H5T_STRING)!=TRUE) TEST_ERROR
if(H5Tdetect_class(cplx_cmpd_id,H5T_VLEN)!=TRUE) TEST_ERROR
/* Make certain that an incorrect class is not detected */
if(H5Tdetect_class(cplx_cmpd_id,H5T_TIME)!=FALSE) TEST_ERROR
if(H5Tdetect_class(cplx_cmpd_id,H5T_ENUM)!=FALSE) TEST_ERROR
- if(H5Tdetect_class(cplx_cmpd_id,H5T_STRING)!=FALSE) TEST_ERROR
/* Close complex compound datatype */
if(H5Tclose(cplx_cmpd_id) < 0) TEST_ERROR