diff options
Diffstat (limited to 'c++')
-rw-r--r-- | c++/test/dsets.cpp | 38 | ||||
-rw-r--r-- | c++/test/testhdf5.cpp | 25 | ||||
-rw-r--r-- | c++/test/tfile.cpp | 84 |
3 files changed, 74 insertions, 73 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 6d05f31..d22cc77 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1,20 +1,14 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ +/* + * Copyright (C) 2001 National Center for Supercomputing Applications + * All rights reserved. + * + */ /*********************************************************** * * Test program: dsets * -* Test the dataset interface (H5D) +* Test the dataset interface * *************************************************************/ @@ -51,7 +45,7 @@ const char *FILENAME[] = { * * Failure: -1 * - * Programmer: Binh-Minh Ribler + * Programmer: Binh-Minh Ribler (using C version) * Friday, January 5, 2001 * * Modifications: @@ -203,7 +197,7 @@ check_values (hsize_t i, hsize_t j, int apoint, int acheck) * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using Robb Matzke's C version) + * Programmer: Binh-Minh Ribler (using C version) * Friday, January 5, 2001 * * Modifications: @@ -284,7 +278,7 @@ test_simple_io( H5File& file) * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using Robb Matzke's C version) + * Programmer: Binh-Minh Ribler (using C version) * Friday, January 5, 2001 * * Modifications: @@ -396,7 +390,7 @@ bogus(unsigned int flags, size_t cd_nelmts, * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using Robb Matzke's C version) + * Programmer: Binh-Minh Ribler (using C version) * Friday, January 5, 2001 * * Modifications: @@ -701,7 +695,7 @@ test_compression(H5File& file) * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using Robb Matzke's C version) + * Programmer: Binh-Minh Ribler (using C version) * Saturday, February 17, 2001 * * Modifications: @@ -782,7 +776,7 @@ test_multiopen (H5File& file) * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using Robb Matzke's C version) + * Programmer: Binh-Minh Ribler (using C version) * February 17, 2001 * * Modifications: @@ -965,7 +959,7 @@ int test_report( int nerrors ) * * Failure: exit(1) * - * Programmer: Binh-Minh Ribler (using Robb Matzke's C version) + * Programmer: Binh-Minh Ribler (using C version) * Friday, January 5, 2001 * * Modifications: @@ -1035,11 +1029,7 @@ main(void) h5_cleanup(FILENAME, fapl_id); return( test_report( nerrors )); } - catch (FileIException error) - { - return( test_report( nerrors )); - } - catch (GroupIException error ) + catch (Exception E) { return( test_report( nerrors )); } diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index eee18e3..17d2d50 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -167,18 +167,19 @@ main(int argc, char *argv[]) // testing file creation and opening in tfile.cpp InitTest("file", test_file, cleanup_file, "Low-Level File I/O"); - - // Comment out tests that are not done yet. - BMR, Feb 2001 - //InitTest("h5s", test_h5s, cleanup_h5s, "Dataspaces"); - //InitTest("attr", test_attr, cleanup_attr, "Attributes"); - //InitTest("select", test_select, cleanup_select, "Selections"); - //InitTest("time", test_time, cleanup_time, "Time Datatypes"); - //InitTest("reference", test_reference, cleanup_reference, "References"); - //InitTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes"); - //InitTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings"); - //InitTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration"); - //InitTest("array", test_array, cleanup_array, "Array Datatypes"); - //InitTest("genprop", test_genprop, cleanup_genprop, "Generic Properties"); + InitTest("h5s", test_h5s, cleanup_h5s, "Dataspaces"); + + /* Comment out tests that are not done yet. - BMR, Feb 2001 + InitTest("attr", test_attr, cleanup_attr, "Attributes"); + InitTest("select", test_select, cleanup_select, "Selections"); + InitTest("time", test_time, cleanup_time, "Time Datatypes"); + InitTest("reference", test_reference, cleanup_reference, "References"); + InitTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes"); + InitTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings"); + InitTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration"); + InitTest("array", test_array, cleanup_array, "Array Datatypes"); + InitTest("genprop", test_genprop, cleanup_genprop, "Generic Properties"); +Comment out tests that are not done yet */ Verbosity = 4; /* Default Verbosity is Low */ uintn major, minor, release; diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 3a3cb1d..1ef6c19 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -4,15 +4,13 @@ * */ -/* - * Test program: tfile - * - * Test the low-level file I/O features. - */ - -//#include "H5private.h" -//#include "H5Bprivate.h" -//#include "H5Pprivate.h" +/*********************************************************** +* +* Test program: tfile +* +* Test the low-level file I/O features +* +*************************************************************/ #include <iostream> #include "H5Cpp.h" @@ -20,7 +18,7 @@ #ifndef H5_NO_NAMESPACE using namespace H5; -#endif /* !H5_NO_NAMESPACE */ +#endif #define F1_USERBLOCK_SIZE (hsize_t)0 #define F1_OFFSET_SIZE sizeof(haddr_t) @@ -51,7 +49,7 @@ using namespace H5; * * Return: None * - * Programmer: Binh-Minh Ribler + * Programmer: Binh-Minh Ribler (use C version) * January, 2001 * * Modifications: @@ -78,12 +76,17 @@ test_file_create(void) * try to create the same file with H5F_ACC_TRUNC. This should fail * because fid1 is the same file and is currently open. */ - try { H5File fid2 (FILE1, H5F_ACC_TRUNC); } - catch( FileIException error ) { - // cannot use fid2 here (out of scope), but the exception was - // thrown only if file id was < 0, so -1 is used to verify - 1/15/01 - VERIFY(-1, FAIL, "H5File constructor"); - } + try { + H5File fid2 (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 + // also, more text about what is testing would be better. + VERIFY(fid2.getId(), FAIL, "H5File constructor"); + } + catch( FileIException E ) {} // do nothing, FAIL expected + // Close file fid1 delete fid1; @@ -91,8 +94,11 @@ test_file_create(void) * 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 ); } - catch( FileIException error ){ VERIFY(-1, FAIL, "H5File constructor"); } + try { + fid1 = new H5File( FILE1, H5F_ACC_EXCL ); // should throw E + VERIFY(fid1->getId(), FAIL, "H5File constructor"); + } + 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); @@ -101,21 +107,27 @@ test_file_create(void) * Try to truncate first file again. This should fail because fid1 is the * same file and is currently open. */ - try { H5File fid2 (FILE1, H5F_ACC_TRUNC); } - catch( FileIException error ) { VERIFY(-1, FAIL, "H5File constructor"); } + try { + H5File fid2 (FILE1, H5F_ACC_TRUNC); // should throw E + VERIFY(fid2.getId(), FAIL, "H5File constructor"); + } + catch( FileIException E ) {} // do nothing, FAIL expected /* * Try with H5F_ACC_EXCL. This should fail too because the file already * exists. */ - try { H5File fid3 (FILE1, H5F_ACC_EXCL); } - catch( FileIException error ) { VERIFY(-1, FAIL, "H5File constructor"); } + try { + H5File fid3 (FILE1, H5F_ACC_EXCL); // should throw E + VERIFY(fid3.getId(), FAIL, "H5File constructor"); + } + catch( FileIException E ) {} // do nothing, FAIL expected /* Get the file-creation template */ FileCreatPropList tmpl1 = fid1->getCreatePlist(); hsize_t ublock = tmpl1.getUserblock(); - VERIFY(ublock, F1_USERBLOCK_SIZE, "FileCreatPropList::H5Pget_userblock"); + VERIFY(ublock, F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock"); size_t parm1, parm2; /*file-creation parameters */ tmpl1.getSizes( parm1, parm2); @@ -133,11 +145,11 @@ test_file_create(void) /* Close first file */ delete fid1; } - catch( PropListIException error ) { - CHECK(-1, FAIL, error.getCFuncName()); + catch( PropListIException E ) { + CHECK(FAIL, FAIL, E.getCFuncName()); } - catch( FileIException error ) { - CHECK(-1, FAIL, error.getCFuncName()); + catch( FileIException E ) { + CHECK(FAIL, FAIL, E.getCFuncName()); } try @@ -158,7 +170,6 @@ test_file_create(void) /* Release file-creation template */ delete tmpl1; -// here is still good /* Get the file-creation template */ tmpl1 = new FileCreatPropList (fid2.getCreatePlist()); @@ -211,8 +222,8 @@ test_file_create(void) /* Dynamically release file-creation template */ delete tmpl1; } - catch( PropListIException error ) { - CHECK(-1, FAIL, error.getCFuncName()); + catch( PropListIException E ) { + CHECK(FAIL, FAIL, E.getCFuncName()); } } /* test_file_create() */ @@ -224,7 +235,7 @@ test_file_create(void) * * Return: None * - * Programmer: Binh-Minh Ribler + * Programmer: Binh-Minh Ribler (use C version) * January, 2001 * * Modifications: @@ -261,8 +272,8 @@ test_file_open(void) VERIFY(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk"); } // end of try block - catch( Exception error ) { - CHECK(FAIL, FAIL, error.getCFuncName()); + catch( Exception E ) { + CHECK(FAIL, FAIL, E.getCFuncName()); } } /* test_file_open() */ @@ -274,7 +285,7 @@ test_file_open(void) * * Return: None * - * Programmer: Binh-Minh Ribler + * Programmer: Binh-Minh Ribler (use C version) * January 2001 * * Modifications: @@ -299,8 +310,7 @@ test_file(void) * * Return: none * - * Programmer: Binh-Minh Ribler - * January 2001 + * Programmer: (use C version) * * Modifications: * |