diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2018-07-17 14:12:10 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2018-07-17 14:12:10 (GMT) |
commit | 3aa24435180d10aeca6493f7c1b277cfd5c73fad (patch) | |
tree | 4b2a16506fd6b76f3c86d30c82f2d83a26b60869 /c++/test/dsets.cpp | |
parent | 944735221e3dc6545aca753b09041cef7ea09fb1 (diff) | |
download | hdf5-3aa24435180d10aeca6493f7c1b277cfd5c73fad.zip hdf5-3aa24435180d10aeca6493f7c1b277cfd5c73fad.tar.gz hdf5-3aa24435180d10aeca6493f7c1b277cfd5c73fad.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/dsets.cpp')
-rw-r--r-- | c++/test/dsets.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 250ce90..e86052b 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1116,6 +1116,67 @@ static herr_t test_types(H5File& file) /*------------------------------------------------------------------------- + * Function: test_getinfo + * + * Purpose Tests getInfo() + * + * Return Success: 0 + * + * Failure: -1 + * + * July, 2018 + *------------------------------------------------------------------------- + */ +static herr_t test_getinfo(H5File& file) +{ + SUBTEST("Getting object information"); + + try { + // Create a data space + hsize_t dims[2]; + dims[0] = 256; + dims[1] = 512; + DataSpace space (2, dims, NULL); + + // Create a dataset using the default dataset creation properties. + // We're not sure what they are, so we won't check. + DataSet dataset(file.openDataSet(DSET_CHUNKED_NAME)); + + // Get dataset header info + H5O_info_t oinfo; + HDmemset(&oinfo, 0, sizeof(oinfo)); + dataset.getInfo(oinfo, H5O_INFO_HDR); + verify_val(oinfo.hdr.nchunks, 1, "DataSet::getInfo", __LINE__, __FILE__); + dataset.close(); + + // Open the dataset we created above and then close it. This is one + // way to open an existing dataset for accessing. + dataset = file.openDataSet(DSET_DEFAULT_NAME); + HDmemset(&oinfo, 0, sizeof(oinfo)); + dataset.getInfo(oinfo, H5O_INFO_ALL); + verify_val(oinfo.hdr.nchunks, 1, "DataSet::getInfo", __LINE__, __FILE__); + dataset.close(); + + PASSED(); + return 0; + } // outer most try block + + catch (InvalidActionException& E) + { + cerr << " FAILED" << endl; + cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; + return -1; + } + // catch all other exceptions + catch (Exception& E) + { + issue_fail_msg("test_getinfo", __LINE__, __FILE__); + return -1; + } +} // test_getinfo + + +/*------------------------------------------------------------------------- * Function: test_virtual * * Purpose Tests fixed, unlimited, and printf selections in the same @@ -1237,6 +1298,7 @@ void test_dset() nerrors += test_create(file) < 0 ? 1:0; nerrors += test_simple_io(file) < 0 ? 1:0; + nerrors += test_getinfo(file) < 0 ? 1:0; nerrors += test_tconv(file) < 0 ? 1:0; nerrors += test_compression(file) < 0 ? 1:0; nerrors += test_nbit_compression(file) < 0 ? 1:0; |