diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2007-03-17 16:26:53 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2007-03-17 16:26:53 (GMT) |
commit | 1c4e6d163f781003ce1151781b3d403dc9b52e66 (patch) | |
tree | b07834021d14510d51e90736877fd938c1a9d904 /c++/test/th5s.cpp | |
parent | c4bbce8be19cd60e7ffd0180194c0e0e92091381 (diff) | |
download | hdf5-1c4e6d163f781003ce1151781b3d403dc9b52e66.zip hdf5-1c4e6d163f781003ce1151781b3d403dc9b52e66.tar.gz hdf5-1c4e6d163f781003ce1151781b3d403dc9b52e66.tar.bz2 |
[svn-r13524] Purpose: Cleanup tests
Description:
Added extern "C" to cleanup functions as well, forgot last time.
Cleaned up/Added comments to some of the newly added tests.
Platforms tested
AIX 5.1 (copper)
Linux 2.6 (kagiso)
SunOS 5.8 64-bit (sol)
Diffstat (limited to 'c++/test/th5s.cpp')
-rw-r--r-- | c++/test/th5s.cpp | 95 |
1 files changed, 47 insertions, 48 deletions
diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 9c49105..5a7c678 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -112,8 +112,7 @@ int space5_data = 7; * with a special routine. *------------------------------------------------------------------------- */ -static void -test_h5s_basic(void) +static void test_h5s_basic() { hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, @@ -122,11 +121,9 @@ test_h5s_basic(void) hsize_t tmax[4]; // Output message about test being performed - MESSAGE(5, ("Testing Dataspace Manipulation\n")); - - try - { // beginning of first try block + SUBTEST("Testing Dataspace Manipulation"); + try { // Create simple dataspace sid1 DataSpace sid1 (SPACE1_RANK, dims1 ); @@ -213,7 +210,7 @@ test_h5s_basic(void) // CHECK_I(ret, "H5Fclose"); // leave this here, later, fake a failure // in the p_close see how this will handle it. - BMR - // Verify that incorrect dimensions don't work + // Verify that incorrect dimensions don't work dims1[0] = 0; try { DataSpace wrongdim_ds (SPACE1_RANK, dims1); @@ -234,7 +231,9 @@ test_h5s_basic(void) } catch (DataSpaceIException E) // catching use of incorrect dimensions {} // do nothing, exception expected - } // end of outer try block + + PASSED(); + } // end of try block catch (InvalidActionException E) { @@ -244,7 +243,7 @@ test_h5s_basic(void) // catch all other exceptions catch (Exception E) { - issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_h5s_basic()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_basic() @@ -268,14 +267,12 @@ test_h5s_basic(void) * with a special routine. *------------------------------------------------------------------------- */ -static void -test_h5s_scalar_write(void) +static void test_h5s_scalar_write() { // Output message about test being performed - MESSAGE(5, ("Testing Scalar Dataspace Writing\n")); + SUBTEST("Testing Scalar Dataspace Writing"); - try - { + try { // Create file H5File fid1(DATAFILE, H5F_ACC_TRUNC); @@ -302,14 +299,15 @@ test_h5s_scalar_write(void) ext_type = sid1.getSimpleExtentType(); verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__); - // Create a dataset - DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1); - + // Create and write a dataset + DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1); dataset.write(&space3_data, PredType::NATIVE_UINT); + + PASSED(); } // end of try block catch (Exception E) { - issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_h5s_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_scalar_write() @@ -333,16 +331,14 @@ test_h5s_scalar_write(void) * with a special routine. *------------------------------------------------------------------------- */ -static void -test_h5s_scalar_read(void) +static void test_h5s_scalar_read() { hsize_t tdims[4]; // Dimension array to test with // Output message about test being performed - MESSAGE(5, ("Testing Scalar Dataspace Reading\n")); + SUBTEST("Testing Scalar Dataspace Reading"); - try - { + try { // Create file H5File fid1(DATAFILE, H5F_ACC_RDWR); @@ -362,14 +358,17 @@ test_h5s_scalar_read(void) ndims = sid1.getSimpleExtentDims(tdims); verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); + // Read data back and verify it unsigned rdata; // Scalar data read in dataset.read(&rdata, PredType::NATIVE_UINT); verify_val(rdata, space3_data, "DataSet::read", __LINE__, __FILE__); + + PASSED(); } // end of try block catch (Exception E) { // all the exceptions caused by negative returned values by C APIs - issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_h5s_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_scalar_read() @@ -394,14 +393,12 @@ test_h5s_scalar_read(void) * with a special routine. *------------------------------------------------------------------------- */ -static void -test_h5s_null(void) +static void test_h5s_null() { // Output message about test being performed - MESSAGE(5, ("Testing Null Dataspace Writing\n")); + SUBTEST("Testing Null Dataspace Writing"); - try - { + try { // Create file H5File fid1(DATAFILE, H5F_ACC_TRUNC); @@ -421,10 +418,12 @@ test_h5s_null(void) // Read the data. Make sure no change to the buffer dataset.read(&space5_data, PredType::NATIVE_INT); verify_val(space5_data, 7, "DataSet::read", __LINE__, __FILE__); + + PASSED(); } // end of try block catch (Exception E) { - issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_h5s_null()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_null() @@ -449,14 +448,12 @@ test_h5s_null(void) * with a special routine. *------------------------------------------------------------------------- */ -static void -test_h5s_compound_scalar_write(void) +static void test_h5s_compound_scalar_write() { // Output message about test being performed - MESSAGE(5, ("Testing Compound Dataspace Writing\n")); + SUBTEST("Testing Compound Dataspace Writing"); - try - { + try { // Create file H5File fid1(DATAFILE, H5F_ACC_TRUNC); @@ -490,15 +487,16 @@ test_h5s_compound_scalar_write(void) ndims = sid1.getSimpleExtentDims(tdims); verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__); - // Create a dataset + // Create and write a dataset DataSet dataset = fid1.createDataSet("Dataset1", tid1, sid1); - dataset.write(&space4_data, tid1); + + PASSED(); } // end of try block catch (Exception E) { // all the exceptions caused by negative returned values by C APIs - issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_h5s_compound_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_compound_scalar_write() @@ -523,15 +521,13 @@ test_h5s_compound_scalar_write(void) * with a special routine. *------------------------------------------------------------------------- */ -static void -test_h5s_compound_scalar_read(void) +static void test_h5s_compound_scalar_read() { hsize_t tdims[4]; // Dimension array to test with // Output message about test being performed - MESSAGE(5, ("Testing Compound Dataspace Reading\n")); - try - { + SUBTEST("Testing Compound Dataspace Reading"); + try { // Create file H5File fid1(DATAFILE, H5F_ACC_RDWR); @@ -569,11 +565,12 @@ test_h5s_compound_scalar_read(void) TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n", space4_data.c1, rdata.c2); } // end if + PASSED(); } // end of try block catch (Exception E) { // all the exceptions caused by negative returned values by C APIs - issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_h5s_compound_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_compound_scalar_read() @@ -594,7 +591,7 @@ test_h5s_compound_scalar_read(void) #ifdef __cplusplus extern "C" #endif -void test_h5s(void) +void test_h5s() { // Output message about test being performed MESSAGE(5, ("Testing Dataspaces\n")); @@ -622,9 +619,11 @@ void test_h5s(void) * *------------------------------------------------------------------------- */ -void -cleanup_h5s(void) +#ifdef __cplusplus +extern "C" +#endif +void cleanup_h5s() { - remove(DATAFILE.c_str()); + HDremove(DATAFILE.c_str()); } // cleanup_h5s |