diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2005-01-16 15:23:34 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2005-01-16 15:23:34 (GMT) |
commit | dfd0b59ae63ee79c8c135d0c05fe65e77422701c (patch) | |
tree | 5ff50c1587a9053cc1283b826cdfb8a1b38f8090 /c++/test/h5cpputil.cpp | |
parent | 35985b6dbaad14e40146c0d1b04382a4f048e4d0 (diff) | |
download | hdf5-dfd0b59ae63ee79c8c135d0c05fe65e77422701c.zip hdf5-dfd0b59ae63ee79c8c135d0c05fe65e77422701c.tar.gz hdf5-dfd0b59ae63ee79c8c135d0c05fe65e77422701c.tar.bz2 |
[svn-r9829] Purpose: Clean up tests
Description:
+ replaced "goto error" with throw exceptions
+ properly cleanup dynamically allocated memory in failure cases,
for in some cases, the execution continues on after the failures
were reported.
+ added test utility class InvalidActionException for when an action
should cause an exception but doesn't.
Platforms tested:
SunOS 5.7 (arabica)
Linux 2.4 (eirene)
Note that there was an error due to the missing symbol H5E_LEN. To
be able to test my changes, I temporarily replaced H5E_LEN in c++/src
with a constant as in the C tests, before the problem can be fixed.
This value doesn't effect the C++ tests at all, at this time.
Diffstat (limited to 'c++/test/h5cpputil.cpp')
-rw-r--r-- | c++/test/h5cpputil.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index 8bb0d85..4f21c9a 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -27,12 +27,22 @@ #endif #include <string> +#include "h5test.h" +#include "H5Exception.h" +#include "h5cpputil.h" + +#ifndef H5_NO_NAMESPACE +namespace H5 { +#ifndef H5_NO_STD + using namespace std; +#endif // H5_NO_STD +#endif +/* #ifndef H5_NO_STD using namespace std; #endif +*/ -#include "h5test.h" -#include "h5cpputil.h" /*------------------------------------------------------------------------- * Function: test_report @@ -93,3 +103,29 @@ void issue_fail_msg(const char* where, int line, const char* file_name) } } +//-------------------------------------------------------------------------- +// Function: InvalidActionException default constructor +//-------------------------------------------------------------------------- +InvalidActionException::InvalidActionException():Exception(){} + +//-------------------------------------------------------------------------- +// Function: InvalidActionException overloaded constructor +// +// Purpose: Creates an InvalidActionException with the name of the function, +// which the failure should have occurred but didn't, and a +// message explaining why it should fail. +// Parameters +// func_name - IN: Name of the function where failure should occur +// message - IN: Message +//-------------------------------------------------------------------------- +InvalidActionException::InvalidActionException(const string func_name, const string message) : Exception(func_name, message) {} + +//-------------------------------------------------------------------------- +// Function: InvalidActionException destructor +//-------------------------------------------------------------------------- +InvalidActionException::~InvalidActionException() {} + +#ifndef H5_NO_NAMESPACE +} // end namespace +#endif + |