mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r10242] Purpose: Updating C++ tests
Description: Added an overloaded function for the template function verify_val. Updated various comments/headers. Platforms tested: Linux 2.4 (heping) AIX 5.1 (copper)
This commit is contained in:
parent
fef4646179
commit
99d26d20f8
@ -32,14 +32,14 @@
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include "testhdf5.h"
|
||||
#include "H5Cpp.h"
|
||||
#include "testhdf5.h" // C test header file
|
||||
#include "H5Cpp.h" // C++ API header file
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#endif
|
||||
|
||||
#include "h5cpputil.h"
|
||||
#include "h5cpputil.h" // C++ utilility header file
|
||||
|
||||
const string FILE1("dataset.h5");
|
||||
const string DSET_DEFAULT_NAME("default");
|
||||
@ -98,9 +98,8 @@ test_create( H5File& file)
|
||||
delete dataset;
|
||||
|
||||
// Try creating a dataset that already exists. This should fail since a
|
||||
// dataset can only be created once. If an exception is not thrown
|
||||
// for this action by createDataSet, then display failure information
|
||||
// and throw an exception.
|
||||
// dataset can only be created once. If an exception is not thrown for
|
||||
// this action by createDataSet, then throw an invalid action exception.
|
||||
try {
|
||||
dataset = new DataSet (file.createDataSet
|
||||
(DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
|
||||
@ -202,7 +201,6 @@ check_values (hsize_t i, hsize_t j, int apoint, int acheck)
|
||||
{
|
||||
if (apoint != acheck)
|
||||
{
|
||||
H5_FAILED();
|
||||
cerr << " Read different values than written.\n" << endl;
|
||||
cerr << " At index " << (unsigned long)i << "," <<
|
||||
(unsigned long)j << endl;
|
||||
|
@ -23,6 +23,8 @@
|
||||
#ifndef _h5cpputil_h
|
||||
#define _h5cpputil_h
|
||||
|
||||
#include "h5test.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#endif
|
||||
@ -51,7 +53,19 @@ template <class Type1, class Type2>
|
||||
cerr << "*** UNEXPECTED VALUE from " << where << " should be "
|
||||
<< value << ", but is " << x << " at line " << line
|
||||
<< " in " << file_name << endl;
|
||||
H5Eprint (stderr);
|
||||
IncTestNumErrs();
|
||||
}
|
||||
}
|
||||
|
||||
template <class Type1, class Type2>
|
||||
void verify_val(Type1 x, Type2 value, const char* msg, const char* file_name, int line)
|
||||
{
|
||||
if (x != value)
|
||||
{
|
||||
cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line
|
||||
<< ":" << msg << " different: " << x << ", should be " << value
|
||||
<< endl;
|
||||
IncTestNumErrs();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,21 +17,28 @@
|
||||
testhdf5.cpp - HDF5 testing framework main file.
|
||||
|
||||
REMARKS
|
||||
General test wrapper for HDF5 base library test programs
|
||||
General test wrapper for HDF5 C++ library test programs
|
||||
|
||||
DESIGN
|
||||
Each test function should be implemented as function having no
|
||||
parameters and returning void (i.e. no return value). They should be put
|
||||
into the list of InitTest() calls in main() below. Functions which depend
|
||||
on other functionality should be placed below the InitTest() call for the
|
||||
into the list of AddTest() calls in main() below. Functions which depend
|
||||
on other functionality should be placed below the AddTest() call for the
|
||||
base functionality testing.
|
||||
Each test module should include testhdf5.h and define a unique set of
|
||||
names for test files they create.
|
||||
|
||||
BUGS/LIMITATIONS
|
||||
|
||||
EXPORTED ROUTINES/VARIABLES:
|
||||
Two variables are exported: num_errs, and Verbosity.
|
||||
EXTERNAL ROUTINES/VARIABLES:
|
||||
TestInit(...) -- Initialize testing framework
|
||||
TestInfo(...) -- Print test info
|
||||
AddTest(...) -- Setup a test function and add it to the list of tests
|
||||
TestParseCmdLine(...) -- Parse command line arguments
|
||||
PerformTests() -- Perform requested testing
|
||||
GetTestSummary() -- Retrieve Summary request value
|
||||
TestSummary() -- Display test summary
|
||||
GetTestCleanup() -- Retrieve Cleanup request value
|
||||
TestCleanup() -- Clean up files from testing
|
||||
GetTestNumErrs() -- Retrieve the number of testing errors
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -54,9 +61,9 @@ main(int argc, char *argv[])
|
||||
AddTest("file", test_file, cleanup_file, "File I/O Operations", NULL);
|
||||
// testing dataspace functionalities in th5s.cpp
|
||||
AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
|
||||
|
||||
/* Comment out tests that are not done yet. - BMR, Feb 2001
|
||||
// testing attribute functionalities in tattr.cpp
|
||||
AddTest("attr", test_attr, cleanup_attr, "Attributes", NULL);
|
||||
/* Comment out tests that are not done yet. - BMR, Feb 2001
|
||||
AddTest("select", test_select, cleanup_select, "Selections", NULL);
|
||||
AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
|
||||
AddTest("reference", test_reference, cleanup_reference, "References", NULL);
|
||||
|
@ -30,14 +30,15 @@
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include "H5Cpp.h"
|
||||
#include "testhdf5.h"
|
||||
#include "h5cpputil.h"
|
||||
#include "testhdf5.h" // C test header file
|
||||
#include "H5Cpp.h" // C++ API header file
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#endif
|
||||
|
||||
#include "h5cpputil.h" // C++ utilility header file
|
||||
|
||||
const hsize_t F1_USERBLOCK_SIZE = (hsize_t)0;
|
||||
const size_t F1_OFFSET_SIZE = sizeof(haddr_t);
|
||||
const size_t F1_LENGTH_SIZE = sizeof(hsize_t);
|
||||
@ -475,7 +476,7 @@ test_file_name()
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_file
|
||||
*
|
||||
* Purpose: Main program
|
||||
* Purpose: Main file testing routine
|
||||
*
|
||||
* Return: None
|
||||
*
|
||||
|
@ -27,13 +27,14 @@
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include "testhdf5.h"
|
||||
#include "H5Cpp.h"
|
||||
#include "h5cpputil.h"
|
||||
#include "testhdf5.h" // C test header file
|
||||
#include "H5Cpp.h" // C++ API header file
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#endif /* !H5_NO_NAMESPACE */
|
||||
#endif
|
||||
|
||||
#include "h5cpputil.h" // C++ utilility header file
|
||||
|
||||
const string TESTFILE("th5s.h5");
|
||||
const string DATAFILE("th5s1.h5");
|
||||
@ -579,7 +580,7 @@ test_h5s_compound_scalar_read(void)
|
||||
*
|
||||
* Function: test_h5s
|
||||
*
|
||||
* Purpose: Main H5S (dataspace) testing routine
|
||||
* Purpose: Main dataspace testing routine
|
||||
*
|
||||
* Return: none
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user