hdf5/c++/test/testhdf5.cpp
Albert Cheng 3c59678775 [svn-r9115] Purpose:
feature

Description:
Another revamp of the test interface.
TestInit: is used to register Test Program name, test program specific
   Usage and option parsing routines.
TestUsage: will invoke extra usage routine if provided.
TestParseCmdLine: will invoke extra option parsing routine if provided.
GetTestSummary() and GetTestCleanup() replaces the previous Summary and
CleanUp arguments of TestParseCmdLine.

test/testhdf5, test/ttsafe.c, testpar/t_mpi.c, testpar/testphdf5.c:
   All have been updated to use the new Test Routines.

testpar/t_mpi.c:
   Also a fix of a compiler optimization bug when pgcc in Linux is
   used to compile it.  Changed buf[] and expected to unsigned char
   type to avoid a bug that failed to do sign-extension.

Platforms tested:
"h5committested"
Also tested thread-safe option in eirene.
2004-08-19 01:32:47 -05:00

89 lines
3.6 KiB
C++

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*****************************************************************************
FILE
testhdf5.cpp - HDF5 testing framework main file.
REMARKS
General test wrapper for HDF5 base 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
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.
***************************************************************************/
// Use C version of the header file testhdf5.h instead of re-coding it
#include "testhdf5.h"
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif /* !H5_NO_NAMESPACE */
int
main(int argc, char *argv[])
{
/* Initialize testing framework */
TestInit(argv[0], NULL, NULL);
// testing file creation and opening in tfile.cpp
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
AddTest("attr", test_attr, cleanup_attr, "Attributes", NULL);
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);
AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
AddTest("array", test_array, cleanup_array, "Array Datatypes", NULL);
AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
Comment out tests that are not done yet */
/* Display testing information */
TestInfo(argv[0]);
/* Parse command line arguments */
TestParseCmdLine(argc,argv);
/* Perform requested testing */
PerformTests();
/* Display test summary, if requested */
if (GetTestSummary())
TestSummary();
/* Clean up test files, if allowed */
if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
TestCleanup();
return (GetTestNumErrs());
}