diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dsets.c | 11 | ||||
-rw-r--r-- | test/tattr.c | 62 |
2 files changed, 73 insertions, 0 deletions
diff --git a/test/dsets.c b/test/dsets.c index 74bb0c9..81d4b2c 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -5557,6 +5557,7 @@ test_filter_delete(hid_t file) hsize_t dims[2]={20,20}; /* dataspace dimensions */ hsize_t chunk_dims[2]={10,10}; /* chunk dimensions */ int nfilters; /* number of filters in DCPL */ + unsigned flags; /* flags for filter */ herr_t ret; /* generic return value */ int i; @@ -5597,6 +5598,16 @@ test_filter_delete(hid_t file) goto error; } + /* try to get the info for the deflate filter */ + H5E_BEGIN_TRY { + ret=H5Pget_filter_by_id2(dcpl1,H5Z_FILTER_DEFLATE,&flags,NULL,NULL,0,NULL,NULL); + } H5E_END_TRY; + if(ret >=0) { + H5_FAILED(); + printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); + goto error; + } /* end if */ + /* try to delete the deflate filter again */ H5E_BEGIN_TRY { ret=H5Premove_filter(dcpl1,H5Z_FILTER_DEFLATE); diff --git a/test/tattr.c b/test/tattr.c index 4b130e6..5501056 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -10145,6 +10145,66 @@ test_attr_bug5(hid_t fcpl, hid_t fapl) /**************************************************************** ** +** test_attr_bug6(): Test basic H5A (attribute) code. +** Tests if reading an empty attribute is OK. +** +****************************************************************/ +static void +test_attr_bug6(hid_t fcpl, hid_t fapl) +{ + hid_t fid; /* File ID */ + hid_t gid; /* Group ID */ + hid_t aid1, aid2; /* Attribute IDs */ + hid_t sid; /* Dataspace ID */ + hsize_t dims[ATTR1_RANK] = {ATTR1_DIM1}; /* Attribute dimensions */ + int intar[ATTR1_DIM1]; /* Data reading buffer */ + herr_t ret; /* Generic return status */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing that empty attribute can be read\n")); + + /* Create file */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Open root group */ + gid = H5Gopen2(fid, "/", H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); + + /* Create dataspace */ + sid = H5Screate_simple(1, dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + /* Create attribute on group */ + aid1 = H5Acreate2(gid, ATTR1_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid1, FAIL, "H5Acreate2"); + + ret = H5Aclose(aid1); + CHECK(ret, FAIL, "H5Aclose"); + + /* Open the attribute again */ + aid2 = H5Aopen(gid, ATTR1_NAME, H5P_DEFAULT); + CHECK(aid2, FAIL, "H5Aopen"); + + ret = H5Aread(aid2, H5T_NATIVE_INT, intar); + CHECK(ret, FAIL, "H5Aread"); + + /* Close IDs */ + ret = H5Aclose(aid2); + CHECK(ret, FAIL, "H5Aclose"); + + ret = H5Gclose(gid); + CHECK(ret, FAIL, "H5Gclose"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); +} + +/**************************************************************** +** ** test_attr(): Main H5A (attribute) testing routine. ** ****************************************************************/ @@ -10288,6 +10348,7 @@ test_attr(void) test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */ test_attr_bug4(my_fcpl, my_fapl); /* Test attributes on named datatypes */ test_attr_bug5(my_fcpl, my_fapl); /* Test opening/closing attributes through different file handles */ + test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */ } /* end for */ } /* end if */ else { @@ -10311,6 +10372,7 @@ test_attr(void) test_attr_bug3(fcpl, my_fapl); /* Test "self referential" attributes */ test_attr_bug4(fcpl, my_fapl); /* Test attributes on named datatypes */ test_attr_bug5(fcpl, my_fapl); /* Test opening/closing attributes through different file handles */ + test_attr_bug6(fcpl, my_fapl); /* Test reading empty attribute */ } /* end else */ } /* end for */ |