diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-04-22 22:42:22 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-04-22 22:42:22 (GMT) |
commit | d490c837eb601c4a7eee8fba62ce8ba9adb0e9a1 (patch) | |
tree | 604b7e94e35625072c61f2a286862f779dba93c6 /c++/test/ttypes.cpp | |
parent | 58803d08320c0f704bc4cca600e9701572ddc1b4 (diff) | |
download | hdf5-d490c837eb601c4a7eee8fba62ce8ba9adb0e9a1.zip hdf5-d490c837eb601c4a7eee8fba62ce8ba9adb0e9a1.tar.gz hdf5-d490c837eb601c4a7eee8fba62ce8ba9adb0e9a1.tar.bz2 |
[svn-r29769] Purpose: Code improvements
Description:
- Changed object in catch statements to reference
- Replaced old-style casts or reinterpret_cast with static_cast
- Removed unused name H5Library::need_cleanup
- Removed Exception::printError from documentation
Merged from trunk r29759 and r29766
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 (platypus)
Darwin (osx1010test)
Diffstat (limited to 'c++/test/ttypes.cpp')
-rw-r--r-- | c++/test/ttypes.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 3139551..217b7b9 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -122,7 +122,8 @@ static void test_classes() } PASSED(); } // end of try block - catch (Exception E) { + catch (Exception& E) + { issue_fail_msg("test_classes", __LINE__, __FILE__, E.getCDetailMsg()); } } @@ -177,7 +178,8 @@ static void test_copy() PASSED(); } - catch (Exception E) { + catch (Exception& E) + { issue_fail_msg("test_copy", __LINE__, __FILE__, E.getCDetailMsg()); } } @@ -288,7 +290,8 @@ static void test_query() PASSED(); } // end of try block - catch (Exception E) { + catch (Exception& E) + { issue_fail_msg("test_query", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_query @@ -331,7 +334,7 @@ static void test_transient () Attribute attr(type.createAttribute("attr1", PredType::NATIVE_INT, space)); // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5Object::createAttribute", "Attempted to commit a predefined datatype."); - } catch (AttributeIException err) {} // do nothing, failure expected + } catch (AttributeIException& err) {} // do nothing, failure expected // Create a dataset from a transient datatype // type.close(); - put trace in H5Tclose to make sure it's closed @@ -345,7 +348,7 @@ static void test_transient () // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("PredType::setPrecision", "Dataset datatypes should not be modifiable!"); - } catch (DataTypeIException err) {} + } catch (DataTypeIException& err) {} itype.close(); // Get a copy of the dataset's datatype by applying DataType::copy() @@ -366,7 +369,8 @@ static void test_transient () space.close(); PASSED(); } // end of try block - catch (Exception E) { + catch (Exception& E) + { issue_fail_msg("test_transient", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_transient @@ -411,7 +415,7 @@ static void test_named () // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("PredType::commit", "Attempted to commit a predefined datatype."); - } catch (DataTypeIException err) {} + } catch (DataTypeIException& err) {} // Copy a predefined datatype and commit the copy. IntType itype(PredType::NATIVE_INT); @@ -430,7 +434,8 @@ static void test_named () // no matching prototype atype.commit(const_grp, "random uchar"); } // end of try block - catch (Exception E) { + catch (Exception& E) + { issue_fail_msg("test_named", __LINE__, __FILE__, "Commit at const group"); } @@ -444,7 +449,7 @@ static void test_named () // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("IntType::setPrecision", "Attempted to modify a committed datatype."); - } catch (DataTypeIException err) {} + } catch (DataTypeIException& err) {} // We should not be able to re-commit a committed type try { @@ -452,7 +457,7 @@ static void test_named () // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("IntType::commit", "Attempted to re-commit a committed datatype."); - } catch (DataTypeIException err) {} // do nothing, failure expected + } catch (DataTypeIException& err) {} // do nothing, failure expected // It should be possible to define an attribute for the named type Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space); @@ -526,7 +531,8 @@ static void test_named () file.close(); PASSED(); } // end of try block - catch (Exception E) { + catch (Exception& E) + { issue_fail_msg("test_named", __LINE__, __FILE__, E.getCDetailMsg()); } |