summaryrefslogtreecommitdiffstats
path: root/test/dtypes.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-10-05 18:36:03 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-10-05 18:36:03 (GMT)
commitd595bab80e5932009c0ff626ddc75f1346fcef1e (patch)
treede9204ddd68494fe85e86ce36a5c576381c82bb5 /test/dtypes.c
parent7ba45c05b3e9345bc8d77a5d205bb41086b78f1e (diff)
downloadhdf5-d595bab80e5932009c0ff626ddc75f1346fcef1e.zip
hdf5-d595bab80e5932009c0ff626ddc75f1346fcef1e.tar.gz
hdf5-d595bab80e5932009c0ff626ddc75f1346fcef1e.tar.bz2
[svn-r9366]
Purpose: feature change Description: Prevent creating datatype of size 0. Platforms tested: fuss(simple change)
Diffstat (limited to 'test/dtypes.c')
-rw-r--r--test/dtypes.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index e07e200..6d67bf0 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -2098,8 +2098,12 @@ test_compound_12(void)
TESTING("adjust size of compound data types");
- /* Create the empty compound type */
- if ((complex_id = H5Tcreate(H5T_COMPOUND, 0))<0) goto error;
+ /* Create a compound type of minimal size */
+ if ((complex_id = H5Tcreate(H5T_COMPOUND, 1))<0) goto error;
+
+ /* Verify the size */
+ if((new_size=H5Tget_size(complex_id))<0) goto error;
+ if(new_size!=1) goto error;
/* Add a couple fields and adjust the size */
offset = size;
@@ -2128,9 +2132,14 @@ test_compound_12(void)
/* Tries to cut last member. Supposed to fail. */
size--;
H5E_BEGIN_TRY {
- H5Tset_size(complex_id, size);
+ ret = H5Tset_size(complex_id, size);
} H5E_END_TRY;
-
+ if(ret>=0) {
+ H5_FAILED();
+ puts(" Tries to cut off the last member. Should have failed.");
+ goto error;
+ }
+
if (H5Tclose (complex_id)<0) goto error;
PASSED();
return 0;