summaryrefslogtreecommitdiffstats
path: root/c++/test/titerate.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2017-09-12 19:46:06 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2017-09-12 19:46:06 (GMT)
commitc7b27a76749fa0c299fd33299ac59b36348ada5f (patch)
treefc76e85d0e10252df420cee6ecf7bcc74b288560 /c++/test/titerate.cpp
parentff2c10c3f0f2174545e608dfbf668a05ad8d0f10 (diff)
downloadhdf5-c7b27a76749fa0c299fd33299ac59b36348ada5f.zip
hdf5-c7b27a76749fa0c299fd33299ac59b36348ada5f.tar.gz
hdf5-c7b27a76749fa0c299fd33299ac59b36348ada5f.tar.bz2
New overloaded functions and tests
Description: - Added VarLenType::VarLenType(const DataType& base_type) - Marked VarLenType::VarLenType(const DataType* base_type) deprecated - Added a static wrapper for H5Tdetect_class for PredType static bool DataType::detectClass(const PredType& pred_type, ...) - Removed the deprecated function Exception::printError() from code - Miscellaneous improvements in comments - Added test functions test_detect_type_class() and test_vltype() Platforms tested: Linux/32 2.6 (jam) Linux/64 (jelly) Darwin (osx1010test)
Diffstat (limited to 'c++/test/titerate.cpp')
-rw-r--r--c++/test/titerate.cpp77
1 files changed, 23 insertions, 54 deletions
diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp
index f75d92e..5c760f3 100644
--- a/c++/test/titerate.cpp
+++ b/c++/test/titerate.cpp
@@ -12,8 +12,8 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*****************************************************************************
- FILE
- titerate.cpp - HDF5 C++ testing iterate related functionality
+ FILE
+ titerate.cpp - HDF5 C++ testing iterate related functionality
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
@@ -94,8 +94,7 @@ int iter_strcmp(const void *s1, const void *s2)
**
****************************************************************/
static herr_t
-liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info,
- void *op_data)
+liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data)
{
iter_info *info = (iter_info *)op_data;
static int count = 0;
@@ -208,7 +207,7 @@ static void test_iter_group(FileAccPropList& fapl)
H5std_string obj_name;
for (i = 0; i < nobjs; i++)
{
- //H5O_info_t oinfo; /* Object info */
+ //H5O_info_t oinfo; /* Object info */
obj_name = root_group.getObjnameByIdx(i);
//ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
@@ -380,23 +379,11 @@ void printelems(const Group& group, const H5std_string& dsname, const H5std_stri
a1.close();
}
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
- error.printError();
- }
-
- // catch failure caused by the Group operations
- catch( GroupIException error )
- {
- error.printError();
- }
-
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
- error.printError();
- }
+ // Catch all exceptions and rethrow so caller can handle
+ catch (Exception& E)
+ {
+ throw;
+ }
}
/*-------------------------------------------------------------------------
@@ -413,11 +400,11 @@ void printelems(const Group& group, const H5std_string& dsname, const H5std_stri
*/
static void test_HDFFV_9920()
{
- int attr_data[2] = { 100, 200};
- hsize_t dims[1] = { DIM1 };
-
- try
- {
+ int attr_data[2] = { 100, 200};
+ hsize_t dims[1] = { DIM1 };
+
+ try
+ {
// Create a new file and a group in it
H5File file( FILE_NAME, H5F_ACC_TRUNC );
@@ -448,31 +435,13 @@ static void test_HDFFV_9920()
printelems(file, FDATASET_NAME, FATTR_NAME);
printelems(gr1, GDATASET_NAME, GATTR_NAME);
- } // end of try block
-
- // catch failure caused by the H5File operations
- catch( DataSpaceIException error )
- {
- error.printError();
- }
-
- // catch failure caused by the H5File operations
- catch( AttributeIException error )
- {
- error.printError();
- }
-
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
- error.printError();
- }
-
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
- error.printError();
- }
+ } // end of try block
+
+ // Catch all failures for handling in the same way
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_HDFFV_9920()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
}
@@ -503,9 +472,9 @@ void test_iterate()
test_iter_group(fapl); // Test iterating groups
test_HDFFV_9920(); // Test the fix of HDFFV-9920
- //test_iter_attr(fapl); // Test iterating attributes
+ //test_iter_attr(fapl); // Test iterating attributes
-} // test_iterate
+} // test_iterate
/*-------------------------------------------------------------------------
* Function: cleanup_iterate