From f9d785f7de7413d73606ec3d58f7a07e289dd409 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Fri, 9 Mar 2001 17:15:28 -0500 Subject: [svn-r3582] Purpose: Test code improvement Description: - Added H5_HAVE_ZLIB_H and H5_HAVE_LIBZ to dsets.cpp - Added the use of new API Exception::getCFuncName to obtain the name of the function where failure occurs, to various places in the test code. Platforms tested: arabica (sparc-sun-solaris 2.7) --- c++/test/dsets.cpp | 16 ++++++++-------- c++/test/testhdf5.cpp | 1 + c++/test/tfile.cpp | 32 ++++++++++++-------------------- 3 files changed, 21 insertions(+), 28 deletions(-) diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index b80a500..6d05f31 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -451,7 +451,7 @@ test_compression(H5File& file) DataSet* dataset = new DataSet (file.createDataSet (DSET_COMPRESS_NAME, PredType::NATIVE_INT, space1, dscreatplist)); -#ifdef H5_HAVE_COMPRESS2 +#if defined(H5_HAVE_COMPRESS2) && defined(H5_HAVE_ZLIB_H) && defined(H5_HAVE_LIBZ) PASSED(); #else SKIPPED(); @@ -477,7 +477,7 @@ test_compression(H5File& file) } } } -#ifdef H5_HAVE_COMPRESS2 +#if defined(H5_HAVE_COMPRESS2) && defined(H5_HAVE_ZLIB_H) && defined(H5_HAVE_LIBZ) PASSED(); #else SKIPPED(); @@ -501,8 +501,8 @@ test_compression(H5File& file) //if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points)<0) goto error; dataset->write ((void*) points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); -#ifdef H5_HAVE_COMPRESS2 +#if defined(H5_HAVE_COMPRESS2) && defined(H5_HAVE_ZLIB_H) && defined(H5_HAVE_LIBZ) PASSED(); #else SKIPPED(); @@ -526,7 +526,7 @@ test_compression(H5File& file) if (status == -1) goto error; } -#ifdef H5_HAVE_COMPRESS2 +#if defined(H5_HAVE_COMPRESS2) && defined(H5_HAVE_ZLIB_H) && defined(H5_HAVE_LIBZ) PASSED(); #else SKIPPED(); @@ -562,7 +562,7 @@ test_compression(H5File& file) if (status == -1) goto error; } -#ifdef H5_HAVE_COMPRESS2 +#if defined(H5_HAVE_COMPRESS2) && defined(H5_HAVE_ZLIB_H) && defined(H5_HAVE_LIBZ) PASSED(); #else SKIPPED(); @@ -591,7 +591,7 @@ test_compression(H5File& file) if (status == -1) goto error; } -#ifdef H5_HAVE_COMPRESS2 +#if defined(H5_HAVE_COMPRESS2) && defined(H5_HAVE_ZLIB_H) && defined(H5_HAVE_LIBZ) PASSED(); #else SKIPPED(); @@ -634,7 +634,7 @@ test_compression(H5File& file) } } } -#ifdef H5_HAVE_COMPRESS2 +#if defined(H5_HAVE_COMPRESS2) && defined(H5_HAVE_ZLIB_H) && defined(H5_HAVE_LIBZ) PASSED(); #else SKIPPED(); @@ -648,7 +648,7 @@ test_compression(H5File& file) */ TESTING("compression (app-defined method)"); - // BMR: not sure how to handle this yet??? + // BMR: not sure how to handle this yet if (H5Zregister (H5Z_BOGUS, DSET_BOGUS_NAME, bogus)<0) goto error; if (H5Pset_filter (dscreatplist.getId(), H5Z_BOGUS, 0, 0, NULL)<0) goto error; dscreatplist.setFilter (H5Z_BOGUS, 0, 0, NULL); diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index 6b3a64e..eee18e3 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -45,6 +45,7 @@ int Verbosity; // Use C version of the header file testhdf5.h instead of re-coding it #include "testhdf5.h" +#include #include "H5Cpp.h" #ifndef H5_NO_NAMESPACE diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 4acacc0..3a3cb1d 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -10,12 +10,13 @@ * Test the low-level file I/O features. */ -#include "H5private.h" -#include "H5Bprivate.h" -#include "H5Pprivate.h" +//#include "H5private.h" +//#include "H5Bprivate.h" +//#include "H5Pprivate.h" -#include "testhdf5.h" +#include #include "H5Cpp.h" +#include "testhdf5.h" #ifndef H5_NO_NAMESPACE using namespace H5; @@ -60,10 +61,6 @@ using namespace H5; static void test_file_create(void) { - hid_t tmpl1, tmpl2; /*file creation templates */ - int iparm, iparm2; - herr_t ret; /*generic return value */ - /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File Creation I/O\n")); @@ -72,7 +69,7 @@ test_file_create(void) /* Create with H5F_ACC_EXCL */ /* First ensure the file does not exist */ - //remove(FILE1); + remove(FILE1); try { H5File* fid1 = new H5File (FILE1, H5F_ACC_EXCL); @@ -137,10 +134,10 @@ test_file_create(void) delete fid1; } catch( PropListIException error ) { - CHECK(-1, FAIL, error.getCDetailMesg()); + CHECK(-1, FAIL, error.getCFuncName()); } catch( FileIException error ) { - CHECK(-1, FAIL, error.getCDetailMesg()); + CHECK(-1, FAIL, error.getCFuncName()); } try @@ -161,6 +158,7 @@ test_file_create(void) /* Release file-creation template */ delete tmpl1; +// here is still good /* Get the file-creation template */ tmpl1 = new FileCreatPropList (fid2.getCreatePlist()); @@ -214,10 +212,7 @@ test_file_create(void) delete tmpl1; } catch( PropListIException error ) { - CHECK(-1, FAIL, error.getCDetailMesg()); - } - catch( FileIException error ) { - CHECK(-1, FAIL, error.getCDetailMesg()); + CHECK(-1, FAIL, error.getCFuncName()); } } /* test_file_create() */ @@ -266,11 +261,8 @@ test_file_open(void) VERIFY(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk"); } // end of try block - catch( FileIException error ) { - CHECK(FAIL, FAIL, error.getCDetailMesg()); - } - catch( PropListIException error ) { - CHECK(FAIL, FAIL, error.getCDetailMesg()); + catch( Exception error ) { + CHECK(FAIL, FAIL, error.getCFuncName()); } } /* test_file_open() */ -- cgit v0.12