diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2018-07-17 14:12:10 (GMT) |
---|---|---|
committer | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2018-07-26 22:20:20 (GMT) |
commit | 622806b89dcc305e1744985763e6293d85497ffa (patch) | |
tree | 91a7fca02ee90362adf0803b9cad44e28163c5a0 /c++/test/trefer.cpp | |
parent | edeac9f067b462e4d7dc8c43413b34c94865e5d4 (diff) | |
download | hdf5-622806b89dcc305e1744985763e6293d85497ffa.zip hdf5-622806b89dcc305e1744985763e6293d85497ffa.tar.gz hdf5-622806b89dcc305e1744985763e6293d85497ffa.tar.bz2 |
Fixed HDFFV-10458 partially
Description:
Added wrappers for H5Oget_info_by_idx2.
// Returns information about an HDF5 object, given its index.
void getInfo(const char* grp_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo,
unsigned fields = H5O_INFO_BASIC,
const LinkAccPropList& lapl = LinkAccPropList::DEFAULT)
void getInfo(const H5std_string& grp_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo,
unsigned fields = H5O_INFO_BASIC,
const LinkAccPropList& lapl = LinkAccPropList::DEFAULT)
Platforms tested:
Linux/64 (jelly)
Linux/32 (jam)
Darwin (osx1010test)
Diffstat (limited to 'c++/test/trefer.cpp')
-rw-r--r-- | c++/test/trefer.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index bb09616..fa214df 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -481,6 +481,21 @@ static void test_reference_group() fname = group.getFileName(); verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); + // Check object type using Group::getInfo() + H5O_info_t oinfo; + HDmemset(&oinfo, 0, sizeof(oinfo)); + group.getInfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, oinfo); + verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getInfo",__LINE__,__FILE__); + + // Check for out of bound query by index + try { + HDmemset(&oinfo, 0, sizeof(oinfo)); + group.getInfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)9, oinfo); + + // Should FAIL but didn't, so throw an invalid action exception + throw InvalidActionException("Group::getInfo", "Out of bound index."); + } catch (Exception& err) {} // do nothing, failure expected + // Unlink one of the objects in the dereferenced group, and re-check refgroup.unlink(GROUPNAME2); nobjs = refgroup.getNumObjs(); |