[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.
This commit is contained in:
Binh-Minh Ribler
2005-01-16 10:23:34 -05:00
parent 35985b6dba
commit dfd0b59ae6
3 changed files with 250 additions and 177 deletions
+38 -2
View File
@@ -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