@@ -179,9 +179,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2
179
179
static int test_enums (const char * fname );
180
180
static void test_comps_array (const char * fname , const char * dset , const char * attr , int diff ,
181
181
int is_file_new );
182
- static void test_comps_vlen (const char * fname , const char * dset , int diff , int is_file_new );
183
- static void test_comps_array_vlen (const char * fname , const char * dset , int diff , int is_file_new );
184
- static void test_comps_vlen_arry (const char * fname , const char * dset , int diff , int is_file_new );
182
+ static void test_comps_vlen (const char * fname , const char * dset , const char * attr , int diff , int is_file_new );
183
+ static void test_comps_array_vlen (const char * fname , const char * dset , const char * attr , int diff , int is_file_new );
184
+ static void test_comps_vlen_arry (const char * fname , const char * dset , const char * attr , int diff , int is_file_new );
185
185
static void test_data_nocomparables (const char * fname , int diff );
186
186
static void test_objs_nocomparables (const char * fname1 , const char * fname2 );
187
187
static void test_objs_strings (const char * fname , const char * fname2 );
@@ -287,14 +287,14 @@ main(void)
287
287
*/
288
288
/* file1 */
289
289
test_comps_array (COMPS_COMPLEX1 , "dset1" , "attr1" , 0 , 1 );
290
- test_comps_vlen (COMPS_COMPLEX1 , "dset2" , 0 , 0 );
291
- test_comps_array_vlen (COMPS_COMPLEX1 , "dset3" , 0 , 0 );
292
- test_comps_vlen_arry (COMPS_COMPLEX1 , "dset4" , 0 , 0 );
290
+ test_comps_vlen (COMPS_COMPLEX1 , "dset2" , "attr2" , 0 , 0 );
291
+ test_comps_array_vlen (COMPS_COMPLEX1 , "dset3" , "attr3" , 0 , 0 );
292
+ test_comps_vlen_arry (COMPS_COMPLEX1 , "dset4" , "attr4" , 0 , 0 );
293
293
/* file2 */
294
294
test_comps_array (COMPS_COMPLEX2 , "dset1" , "attr1" , 5 , 1 );
295
- test_comps_vlen (COMPS_COMPLEX2 , "dset2" , 5 , 0 );
296
- test_comps_array_vlen (COMPS_COMPLEX2 , "dset3" , 5 , 0 );
297
- test_comps_vlen_arry (COMPS_COMPLEX2 , "dset4" , 5 , 0 );
295
+ test_comps_vlen (COMPS_COMPLEX2 , "dset2" , "attr2" , 5 , 0 );
296
+ test_comps_array_vlen (COMPS_COMPLEX2 , "dset3" , "attr3" , 5 , 0 );
297
+ test_comps_vlen_arry (COMPS_COMPLEX2 , "dset4" , "attr4" , 5 , 0 );
298
298
299
299
/*-------------------------------------------------
300
300
* Create test files with non-comparable dataset and attributes with
@@ -4966,7 +4966,7 @@ test_comps_array(const char *fname, const char *dset, const char *attr, int diff
4966
4966
}
4967
4967
4968
4968
static void
4969
- test_comps_vlen (const char * fname , const char * dset , int diff , int is_file_new )
4969
+ test_comps_vlen (const char * fname , const char * dset , const char * attr , int diff , int is_file_new )
4970
4970
{
4971
4971
/* sub compound 2 */
4972
4972
typedef struct {
@@ -4985,6 +4985,7 @@ test_comps_vlen(const char *fname, const char *dset, int diff, int is_file_new)
4985
4985
hid_t fid = H5I_INVALID_HID ; /* HDF5 File ID */
4986
4986
hid_t did_dset = H5I_INVALID_HID ; /* dataset ID */
4987
4987
hid_t sid_dset = H5I_INVALID_HID ; /* dataset space ID */
4988
+ hid_t tid_attr = H5I_INVALID_HID ; /* attribute ID */
4988
4989
hid_t tid_cmpd2 = H5I_INVALID_HID ; /* compound2 type ID */
4989
4990
hid_t tid_cmpd1 = H5I_INVALID_HID ; /* compound1 type ID */
4990
4991
hid_t tid_cmpd1_vlen = H5I_INVALID_HID ;
@@ -5047,12 +5048,22 @@ test_comps_vlen(const char *fname, const char *dset, int diff, int is_file_new)
5047
5048
ret = H5Dwrite (did_dset , tid_cmpd1 , H5S_ALL , H5S_ALL , H5P_DEFAULT , wdata );
5048
5049
assert (ret >= 0 );
5049
5050
5051
+ /*-----------------------------------
5052
+ * Create an attribute in root group
5053
+ */
5054
+ tid_attr = H5Acreate2 (fid , attr , tid_cmpd1 , sid_dset , H5P_DEFAULT , H5P_DEFAULT );
5055
+ assert (tid_attr > 0 );
5056
+ ret = H5Awrite (tid_attr , tid_cmpd1 , wdata );
5057
+ assert (ret >= 0 );
5058
+
5050
5059
/* Reclaim the write VL data */
5051
5060
ret = H5Treclaim (tid_cmpd1 , sid_dset , H5P_DEFAULT , wdata );
5052
5061
assert (ret >= 0 );
5053
5062
5054
5063
/* ----------------
5055
5064
* Close IDs */
5065
+ ret = H5Aclose (tid_attr );
5066
+ assert (ret >= 0 );
5056
5067
ret = H5Dclose (did_dset );
5057
5068
assert (ret >= 0 );
5058
5069
ret = H5Tclose (tid_cmpd2 );
@@ -5068,7 +5079,7 @@ test_comps_vlen(const char *fname, const char *dset, int diff, int is_file_new)
5068
5079
}
5069
5080
5070
5081
static void
5071
- test_comps_array_vlen (const char * fname , const char * dset , int diff , int is_file_new )
5082
+ test_comps_array_vlen (const char * fname , const char * dset , const char * attr , int diff , int is_file_new )
5072
5083
{
5073
5084
typedef struct {
5074
5085
int i3 ;
@@ -5089,6 +5100,7 @@ test_comps_array_vlen(const char *fname, const char *dset, int diff, int is_file
5089
5100
hid_t fid = H5I_INVALID_HID ; /* HDF5 File IDs */
5090
5101
hid_t did_dset = H5I_INVALID_HID ; /* Dataset ID */
5091
5102
hid_t sid_dset = H5I_INVALID_HID ; /* Dataspace ID */
5103
+ hid_t tid_attr = H5I_INVALID_HID ; /* Attribute ID */
5092
5104
hid_t tid_cmpd1 = H5I_INVALID_HID ; /* Compound1 Datatype ID */
5093
5105
hid_t tid_arry1 = H5I_INVALID_HID ; /* Array Datatype ID */
5094
5106
hid_t tid_cmpd2 = H5I_INVALID_HID ; /* Compound2 Datatype ID */
@@ -5169,12 +5181,22 @@ test_comps_array_vlen(const char *fname, const char *dset, int diff, int is_file
5169
5181
ret = H5Dwrite (did_dset , tid_cmpd1 , H5S_ALL , H5S_ALL , H5P_DEFAULT , wdata );
5170
5182
assert (ret >= 0 );
5171
5183
5184
+ /*-----------------------------------
5185
+ * Create an attribute in root group
5186
+ */
5187
+ tid_attr = H5Acreate2 (fid , attr , tid_cmpd1 , sid_dset , H5P_DEFAULT , H5P_DEFAULT );
5188
+ assert (tid_attr > 0 );
5189
+ ret = H5Awrite (tid_attr , tid_cmpd1 , wdata );
5190
+ assert (ret >= 0 );
5191
+
5172
5192
/* Reclaim the write VL data */
5173
5193
ret = H5Treclaim (tid_cmpd1 , sid_dset , H5P_DEFAULT , wdata );
5174
5194
assert (ret >= 0 );
5175
5195
5176
5196
/*-------------------
5177
5197
* Close IDs */
5198
+ ret = H5Aclose (tid_attr );
5199
+ assert (ret >= 0 );
5178
5200
ret = H5Tclose (tid_arry1 );
5179
5201
assert (ret >= 0 );
5180
5202
ret = H5Dclose (did_dset );
@@ -5194,7 +5216,7 @@ test_comps_array_vlen(const char *fname, const char *dset, int diff, int is_file
5194
5216
}
5195
5217
5196
5218
static void
5197
- test_comps_vlen_arry (const char * fname , const char * dset , int diff , int is_file_new )
5219
+ test_comps_vlen_arry (const char * fname , const char * dset , const char * attr , int diff , int is_file_new )
5198
5220
{
5199
5221
/* sub compound 3 */
5200
5222
typedef struct {
@@ -5219,6 +5241,7 @@ test_comps_vlen_arry(const char *fname, const char *dset, int diff, int is_file_
5219
5241
hid_t fid = H5I_INVALID_HID ; /* HDF5 File ID */
5220
5242
hid_t did_dset = H5I_INVALID_HID ; /* dataset ID */
5221
5243
hid_t sid_dset = H5I_INVALID_HID ; /* dataset space ID */
5244
+ hid_t tid_attr = H5I_INVALID_HID ; /* attribute ID */
5222
5245
hid_t tid_cmpd3 = H5I_INVALID_HID ; /* compound3 type ID */
5223
5246
hid_t tid_cmpd2 = H5I_INVALID_HID ; /* compound2 type ID */
5224
5247
hid_t tid_cmpd2_arry = H5I_INVALID_HID ;
@@ -5301,10 +5324,22 @@ test_comps_vlen_arry(const char *fname, const char *dset, int diff, int is_file_
5301
5324
ret = H5Dwrite (did_dset , tid_cmpd1 , H5S_ALL , H5S_ALL , H5P_DEFAULT , wdata );
5302
5325
assert (ret >= 0 );
5303
5326
5327
+ /*-----------------------------------
5328
+ * Create an attribute in root group
5329
+ */
5330
+ tid_attr = H5Acreate2 (fid , attr , tid_cmpd1 , sid_dset , H5P_DEFAULT , H5P_DEFAULT );
5331
+ assert (tid_attr > 0 );
5332
+ ret = H5Awrite (tid_attr , tid_cmpd1 , wdata );
5333
+ assert (ret >= 0 );
5334
+
5304
5335
/* Reclaim the write VL data */
5305
5336
ret = H5Treclaim (tid_cmpd1 , sid_dset , H5P_DEFAULT , wdata );
5306
5337
assert (ret >= 0 );
5307
5338
5339
+ /* ----------------
5340
+ * Close IDs */
5341
+ ret = H5Aclose (tid_attr );
5342
+ assert (ret >= 0 );
5308
5343
ret = H5Dclose (did_dset );
5309
5344
assert (ret >= 0 );
5310
5345
ret = H5Sclose (sid_dset );
0 commit comments