summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2004-12-20 20:01:46 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2004-12-20 20:01:46 (GMT)
commit625e6ad9aa105bdcc50e6d42559a56582b867e37 (patch)
tree470e5d4efbd7e68f2c52535ada2c2c19d07c0af5
parente793077523917ba58eb138b5369ae7dc19d84ba1 (diff)
downloadhdf5-625e6ad9aa105bdcc50e6d42559a56582b867e37.zip
hdf5-625e6ad9aa105bdcc50e6d42559a56582b867e37.tar.gz
hdf5-625e6ad9aa105bdcc50e6d42559a56582b867e37.tar.bz2
[svn-r9696] Purpose: Clean up tests
Description: Replaced cout's with cerr's. Replaced macro VERIFY with template function verify_val to verify read data/info. Cleanup various places in the tests to make them more consistent. Platforms tested: SunOS 5.7 (arabica) Linux 2.4 (eirene)
-rw-r--r--c++/test/dsets.cpp109
-rw-r--r--c++/test/h5cpputil.cpp31
-rw-r--r--c++/test/h5cpputil.h21
-rw-r--r--c++/test/tfile.cpp270
-rw-r--r--c++/test/th5s.cpp159
5 files changed, 367 insertions, 223 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 08ce98e..7b3600f 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -32,9 +32,9 @@
#include <iostream>
#endif
-#include "H5Cpp.h"
-#include "h5test.h"
#include "testhdf5.h"
+#include "h5test.h"
+#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
@@ -42,23 +42,20 @@ using namespace H5;
#include "h5cpputil.h"
-const char *FILENAME[] = {
- "dataset",
- NULL
-};
-
-#define DSET_DEFAULT_NAME "default"
-#define DSET_CHUNKED_NAME "chunked"
-#define DSET_SIMPLE_IO_NAME "simple_io"
-#define DSET_TCONV_NAME "tconv"
-#define DSET_COMPRESS_NAME "compressed"
-#define DSET_BOGUS_NAME "bogus"
+const string FILE1("dataset.h5");
+const string DSET_DEFAULT_NAME("default");
+const string DSET_CHUNKED_NAME("chunked");
+const string DSET_SIMPLE_IO_NAME("simple_io");
+const string DSET_TCONV_NAME ("tconv");
+const string DSET_COMPRESS_NA("compressed");
+const string DSET_BOGUS_NAME ("bogus");
-#define H5Z_FILTER_BOGUS 305
+const int H5Z_FILTER_BOGUS = 305;
-/* Local prototypes for filter functions */
+// Local prototypes
static size_t bogus(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+void cleanup_dsets(void);
/*-------------------------------------------------------------------------
@@ -113,7 +110,7 @@ test_create( H5File& file)
(DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
// continuation here, that means no exception has been thrown
H5_FAILED();
- cout << " Library allowed overwrite of existing dataset." << endl;
+ cerr << " Library allowed overwrite of existing dataset." << endl;
goto error;
}
catch (FileIException E ) // catching invalid creating dataset
@@ -136,7 +133,7 @@ test_create( H5File& file)
dataset = new DataSet (file.openDataSet( "does_not_exist" ));
// continuation here, that means no exception has been thrown
H5_FAILED();
- cout << " Opened a non-existent dataset." << endl;
+ cerr << " Opened a non-existent dataset." << endl;
goto error;
}
catch (FileIException E ) // catching creating non-existent dataset
@@ -203,8 +200,8 @@ check_values (hsize_t i, hsize_t j, int apoint, int acheck)
if (apoint != acheck)
{
H5_FAILED();
- cout << " Read different values than written.\n" << endl;
- cout << " At index " << (unsigned long)i << "," <<
+ cerr << " Read different values than written.\n" << endl;
+ cerr << " At index " << (unsigned long)i << "," <<
(unsigned long)j << endl;
return -1;
}
@@ -353,14 +350,14 @@ test_tconv( H5File& file)
in[4*i+3]!=out[4*i+0])
{
H5_FAILED();
- cout << " Read with byte order conversion failed." << endl;
+ cerr << " Read with byte order conversion failed." << endl;
goto error;
}
}
delete [] out;
delete [] in;
- cout << " PASSED" << endl;
+ cerr << " PASSED" << endl;
return 0;
} // end try
@@ -375,9 +372,9 @@ test_tconv( H5File& file)
/* This message derives from H5Z */
const H5Z_class_t H5Z_BOGUS[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
H5Z_FILTER_BOGUS, /* Filter id number */
- 1, 1, /* Encode and decode enabled */
+ 1, 1, /* Encode and decode enabled */
"bogus", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
@@ -495,8 +492,8 @@ test_compression(H5File& file)
for (j=0; j<size[1]; j++) {
if (0!=check[i][j]) {
H5_FAILED();
- cout << " Read a non-zero value." << endl;
- cout << " At index " << (unsigned long)i << "," <<
+ cerr << " Read a non-zero value." << endl;
+ cerr << " At index " << (unsigned long)i << "," <<
(unsigned long)j << endl;
goto error;
}
@@ -622,12 +619,12 @@ test_compression(H5File& file)
if (points[hs_offset[0]+i][hs_offset[1]+j] !=
check[hs_offset[0]+i][hs_offset[1]+j]) {
H5_FAILED();
- cout << " Read different values than written.\n" << endl;
- cout << " At index " << (unsigned long)(hs_offset[0]+i) <<
+ cerr << " Read different values than written.\n" << endl;
+ cerr << " At index " << (unsigned long)(hs_offset[0]+i) <<
"," << (unsigned long)(hs_offset[1]+j) << endl;
- cout << " At original: " << (int)points[hs_offset[0]+i][hs_offset[1]+j] << endl;
- cout << " At returned: " << (int)check[hs_offset[0]+i][hs_offset[1]+j] << endl;
+ cerr << " At original: " << (int)points[hs_offset[0]+i][hs_offset[1]+j] << endl;
+ cerr << " At returned: " << (int)check[hs_offset[0]+i][hs_offset[1]+j] << endl;
goto error;
}
}
@@ -640,7 +637,7 @@ test_compression(H5File& file)
#else
TESTING("deflate filter");
SKIPPED();
- cout << not_supported << endl;
+ cerr << not_supported << endl;
#endif
/*----------------------------------------------------------------------
@@ -748,7 +745,7 @@ test_multiopen (H5File& file)
if (cur_size[0]!=tmp_size[0])
{
H5_FAILED();
- cout << " Got " << (int)tmp_size[0] << " instead of "
+ cerr << " Got " << (int)tmp_size[0] << " instead of "
<< (int)cur_size[0] << "!" << endl;
delete space;
goto error;
@@ -843,7 +840,7 @@ test_types(H5File& file)
// catch exceptions thrown in try block of bitfield_1
catch (Exception E) {
- cout << "Failure in " << E.getFuncName() << " - "
+ cerr << "Failure in " << E.getFuncName() << " - "
<< E.getDetailMsg() << endl;
goto error;
}
@@ -864,7 +861,7 @@ test_types(H5File& file)
try { dset->write (buf, type); }
catch(DataSetIException E)
{
- cout << "Failure in " << E.getFuncName() << " - "
+ cerr << "Failure in " << E.getFuncName() << " - "
<< E.getDetailMsg() << endl;
delete dset;
goto error;
@@ -874,7 +871,7 @@ test_types(H5File& file)
// catch exceptions thrown in try block of bitfield_2
catch (Exception E) {
- cout << "Failure in " << E.getFuncName() << " - "
+ cerr << "Failure in " << E.getFuncName() << " - "
<< E.getDetailMsg() << endl;
goto error;
}
@@ -906,12 +903,12 @@ test_types(H5File& file)
// catch exceptions thrown in try block of opaque_1
catch (DataSetIException E) {
delete optype;
- cout << "Failure in " << E.getFuncName() << " - "
+ cerr << "Failure in " << E.getFuncName() << " - "
<< E.getDetailMsg() << endl;
goto error;
}
catch (Exception E) {
- cout << "Failure in " << E.getFuncName() << " - "
+ cerr << "Failure in " << E.getFuncName() << " - "
<< E.getDetailMsg() << endl;
goto error;
}
@@ -941,12 +938,12 @@ test_types(H5File& file)
} //end try block of opaque_2
catch (DataSetIException E) {
delete optype;
- cout << "Failure in " << E.getFuncName() << " - "
+ cerr << "Failure in " << E.getFuncName() << " - "
<< E.getDetailMsg() << endl;
goto error;
}
catch (Exception E) {
- cout << "Failure in " << E.getFuncName() << " - "
+ cerr << "Failure in " << E.getFuncName() << " - "
<< E.getDetailMsg() << endl;
goto error;
}
@@ -956,7 +953,7 @@ test_types(H5File& file)
} // end top try block
catch (Exception E) { // Group and DataType exceptions
- cout << "Failure in " << E.getFuncName() << " - "
+ cerr << "Failure in " << E.getFuncName() << " - "
<< E.getDetailMsg() << endl;
goto error;
}
@@ -993,9 +990,6 @@ main(void)
hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
- char filename[1024];
- h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
-
int nerrors=0; // keep track of number of failures occurr
try
{
@@ -1008,9 +1002,9 @@ main(void)
// list object to pass in H5File::H5File
FileAccPropList fapl(fapl_id);
- H5File file( filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ H5File file(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
- /* Cause the library to emit initial messages */
+ // Cause the library to emit initial messages
Group grp = file.createGroup( "emit diagnostics", 0);
grp.setComment( ".", "Causes diagnostic messages to be emitted");
@@ -1030,10 +1024,31 @@ main(void)
{
return(test_report(nerrors, string(" Dataset")));
}
- /* use C test utility routine to clean up data files */
- h5_cleanup(FILENAME, fapl_id);
- /* print out dsets test results */
+ // Clean up data file
+ cleanup_dsets();
+
+ // Print out dsets test results
cerr << endl << endl;
return(test_report(nerrors, string(" Dataset")));
}
+
+/*-------------------------------------------------------------------------
+ * Function: cleanup_dsets
+ *
+ * Purpose: Cleanup temporary test files
+ *
+ * Return: none
+ *
+ * Programmer: (use C version)
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+cleanup_dsets(void)
+{
+ remove(FILE1.c_str());
+} /* cleanup_dsets */
+
diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp
index 85ba2d2..020bab0 100644
--- a/c++/test/h5cpputil.cpp
+++ b/c++/test/h5cpputil.cpp
@@ -31,8 +31,8 @@
using namespace std;
#endif
-#include "h5cpputil.h"
#include "h5test.h"
+#include "h5cpputil.h"
/*-------------------------------------------------------------------------
* Function: test_report
@@ -58,16 +58,39 @@ int test_report( int nerrors, const string& testname )
{
nerrors = MAX(1, nerrors);
if (1 == nerrors)
- cout << "***** " << nerrors << testname
+ cerr << "***** " << nerrors << testname
<< " TEST FAILED! *****" << endl;
else
- cout << "***** " << nerrors << testname
+ cerr << "***** " << nerrors << testname
<< " TESTS FAILED! *****" << endl;
return 1;
}
else
{
- cout << "All" << testname << " tests passed." << endl;
+ cerr << "All" << testname << " tests passed." << endl;
return 0;
}
}
+
+/*-------------------------------------------------------------------------
+ * Function: issue_fail_msg
+ *
+ * Purpose: Displays that a function has failed with its location.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (copied and modified macro CHECK from C)
+ * Monday, December 20, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+void issue_fail_msg(const char* where, int line, const char* file_name)
+{
+ if (GetTestVerbosity()>=VERBO_HI)
+ {
+ cerr << " Call to routine: " << where << " at line " << line
+ << " in " << file_name << "has failed" << endl;
+ }
+}
+
+
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h
index b3d7a1b..d67c459 100644
--- a/c++/test/h5cpputil.h
+++ b/c++/test/h5cpputil.h
@@ -25,8 +25,29 @@
#ifndef H5_NO_STD
int test_report (int, const std::string&);
+using std::cerr;
+using std::endl;
#else
int test_report (int, const string&);
#endif
+void issue_fail_msg(const char* where, int line, const char* file_name);
+
+template <class Type1, class Type2>
+ void verify_val(Type1 x, Type2 value, const char* where, int line, const char* file_name)
+{
+ if (GetTestVerbosity()>=VERBO_HI)
+ {
+ cerr << " Call to routine: " << where << " at line " << line
+ << " in " << file_name << " had value " << x << endl;
+ }
+ if (x != value)
+ {
+ cerr << "*** UNEXPECTED VALUE from " << where << " should be "
+ << value << ", but is " << x << " at line " << line
+ << " in " << file_name << endl;
+ H5Eprint (stdout);
+ }
+}
+
#endif
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index f5484eb..1e859bc 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -18,13 +18,12 @@
EXTERNAL ROUTINES/VARIABLES:
These routines are in the test directory of the C library:
- h5_reset() -- in h5test.c, resets the library by closing it
h5_fileaccess() -- in h5test.c, returns a file access template
- h5_fixname() -- in h5test.c, create a file name from a file base name
- h5_cleanup() -- in h5test.c, cleanup temporary test files
***************************************************************************/
+#include <string>
+
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
@@ -33,37 +32,35 @@
#include "H5Cpp.h"
#include "testhdf5.h"
+#include "h5cpputil.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
-#define F1_USERBLOCK_SIZE (hsize_t)0
-#define F1_OFFSET_SIZE sizeof(haddr_t)
-#define F1_LENGTH_SIZE sizeof(hsize_t)
-#define F1_SYM_LEAF_K 4
-#define F1_SYM_INTERN_K 16
-#define FILE1 "tfile1.h5"
-
-#define F2_USERBLOCK_SIZE (hsize_t)512
-#define F2_OFFSET_SIZE 8
-#define F2_LENGTH_SIZE 8
-#define F2_SYM_LEAF_K 8
-#define F2_SYM_INTERN_K 32
-#define FILE2 "tfile2.h5"
-
-#define F3_USERBLOCK_SIZE (hsize_t)0
-#define F3_OFFSET_SIZE F2_OFFSET_SIZE
-#define F3_LENGTH_SIZE F2_LENGTH_SIZE
-#define F3_SYM_LEAF_K F2_SYM_LEAF_K
-#define F3_SYM_INTERN_K F2_SYM_INTERN_K
-#define FILE3 "tfile3.h5"
-
-#define KB 1024
-#define FILE4 "tfile4.h5"
-
-#define FILE5 "tfile5.h5"
-#define NAME_LEN 64
+const int F1_USERBLOCK_SIZE = (hsize_t)0;
+const int F1_OFFSET_SIZE = sizeof(haddr_t);
+const int F1_LENGTH_SIZE = sizeof(hsize_t);
+const int F1_SYM_LEAF_K = 4;
+const int F1_SYM_INTERN_K = 16;
+const string FILE1("tfile1.h5");
+
+const int F2_USERBLOCK_SIZE = (hsize_t)512;
+const int F2_OFFSET_SIZE = 8;
+const int F2_LENGTH_SIZE = 8;
+const int F2_SYM_LEAF_K = 8;
+const int F2_SYM_INTERN_K = 32;
+const string FILE2("tfile2.h5");
+
+const int F3_USERBLOCK_SIZE = (hsize_t)0;
+const int F3_OFFSET_SIZE = F2_OFFSET_SIZE;
+const int F3_LENGTH_SIZE = F2_LENGTH_SIZE;
+const int F3_SYM_LEAF_K = F2_SYM_LEAF_K;
+const int F3_SYM_INTERN_K = F2_SYM_INTERN_K;
+const string FILE3("tfile3.h5");
+
+const int KB = 1024;
+const string FILE4("tfile4.h5");
/*-------------------------------------------------------------------------
@@ -91,49 +88,50 @@ test_file_create(void)
/* Create with H5F_ACC_EXCL */
/* First ensure the file does not exist */
- remove(FILE1);
+ remove(FILE1.c_str());
try {
- H5File* fid1 = new H5File (FILE1, H5F_ACC_EXCL);
+ H5File* file1 = new H5File (FILE1, H5F_ACC_EXCL);
/*
* try to create the same file with H5F_ACC_TRUNC. This should fail
- * because fid1 is the same file and is currently open.
+ * because file1 is the same file and is currently open.
*/
try {
- H5File fid2 (FILE1, H5F_ACC_TRUNC); // should throw E
+ H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
// Should FAIL but didn't - BMR (Note 1): a macro, with a diff
// name, that skips the comparison b/w the 1st & 2nd args would
- // be more appropriate, but VERIFY can be used for now - Mar 13, 01
+ // be more appropriate, but verify_val can be used for now;
// also, more text about what is testing would be better.
- VERIFY(fid2.getId(), FAIL, "H5File constructor");
+ verify_val(file2.getId(), FAIL, "H5File constructor", __LINE__, __FILE__);
}
catch( FileIException E ) {} // do nothing, FAIL expected
- // Close file fid1
- delete fid1;
+ // Close file file1
+
+ delete file1;
/*
* Try again with H5F_ACC_EXCL. This should fail because the file already
* exists from the previous steps.
*/
try {
- fid1 = new H5File( FILE1, H5F_ACC_EXCL ); // should throw E
- VERIFY(fid1->getId(), FAIL, "H5File constructor");
+ file1 = new H5File( FILE1, H5F_ACC_EXCL ); // should throw E
+ verify_val(file1->getId(), FAIL, "H5File constructor", __LINE__, __FILE__);
}
catch( FileIException E ) {} // do nothing, FAIL expected
// Test create with H5F_ACC_TRUNC. This will truncate the existing file.
- fid1 = new H5File (FILE1, H5F_ACC_TRUNC);
+ file1 = new H5File (FILE1, H5F_ACC_TRUNC);
/*
- * Try to truncate first file again. This should fail because fid1 is the
+ * Try to truncate first file again. This should fail because file1 is the
* same file and is currently open.
*/
try {
- H5File fid2 (FILE1, H5F_ACC_TRUNC); // should throw E
- VERIFY(fid2.getId(), FAIL, "H5File constructor");
+ H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
+ verify_val(file2.getId(), FAIL, "H5File constructor", __LINE__, __FILE__);
}
catch( FileIException E ) {} // do nothing, FAIL expected
@@ -142,38 +140,38 @@ test_file_create(void)
* exists.
*/
try {
- H5File fid3 (FILE1, H5F_ACC_EXCL); // should throw E
- VERIFY(fid3.getId(), FAIL, "H5File constructor");
+ H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E
+ verify_val(file3.getId(), FAIL, "H5File constructor", __LINE__, __FILE__);
}
catch( FileIException E ) {} // do nothing, FAIL expected
/* Get the file-creation template */
- FileCreatPropList tmpl1 = fid1->getCreatePlist();
+ FileCreatPropList tmpl1 = file1->getCreatePlist();
hsize_t ublock = tmpl1.getUserblock();
- VERIFY(ublock, F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock");
+ verify_val(ublock, F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
size_t parm1, parm2; /*file-creation parameters */
tmpl1.getSizes( parm1, parm2);
- VERIFY(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes");
- VERIFY(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes");
+ verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; /*file-creation parameters */
- tmpl1.getSymk( iparm1, iparm2);
- VERIFY(iparm1, F1_SYM_INTERN_K, "FileCreatPropList::getSymk");
- VERIFY(iparm2, F1_SYM_LEAF_K, "FileCreatPropList::getSymk");
+ unsigned iparm1,iparm2; /*file-creation parameters */
+ tmpl1.getSymk( iparm1, iparm2);
+ verify_val(iparm1, F1_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
+ verify_val(iparm2, F1_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
// tmpl1 is automatically closed; if error occurs, it'll be
// caught in the catch block
/* Close first file */
- delete fid1;
+ delete file1;
}
catch( PropListIException E ) {
- CHECK(FAIL, FAIL, E.getCFuncName());
+ issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__);
}
catch( FileIException E ) {
- CHECK(FAIL, FAIL, E.getCFuncName());
+ issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__);
}
try
@@ -190,27 +188,27 @@ test_file_create(void)
* Try to create second file, with non-standard file-creation template
* params.
*/
- H5File fid2( FILE2, H5F_ACC_TRUNC, *tmpl1 );
+ H5File file2( FILE2, H5F_ACC_TRUNC, *tmpl1 );
/* Release file-creation template */
delete tmpl1;
/* Get the file-creation template */
- tmpl1 = new FileCreatPropList (fid2.getCreatePlist());
+ tmpl1 = new FileCreatPropList (file2.getCreatePlist());
/* Get the file-creation parameters */
hsize_t ublock = tmpl1->getUserblock();
- VERIFY(ublock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock");
+ verify_val(ublock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
size_t parm1, parm2; /*file-creation parameters */
tmpl1->getSizes( parm1, parm2);
- VERIFY(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes");
- VERIFY(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes");
+ verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; /*file-creation parameters */
- tmpl1->getSymk( iparm1, iparm2);
- VERIFY(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk");
- VERIFY(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk");
+ unsigned iparm1,iparm2; /*file-creation parameters */
+ tmpl1->getSymk( iparm1, iparm2);
+ verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
+ verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
/* Clone the file-creation template */
FileCreatPropList tmpl2;
@@ -226,28 +224,28 @@ test_file_create(void)
* Try to create second file, with non-standard file-creation template
* params
*/
- H5File fid3( FILE3, H5F_ACC_TRUNC, tmpl2 );
+ H5File file3( FILE3, H5F_ACC_TRUNC, tmpl2 );
/* Get the file-creation template */
- tmpl1 = new FileCreatPropList (fid3.getCreatePlist());
+ tmpl1 = new FileCreatPropList (file3.getCreatePlist());
/* Get the file-creation parameters */
ublock = tmpl1->getUserblock();
- VERIFY(ublock, F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock");
+ verify_val(ublock, F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
tmpl1->getSizes( parm1, parm2);
- VERIFY(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes");
- VERIFY(parm2, F3_LENGTH_SIZE, "FileCreatPropList::getSizes");
+ verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ verify_val(parm2, F3_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
tmpl1->getSymk( iparm1, iparm2);
- VERIFY(iparm1, F3_SYM_INTERN_K, "FileCreatPropList::getSymk");
- VERIFY(iparm2, F3_SYM_LEAF_K, "FileCreatPropList::getSymk");
+ verify_val(iparm1, F3_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
+ verify_val(iparm2, F3_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
/* Dynamically release file-creation template */
delete tmpl1;
}
catch( PropListIException E ) {
- CHECK(FAIL, FAIL, E.getCFuncName());
+ issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__);
}
} /* test_file_create() */
@@ -275,28 +273,28 @@ test_file_open(void)
try {
/* Open first file */
- H5File fid1 (FILE2, H5F_ACC_RDWR );
+ H5File file1 (FILE2, H5F_ACC_RDWR );
/* Get the file-creation template */
- FileCreatPropList tmpl1 = fid1.getCreatePlist();
+ FileCreatPropList tmpl1 = file1.getCreatePlist();
/* Get the file-creation parameters */
hsize_t ublock = tmpl1.getUserblock();
- VERIFY(ublock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock");
+ verify_val(ublock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
size_t parm1, parm2; /*file-creation parameters */
tmpl1.getSizes( parm1, parm2);
- VERIFY(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes");
- VERIFY(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes");
+ verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; /*file-creation parameters */
- tmpl1.getSymk( iparm1, iparm2);
- VERIFY(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk");
- VERIFY(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk");
+ unsigned iparm1,iparm2; /*file-creation parameters */
+ tmpl1.getSymk( iparm1, iparm2);
+ verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
+ verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
} // end of try block
catch( Exception E ) {
- CHECK(FAIL, FAIL, E.getCFuncName());
+ issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__);
}
} /* test_file_open() */
@@ -329,23 +327,24 @@ test_file_size(void)
// list object to pass in H5File::H5File
FileAccPropList fapl(fapl_id);
- // Set to sec2 driver. Do we want to test other file drivers.
+ // Set to sec2 driver. Do we want to test other file drivers?
// They're not tested in C++.
- fapl.setSec2();
+ // File drivers seem not implemented.
+ //fapl.setSec2();
// Create a file
- H5File fid( FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ H5File file4( FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Get file size
- hsize_t file_size = fid.getFileSize();
+ hsize_t file_size = file4.getFileSize();
// Check if file size is reasonable. It's supposed to be 2KB now.
if(file_size<1*KB || file_size>4*KB)
- CHECK(FAIL, FAIL, "H5File::getFileSize");
+ issue_fail_msg("H5File::getFileSize", __LINE__, __FILE__);
} // end of try block
catch( Exception E ) {
- CHECK(FAIL, FAIL, E.getCFuncName());
+ issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__);
}
// use C test utility routine to close property list.
@@ -355,6 +354,90 @@ test_file_size(void)
/*-------------------------------------------------------------------------
+ * Function: test_file_name
+ *
+ * Purpose: Test getting file's name.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler
+ * July, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+const int RANK = 2;
+const int NX = 4;
+const int NY = 5;
+const string GROUPNAME ("group");
+const string DSETNAME ("dataset");
+const string ATTRNAME ("attribute");
+const string DTYPENAME ("compound");
+
+/* Compound datatype */
+typedef struct s1_t {
+ unsigned int a;
+ float b;
+} s1_t;
+
+static void
+test_file_name()
+{
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing File Name\n"));
+
+ string file_name;
+ try {
+ // Create a file using default properties.
+ H5File file4(FILE4, H5F_ACC_TRUNC);
+
+ // Get file name from the file instance.
+ file_name = file4.getFileName();
+
+ /* Create a group in the root group */
+ Group group(file4.createGroup(GROUPNAME, 0));
+
+ /* Get and verify file name */
+ file_name = group.getFileName();
+
+ /* Create the data space */
+ hsize_t dims[RANK] = {NX, NY};
+ DataSpace space(RANK, dims);
+
+ /* Create a new dataset */
+ DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+
+ /* Get and verify file name */
+ file_name = dataset.getFileName();
+
+ /* Create an attribute for the dataset */
+ Attribute attr(dataset.createAttribute(ATTRNAME, PredType::NATIVE_INT, space));
+
+ /* Get and verify file name */
+ file_name = attr.getFileName();
+
+ /* Create a compound datatype */
+ CompType comp_type (sizeof(s1_t));
+
+ /* Insert fields */
+ comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT);
+ comp_type.insertMember("b", HOFFSET(s1_t, b), PredType::NATIVE_FLOAT);
+
+ /* Save it on file */
+ comp_type.commit(file4, DTYPENAME);
+
+ /* Get and verify file name */
+ comp_type.getFileName();
+ } // end of try block
+ catch (Exception E) {
+ issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__);
+ }
+
+} /* test_file_name() */
+
+
+/*-------------------------------------------------------------------------
* Function: test_file
*
* Purpose: Main program
@@ -377,6 +460,7 @@ test_file(void)
test_file_create(); /* Test file creation (also creation templates) */
test_file_open(); /* Test file opening */
test_file_size(); /* Test file size */
+ test_file_name(); /* Test getting file's name */
} /* test_file() */
@@ -396,8 +480,8 @@ test_file(void)
void
cleanup_file(void)
{
- remove(FILE1);
- remove(FILE2);
- remove(FILE3);
- remove(FILE4);
+ remove(FILE1.c_str());
+ remove(FILE2.c_str());
+ remove(FILE3.c_str());
+ remove(FILE4.c_str());
} /* cleanup_file */
diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp
index eac6703..dacd1ef 100644
--- a/c++/test/th5s.cpp
+++ b/c++/test/th5s.cpp
@@ -29,45 +29,46 @@
#include "H5Cpp.h"
#include "testhdf5.h"
+#include "h5cpputil.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif /* !H5_NO_NAMESPACE */
-#define TESTFILE "th5s.h5"
-#define DATAFILE "th5s1.h5"
+const string TESTFILE("th5s.h5");
+const string DATAFILE("th5s1.h5");
/* 3-D dataset with fixed dimensions */
-#define SPACE1_NAME "Space1"
-#define SPACE1_RANK 3
-#define SPACE1_DIM1 3
-#define SPACE1_DIM2 15
-#define SPACE1_DIM3 13
+const string SPACE1_NAME("Space1");
+const int SPACE1_RANK = 3;
+const int SPACE1_DIM1 = 3;
+const int SPACE1_DIM2 = 15;
+const int SPACE1_DIM3 = 13;
/* 4-D dataset with one unlimited dimension */
-#define SPACE2_NAME "Space2"
-#define SPACE2_RANK 4
-#define SPACE2_DIM1 0
-#define SPACE2_DIM2 15
-#define SPACE2_DIM3 13
-#define SPACE2_DIM4 23
-#define SPACE2_MAX1 H5S_UNLIMITED
-#define SPACE2_MAX2 15
-#define SPACE2_MAX3 13
-#define SPACE2_MAX4 23
+const string SPACE2_NAME("Space2");
+const int SPACE2_RANK = 4;
+const int SPACE2_DIM1 = 0;
+const int SPACE2_DIM2 = 15;
+const int SPACE2_DIM3 = 13;
+const int SPACE2_DIM4 = 23;
+const hsize_t SPACE2_MAX1 = H5S_UNLIMITED;
+const hsize_t SPACE2_MAX2 = 15;
+const hsize_t SPACE2_MAX3 = 13;
+const hsize_t SPACE2_MAX4 = 23;
/* Scalar dataset with simple datatype */
-#define SPACE3_NAME "Scalar1"
-#define SPACE3_RANK 0
+const string SPACE3_NAME("Scalar1");
+const int SPACE3_RANK = 0;
unsigned space3_data=65;
/* Scalar dataset with compound datatype */
-#define SPACE4_NAME "Scalar2"
-#define SPACE4_RANK 0
-#define SPACE4_FIELDNAME1 "c1"
-#define SPACE4_FIELDNAME2 "u"
-#define SPACE4_FIELDNAME3 "f"
-#define SPACE4_FIELDNAME4 "c2"
+const string SPACE4_NAME("Scalar2");
+const int SPACE4_RANK = 0;
+const string SPACE4_FIELDNAME1("c1");
+const string SPACE4_FIELDNAME2("u");
+const string SPACE4_FIELDNAME3("f");
+const string SPACE4_FIELDNAME4("c2");
size_t space4_field1_off=0;
size_t space4_field2_off=0;
size_t space4_field3_off=0;
@@ -120,20 +121,20 @@ test_h5s_basic(void)
// Get simple extent npoints of the dataspace sid1 and verify it
hssize_t n; /* Number of dataspace elements */
n = sid1.getSimpleExtentNpoints();
- VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
- "H5Sget_simple_extent_npoints");
+ verify_val(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
+ "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of dataspace sid1 and verify it
int rank; /* Logical rank of dataspace */
rank = sid1.getSimpleExtentNdims();
- VERIFY(rank, SPACE1_RANK, "H5Sget_simple_extent_ndims");
+ verify_val(rank, SPACE1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Retrieves dimension size of dataspace sid1 and verify it
int ndims; /* Number of dimensions */
hsize_t tdims[4]; /* Dimension array to test with */
ndims = sid1.getSimpleExtentDims( tdims );
- VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0,
- "H5Sget_simple_extent_dims");
+ verify_val(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0,
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
// Create simple dataspace sid2
hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4};
@@ -141,24 +142,24 @@ test_h5s_basic(void)
// Get simple extent npoints of dataspace sid2 and verify it
n = sid2.getSimpleExtentNpoints();
- VERIFY(n, SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4,
- "H5Sget_simple_extent_npoints");
+ verify_val(n, SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4,
+ "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of dataspace sid2 and verify it
rank = sid2.getSimpleExtentNdims();
- VERIFY(rank, SPACE2_RANK, "H5Sget_simple_extent_ndims");
+ verify_val(rank, SPACE2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Retrieves dimension size and max size of dataspace sid2 and
// verify them
ndims = sid2.getSimpleExtentDims( tdims, tmax );
- VERIFY(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0,
- "H5Sget_simple_extent_dims");
- VERIFY(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0,
- "H5Sget_simple_extent_dims");
+ verify_val(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0,
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0,
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
} // end of first try block
catch( DataSpaceIException error )
{
- CHECK(FAIL, FAIL, error.getCFuncName());
+ issue_fail_msg(error.getCFuncName(), __LINE__, __FILE__);
}
/*
@@ -168,10 +169,8 @@ test_h5s_basic(void)
try {
DataSpace manydims_ds(H5S_MAX_RANK+1, dims3, NULL);
- // Should FAIL but didn't - BMR (Note 1): a new macro that skips
- // the comparison b/w the 1st & 2nd args would be more appropriate,
- // but VERIFY will still do - Mar 12, 01
- VERIFY(manydims_ds.getId(), FAIL, "DataSpace constructor");
+ // Should FAIL but didn't, so issue an error message
+ issue_fail_msg("DataSpace constructor", __LINE__, __FILE__);
}
catch( DataSpaceIException error ) {} // do nothing, FAIL expected
@@ -184,11 +183,11 @@ test_h5s_basic(void)
*/
char testfile[512]="";
char *srcdir = getenv("srcdir");
- if (srcdir && ((strlen(srcdir) + strlen(TESTFILE) + 1) < sizeof(testfile))){
+ if (srcdir && ((strlen(srcdir) + strlen(TESTFILE.c_str()) + 1) < sizeof(testfile))){
strcpy(testfile, srcdir);
strcat(testfile, "/");
}
- strcat(testfile, TESTFILE);
+ strcat(testfile, TESTFILE.c_str());
try { // try block for testing higher dimensionality
// Create file
@@ -198,15 +197,17 @@ test_h5s_basic(void)
// what the library can handle and this operation should fail.
try {
DataSet dset1 = fid1.openDataSet( "dset" );
- VERIFY( dset1.getId(), FAIL, "H5File::openDataSet");
+
+ // but didn't, issue an error message
+ issue_fail_msg("H5File::openDataSet", __LINE__, __FILE__);
}
catch( FileIException error ) { } // do nothing, FAIL expected
} // end of try block for testing higher dimensionality
// catch exception thrown by H5File constructor
catch( FileIException error ) {
- CHECK_I(FAIL, error.getCFuncName());
- cout << "***cannot open the pre-created H5S_MAX_RANK test file" <<
+ issue_fail_msg(error.getCFuncName(), __LINE__, __FILE__);
+ cerr << "***cannot open the pre-created H5S_MAX_RANK test file" <<
testfile << endl;
}
@@ -217,7 +218,7 @@ test_h5s_basic(void)
dims1[0] = 0;
try {
DataSpace wrongdim_ds (SPACE1_RANK, dims1);
- VERIFY(wrongdim_ds.getId(), FAIL, "DataSpace constructor");
+ verify_val(wrongdim_ds.getId(), FAIL, "DataSpace constructor", __LINE__, __FILE__);
}
catch( DataSpaceIException error ) {} // do nothing; FAIL expected
@@ -225,13 +226,13 @@ test_h5s_basic(void)
DataSpace sid3 (H5S_SIMPLE);
// Attempts to use incorrect dimensions, should fail
- try { sid3.setExtentSimple( SPACE1_RANK, dims1 ); }
- catch( DataSpaceIException error )
- {
- // ret value is already < 0 for an exception to be thrown;
- // also see Note 1 above
- VERIFY(FAIL, FAIL, error.getCFuncName());
+ try {
+ sid3.setExtentSimple( SPACE1_RANK, dims1 );
+
+ // but didn't, issue an error message
+ issue_fail_msg("DataSpace::setExtentSimple", __LINE__, __FILE__);
}
+ catch (DataSpaceIException error) {} // do nothing, FAIL expected
} /* test_h5s_basic() */
/*-------------------------------------------------------------------------
@@ -266,22 +267,22 @@ test_h5s_scalar_write(void)
//n = H5Sget_simple_extent_npoints(sid1);
hssize_t n; /* Number of dataspace elements */
n = sid1.getSimpleExtentNpoints();
- VERIFY(n, 1, "DataSpace::getSimpleExtentNpoints");
+ verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
int rank; /* Logical rank of dataspace */
rank = sid1.getSimpleExtentNdims();
- VERIFY(rank, SPACE3_RANK, "DataSpace::getSimpleExtentNdims");
+ verify_val(rank, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Retrieves dimension size of dataspace sid1 and verify it
int ndims; /* Number of dimensions */
hsize_t tdims[4]; /* Dimension array to test with */
ndims = sid1.getSimpleExtentDims( tdims );
- VERIFY(ndims, 0, "DataSpace::getSimpleExtentDims");
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
/* Verify extent type */
H5S_class_t ext_type; /* Extent type */
ext_type = sid1.getSimpleExtentType();
- VERIFY(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType");
+ verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
/* Create a dataset */
DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
@@ -290,7 +291,7 @@ test_h5s_scalar_write(void)
} // end of try block
catch (Exception error)
{
- CHECK(FAIL, FAIL, error.getCFuncName());
+ issue_fail_msg(error.getCFuncName(), __LINE__, __FILE__);
}
} /* test_h5s_scalar_write() */
@@ -328,23 +329,23 @@ test_h5s_scalar_read(void)
// Get the number of dataspace elements
hssize_t n = sid1.getSimpleExtentNpoints();
- VERIFY(n, 1, "H5Sget_simple_extent_npoints");
+ verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of the dataspace
int ndims = sid1.getSimpleExtentNdims();
- VERIFY(ndims, SPACE3_RANK, "H5Sget_simple_extent_ndims");
+ verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
ndims = sid1.getSimpleExtentDims(tdims);
- VERIFY(ndims, 0, "H5Sget_simple_extent_dims");
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
unsigned rdata; /* Scalar data read in */
dataset.read(&rdata, PredType::NATIVE_UINT);
- VERIFY(rdata, space3_data, "H5Dread");
+ verify_val(rdata, space3_data, "DataSet::read", __LINE__, __FILE__);
} // end of try block
catch (Exception error)
{
// all the exceptions caused by negative returned values by C APIs
- CHECK(FAIL, FAIL, error.getCFuncName());
+ issue_fail_msg(error.getCFuncName(), __LINE__, __FILE__);
}
} /* test_h5s_scalar_read() */
@@ -381,7 +382,7 @@ test_h5s_null(void)
//n = H5Sget_simple_extent_npoints(sid1);
hssize_t n; /* Number of dataspace elements */
n = sid1.getSimpleExtentNpoints();
- VERIFY(n, 0, "DataSpace::getSimpleExtentNpoints");
+ verify_val(n, 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Create a dataset
DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
@@ -391,11 +392,11 @@ test_h5s_null(void)
// Read the data. Make sure no change to the buffer
dataset.read(&space5_data, PredType::NATIVE_INT);
- VERIFY(space5_data, 7, "H5Dread");
+ verify_val(space5_data, 7, "DataSet::read", __LINE__, __FILE__);
} // end of try block
catch (Exception error)
{
- CHECK(FAIL, FAIL, error.getCFuncName());
+ issue_fail_msg(error.getCFuncName(), __LINE__, __FILE__);
}
} /* test_h5s_null() */
@@ -446,15 +447,15 @@ test_h5s_compound_scalar_write(void)
// Get the number of dataspace elements
hssize_t n = sid1.getSimpleExtentNpoints();
- VERIFY(n, 1, "H5Sget_simple_extent_npoints");
+ verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of the dataspace
int ndims = sid1.getSimpleExtentNdims();
- VERIFY(ndims, SPACE3_RANK, "H5Sget_simple_extent_ndims");
+ verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
hsize_t tdims[4]; /* Dimension array to test with */
ndims = sid1.getSimpleExtentDims(tdims);
- VERIFY(ndims, 0, "H5Sget_simple_extent_dims");
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
/* Create a dataset */
DataSet dataset = fid1.createDataSet("Dataset1", tid1, sid1);
@@ -464,7 +465,7 @@ test_h5s_compound_scalar_write(void)
catch (Exception error)
{
// all the exceptions caused by negative returned values by C APIs
- CHECK(FAIL, FAIL, error.getCFuncName());
+ issue_fail_msg(error.getCFuncName(), __LINE__, __FILE__);
}
} /* test_h5s_compound_scalar_write() */
@@ -503,14 +504,14 @@ test_h5s_compound_scalar_read(void)
// Get the number of dataspace elements
hssize_t n = sid1.getSimpleExtentNpoints();
- VERIFY(n, 1, "H5Sget_simple_extent_npoints");
+ verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of the dataspace
int ndims = sid1.getSimpleExtentNdims();
- VERIFY(ndims, SPACE3_RANK, "H5Sget_simple_extent_ndims");
+ verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
ndims = sid1.getSimpleExtentDims(tdims);
- VERIFY(ndims, 0, "H5Sget_simple_extent_dims");
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
// Get the datatype of this dataset.
CompType type(dataset);
@@ -521,11 +522,11 @@ test_h5s_compound_scalar_read(void)
// Verify read data
if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct)))
{
- cout << "scalar data different: space4_data.c1="
+ cerr << "scalar data different: space4_data.c1="
<< space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl;
- cout << "scalar data different: space4_data.u="
+ cerr << "scalar data different: space4_data.u="
<< space4_data.u << ", read_data4.u=" << rdata.u << endl;
- cout << "scalar data different: space4_data.f="
+ cerr << "scalar data different: space4_data.f="
<< space4_data.f << ", read_data4.f=" << rdata.f << endl;
TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",
space4_data.c1, rdata.c2);
@@ -534,7 +535,7 @@ test_h5s_compound_scalar_read(void)
catch (Exception error)
{
// all the exceptions caused by negative returned values by C APIs
- CHECK(FAIL, FAIL, error.getCFuncName());
+ issue_fail_msg(error.getCFuncName(), __LINE__, __FILE__);
}
} /* test_h5s_compound_scalar_read() */
@@ -584,6 +585,6 @@ test_h5s(void)
void
cleanup_h5s(void)
{
- remove(DATAFILE);
+ remove(DATAFILE.c_str());
}