diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2004-10-05 19:17:09 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2004-10-05 19:17:09 (GMT) |
commit | ae6956a76362d619f41318c19792a4e0c7b9d529 (patch) | |
tree | a307ad8c663e7ffaa2b2050c3e15f0dbaf7c1571 /test | |
parent | 1f8687691d6620473440d745ea6cbe9e16b3d3c1 (diff) | |
download | hdf5-ae6956a76362d619f41318c19792a4e0c7b9d529.zip hdf5-ae6956a76362d619f41318c19792a4e0c7b9d529.tar.gz hdf5-ae6956a76362d619f41318c19792a4e0c7b9d529.tar.bz2 |
[svn-r9367] Purpose: feature change
Description: Prevent create datatype of size 0
Platforms tested: heping(simple change)
Diffstat (limited to 'test')
-rw-r--r-- | test/dtypes.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/test/dtypes.c b/test/dtypes.c index 83e41ad..53b53ea 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -2063,38 +2063,47 @@ 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; + 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; - if((size+=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error; + size+=H5Tget_size(H5T_NATIVE_DOUBLE); if (H5Tset_size(complex_id, size)<0) goto error; if (H5Tinsert(complex_id, "real", offset, H5T_NATIVE_DOUBLE)<0) goto error; offset = size; - if((size+=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error; + size+=H5Tget_size(H5T_NATIVE_DOUBLE); if (H5Tset_size(complex_id, size)<0) goto error; if (H5Tinsert(complex_id, "imaginary", offset, H5T_NATIVE_DOUBLE)<0) goto error; /* Increase and decrease the size. */ - if((size+=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error; + size+=H5Tget_size(H5T_NATIVE_DOUBLE); if (H5Tset_size(complex_id, size)<0) goto error; - if((size-=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error; + size-=H5Tget_size(H5T_NATIVE_DOUBLE); if (H5Tset_size(complex_id, size)<0) goto error; /* Verify the size */ - if((new_size=H5Tget_size(complex_id))<0) goto error; + if((new_size=H5Tget_size(complex_id))==0) goto error; if(new_size!=size) goto error; /* 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; |