summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-12-29 14:32:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-12-29 14:32:06 (GMT)
commit37232bd4f0f8199f956c823cdff72ece2ca9aa16 (patch)
tree38e37f7208355500b7f223e90bf014424c63300b /c++/test
parent20146575aaeead9e05af73977dee863de63bf50f (diff)
downloadhdf5-37232bd4f0f8199f956c823cdff72ece2ca9aa16.zip
hdf5-37232bd4f0f8199f956c823cdff72ece2ca9aa16.tar.gz
hdf5-37232bd4f0f8199f956c823cdff72ece2ca9aa16.tar.bz2
[svn-r9729] Purpose:
Bug Fix/Code Cleanup/Doc Cleanup/Optimization/Branch Sync :-) Description: Generally speaking, this is the "signed->unsigned" change to selections. However, in the process of merging code back, things got stickier and stickier until I ended up doing a big "sync the two branches up" operation. So... I brought back all the "infrastructure" fixes from the development branch to the release branch (which I think were actually making some improvement in performance) as well as fixed several bugs which had been fixed in one branch, but not the other. I've also tagged the repository before making this checkin with the label "before_signed_unsigned_changes". Platforms tested: FreeBSD 4.10 (sleipnir) w/parallel & fphdf5 FreeBSD 4.10 (sleipnir) w/threadsafe FreeBSD 4.10 (sleipnir) w/backward compatibility Solaris 2.7 (arabica) w/"purify options" Solaris 2.8 (sol) w/FORTRAN & C++ AIX 5.x (copper) w/parallel & FORTRAN IRIX64 6.5 (modi4) w/FORTRAN Linux 2.4 (heping) w/FORTRAN & C++ Misc. update:
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/dsets.cpp19
-rw-r--r--c++/test/h5cpputil.cpp1
-rw-r--r--c++/test/h5cpputil.h2
-rw-r--r--c++/test/tfile.cpp12
-rw-r--r--c++/test/th5s.cpp75
5 files changed, 54 insertions, 55 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 97c5e51..8903cd7 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -33,7 +33,6 @@
#endif
#include "testhdf5.h"
-#include "h5test.h"
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
@@ -42,15 +41,15 @@ using namespace H5;
#include "h5cpputil.h"
-const string FILE1("dataset.h5");
-#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_NAME("compressed");
+const string DSET_BOGUS_NAME ("bogus");
-#define H5Z_FILTER_BOGUS 305
+const int H5Z_FILTER_BOGUS = 305;
// Local prototypes
static size_t bogus(unsigned int flags, size_t cd_nelmts,
@@ -601,7 +600,7 @@ test_compression(H5File& file)
TESTING("compression (partial I/O)");
const hsize_t hs_size[2] = {4, 50};
- const hssize_t hs_offset[2] = {7, 30};
+ const hsize_t hs_offset[2] = {7, 30};
for (i = 0; i < hs_size[0]; i++) {
for (j = 0; j < hs_size[1]; j++) {
points[hs_offset[0]+i][hs_offset[1]+j] = rand ();
diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp
index 020bab0..8bb0d85 100644
--- a/c++/test/h5cpputil.cpp
+++ b/c++/test/h5cpputil.cpp
@@ -93,4 +93,3 @@ void issue_fail_msg(const char* where, int line, const char* file_name)
}
}
-
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h
index d67c459..93ba1b9 100644
--- a/c++/test/h5cpputil.h
+++ b/c++/test/h5cpputil.h
@@ -46,7 +46,7 @@ template <class Type1, class Type2>
cerr << "*** UNEXPECTED VALUE from " << where << " should be "
<< value << ", but is " << x << " at line " << line
<< " in " << file_name << endl;
- H5Eprint (stdout);
+ H5Eprint (stderr);
}
}
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index 858c74c..02cee3e 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -104,7 +104,7 @@ test_file_create(void)
// name, that skips the comparison b/w the 1st & 2nd args would
// be more appropriate, but verify_val can be used for now;
// also, more text about what is testing would be better.
- verify_val(file2.getId(), FAIL, "H5File constructor", __LINE__, __FILE__);
+ verify_val(file2.getId(), FAIL, "H5File constructor", __LINE__, __FILE__);
}
catch( FileIException E ) {} // do nothing, FAIL expected
@@ -156,10 +156,11 @@ test_file_create(void)
verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- int iparm1; /*file-creation parameters */
#ifdef H5_WANT_H5_V1_4_COMPAT
+ int iparm1; /*file-creation parameters */
int iparm2; /*file-creation parameters */
#else /* H5_WANT_H5_V1_4_COMPAT */
+ unsigned iparm1; /*file-creation parameters */
unsigned iparm2; /*file-creation parameters */
#endif /* H5_WANT_H5_V1_4_COMPAT */
tmpl1.getSymk( iparm1, iparm2);
@@ -210,10 +211,11 @@ test_file_create(void)
verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- int iparm1; /*file-creation parameters */
#ifdef H5_WANT_H5_V1_4_COMPAT
+ int iparm1; /*file-creation parameters */
int iparm2; /*file-creation parameters */
#else /* H5_WANT_H5_V1_4_COMPAT */
+ unsigned iparm1; /*file-creation parameters */
unsigned iparm2; /*file-creation parameters */
#endif /* H5_WANT_H5_V1_4_COMPAT */
tmpl1->getSymk( iparm1, iparm2);
@@ -291,17 +293,17 @@ test_file_open(void)
/* Get the file-creation parameters */
hsize_t ublock = tmpl1.getUserblock();
verify_val(ublock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
- verify_val(ublock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
size_t parm1, parm2; /*file-creation parameters */
tmpl1.getSizes( parm1, parm2);
verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- int iparm1; /*file-creation parameters */
#ifdef H5_WANT_H5_V1_4_COMPAT
+ int iparm1; /*file-creation parameters */
int iparm2; /*file-creation parameters */
#else /* H5_WANT_H5_V1_4_COMPAT */
+ unsigned iparm1; /*file-creation parameters */
unsigned iparm2; /*file-creation parameters */
#endif /* H5_WANT_H5_V1_4_COMPAT */
tmpl1.getSymk( iparm1, iparm2);
diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp
index 5f62ed5..ff7e0bf 100644
--- a/c++/test/th5s.cpp
+++ b/c++/test/th5s.cpp
@@ -35,8 +35,8 @@
using namespace H5;
#endif /* !H5_NO_NAMESPACE */
-const char* TESTFILE = "th5s.h5";
-const char* DATAFILE = "th5s1.h5";
+const string TESTFILE("th5s.h5");
+const string DATAFILE("th5s1.h5");
/* 3-D dataset with fixed dimensions */
const string SPACE1_NAME("Space1");
@@ -118,20 +118,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_val(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3,
- "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ 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_val(rank, SPACE1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ 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_val(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0,
- "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ 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};
@@ -139,20 +139,20 @@ test_h5s_basic(void)
// Get simple extent npoints of dataspace sid2 and verify it
n = sid2.getSimpleExtentNpoints();
- verify_val(n, SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4,
- "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ 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_val(rank, SPACE2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ 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_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__);
+ 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 )
{
@@ -166,8 +166,8 @@ test_h5s_basic(void)
try {
DataSpace manydims_ds(H5S_MAX_RANK+1, dims3, NULL);
- // Should FAIL but didn't, so issue an error message
- issue_fail_msg("DataSpace constructor", __LINE__, __FILE__);
+ // Should FAIL but didn't, so issue an error message
+ issue_fail_msg("DataSpace constructor", __LINE__, __FILE__);
}
catch( DataSpaceIException error ) {} // do nothing, FAIL expected
@@ -180,11 +180,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
@@ -195,8 +195,8 @@ test_h5s_basic(void)
try {
DataSet dset1 = fid1.openDataSet( "dset" );
- // but didn't, issue an error message
- issue_fail_msg("H5File::openDataSet", __LINE__, __FILE__);
+ // 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
@@ -215,8 +215,7 @@ test_h5s_basic(void)
dims1[0] = 0;
try {
DataSpace wrongdim_ds (SPACE1_RANK, dims1);
- verify_val(wrongdim_ds.getId(), FAIL, "DataSpace constructor", __LINE__, __FILE__);
-
+ verify_val(wrongdim_ds.getId(), FAIL, "DataSpace constructor", __LINE__, __FILE__);
}
catch( DataSpaceIException error ) {} // do nothing; FAIL expected
@@ -225,7 +224,7 @@ test_h5s_basic(void)
// Attempts to use incorrect dimensions, should fail
try {
- sid3.setExtentSimple( SPACE1_RANK, dims1 );
+ sid3.setExtentSimple( SPACE1_RANK, dims1 );
// but didn't, issue an error message
issue_fail_msg("DataSpace::setExtentSimple", __LINE__, __FILE__);
@@ -265,11 +264,11 @@ test_h5s_scalar_write(void)
//n = H5Sget_simple_extent_npoints(sid1);
hssize_t n; /* Number of dataspace elements */
n = sid1.getSimpleExtentNpoints();
- verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
int rank; /* Logical rank of dataspace */
rank = sid1.getSimpleExtentNdims();
- verify_val(rank, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ verify_val(rank, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Retrieves dimension size of dataspace sid1 and verify it
int ndims; /* Number of dimensions */
@@ -280,7 +279,7 @@ test_h5s_scalar_write(void)
/* Verify extent type */
H5S_class_t ext_type; /* Extent type */
ext_type = sid1.getSimpleExtentType();
- verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
+ verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
/* Create a dataset */
DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
@@ -327,18 +326,18 @@ test_h5s_scalar_read(void)
// Get the number of dataspace elements
hssize_t n = sid1.getSimpleExtentNpoints();
- verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of the dataspace
int ndims = sid1.getSimpleExtentNdims();
- verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
ndims = sid1.getSimpleExtentDims(tdims);
- verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
unsigned rdata; /* Scalar data read in */
dataset.read(&rdata, PredType::NATIVE_UINT);
- verify_val(rdata, space3_data, "DataSet::read", __LINE__, __FILE__);
+ verify_val(rdata, space3_data, "DataSet::read", __LINE__, __FILE__);
} // end of try block
catch (Exception error)
{
@@ -395,15 +394,15 @@ test_h5s_compound_scalar_write(void)
// Get the number of dataspace elements
hssize_t n = sid1.getSimpleExtentNpoints();
- verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of the dataspace
int ndims = sid1.getSimpleExtentNdims();
- verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
hsize_t tdims[4]; /* Dimension array to test with */
ndims = sid1.getSimpleExtentDims(tdims);
- verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
/* Create a dataset */
DataSet dataset = fid1.createDataSet("Dataset1", tid1, sid1);
@@ -452,14 +451,14 @@ test_h5s_compound_scalar_read(void)
// Get the number of dataspace elements
hssize_t n = sid1.getSimpleExtentNpoints();
- verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ verify_val(n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of the dataspace
int ndims = sid1.getSimpleExtentNdims();
- verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
ndims = sid1.getSimpleExtentDims(tdims);
- verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
// Get the datatype of this dataset.
CompType type(dataset);
@@ -509,7 +508,7 @@ test_h5s(void)
test_h5s_basic(); /* Test basic H5S code */
test_h5s_scalar_write(); /* Test scalar H5S writing code */
- test_h5s_scalar_read(); /* Test scalar H5S reading code */
+ test_h5s_scalar_read(); /* Test scalar H5S reading code */
test_h5s_compound_scalar_write(); /* Test compound datatype scalar H5S writing code */
test_h5s_compound_scalar_read(); /* Test compound datatype scalar H5S reading code */
} /* test_h5s() */
@@ -532,6 +531,6 @@ test_h5s(void)
void
cleanup_h5s(void)
{
- remove(DATAFILE);
+ remove(DATAFILE.c_str());
}