summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/dsets.cpp12
-rw-r--r--c++/test/h5cpputil.h16
-rw-r--r--c++/test/testhdf5.cpp25
-rw-r--r--c++/test/tfile.cpp9
-rw-r--r--c++/test/th5s.cpp11
5 files changed, 47 insertions, 26 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 40cbef7..36cfaa7 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -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;
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h
index bef8f4a..38ecbcb 100644
--- a/c++/test/h5cpputil.h
+++ b/c++/test/h5cpputil.h
@@ -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();
}
}
diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp
index b93689b..f34ef8f 100644
--- a/c++/test/testhdf5.cpp
+++ b/c++/test/testhdf5.cpp
@@ -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);
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index ca26abd..794bda0 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -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
*
diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp
index 9ddb4e0..cccb674 100644
--- a/c++/test/th5s.cpp
+++ b/c++/test/th5s.cpp
@@ -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
*