diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2005-01-07 18:42:17 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2005-01-07 18:42:17 (GMT) |
commit | 354122064ca35edac4e1a51b19ca5882f09ef8f3 (patch) | |
tree | 2c9fc3bf06a2b8fd340a5ff44eccb3090f17e94a /c++/test | |
parent | 621e25a3e5c0f528a3f94512edb298e1686bc6ff (diff) | |
download | hdf5-354122064ca35edac4e1a51b19ca5882f09ef8f3.zip hdf5-354122064ca35edac4e1a51b19ca5882f09ef8f3.tar.gz hdf5-354122064ca35edac4e1a51b19ca5882f09ef8f3.tar.bz2 |
[svn-r9776] Purpose: Clean up tests
Description:
Corrected a misuse of a variable causing access violation.
Platforms tested:
SunOS 5.7 (arabica)
Linux 2.4 (eirene)
Diffstat (limited to 'c++/test')
-rw-r--r-- | c++/test/tfile.cpp | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 02cee3e..e7b51bd 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -38,25 +38,40 @@ using namespace H5; #endif -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 hsize_t F1_USERBLOCK_SIZE = (hsize_t)0; +const size_t F1_OFFSET_SIZE = sizeof(haddr_t); +const size_t F1_LENGTH_SIZE = sizeof(hsize_t); +#ifdef H5_WANT_H5_V1_4_COMPAT const int F1_SYM_LEAF_K = 4; const int F1_SYM_INTERN_K = 16; +#else /* H5_WANT_H5_V1_4_COMPAT */ +const unsigned F1_SYM_LEAF_K = 4; +const unsigned F1_SYM_INTERN_K = 16; +#endif /* H5_WANT_H5_V1_4_COMPAT */ 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 hsize_t F2_USERBLOCK_SIZE = (hsize_t)512; +const size_t F2_OFFSET_SIZE = 8; +const size_t F2_LENGTH_SIZE = 8; +#ifdef H5_WANT_H5_V1_4_COMPAT +const int F2_SYM_LEAF_K = 4; const int F2_SYM_INTERN_K = 32; +#else /* H5_WANT_H5_V1_4_COMPAT */ +const unsigned F2_SYM_LEAF_K = 4; +const unsigned F2_SYM_INTERN_K = 32; +#endif /* H5_WANT_H5_V1_4_COMPAT */ 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 hsize_t F3_USERBLOCK_SIZE = (hsize_t)0; +const size_t F3_OFFSET_SIZE = F2_OFFSET_SIZE; +const size_t F3_LENGTH_SIZE = F2_LENGTH_SIZE; +#ifdef H5_WANT_H5_V1_4_COMPAT const int F3_SYM_LEAF_K = F2_SYM_LEAF_K; const int F3_SYM_INTERN_K = F2_SYM_INTERN_K; +#else /* H5_WANT_H5_V1_4_COMPAT */ +const unsigned F3_SYM_LEAF_K = F2_SYM_LEAF_K; +const unsigned F3_SYM_INTERN_K = F2_SYM_INTERN_K; +#endif /* H5_WANT_H5_V1_4_COMPAT */ const string FILE3("tfile3.h5"); const int KB = 1024; @@ -104,7 +119,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 @@ -117,8 +132,8 @@ test_file_create(void) * exists from the previous steps. */ try { - file1 = new H5File( FILE1, H5F_ACC_EXCL ); // should throw E - verify_val(file1->getId(), FAIL, "H5File constructor", __LINE__, __FILE__); + H5File file2(FILE1, H5F_ACC_EXCL); // should throw E + verify_val(file2.getId(), FAIL, "H5File constructor", __LINE__, __FILE__); } catch( FileIException E ) {} // do nothing, FAIL expected @@ -157,11 +172,9 @@ test_file_create(void) verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); #ifdef H5_WANT_H5_V1_4_COMPAT - int iparm1; /*file-creation parameters */ - int iparm2; /*file-creation parameters */ + int iparm1, iparm2; /*file-creation parameters */ #else /* H5_WANT_H5_V1_4_COMPAT */ - unsigned iparm1; /*file-creation parameters */ - unsigned iparm2; /*file-creation parameters */ + unsigned iparm1, iparm2; /*file-creation parameters */ #endif /* H5_WANT_H5_V1_4_COMPAT */ tmpl1.getSymk( iparm1, iparm2); verify_val(iparm1, F1_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); @@ -212,11 +225,9 @@ test_file_create(void) verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); #ifdef H5_WANT_H5_V1_4_COMPAT - int iparm1; /*file-creation parameters */ - int iparm2; /*file-creation parameters */ + int iparm1, iparm2; /*file-creation parameters */ #else /* H5_WANT_H5_V1_4_COMPAT */ - unsigned iparm1; /*file-creation parameters */ - unsigned iparm2; /*file-creation parameters */ + unsigned iparm1, iparm2; /*file-creation parameters */ #endif /* H5_WANT_H5_V1_4_COMPAT */ tmpl1->getSymk( iparm1, iparm2); verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); @@ -293,6 +304,7 @@ 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); @@ -300,11 +312,9 @@ test_file_open(void) verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); #ifdef H5_WANT_H5_V1_4_COMPAT - int iparm1; /*file-creation parameters */ - int iparm2; /*file-creation parameters */ + int iparm1, iparm2; /*file-creation parameters */ #else /* H5_WANT_H5_V1_4_COMPAT */ - unsigned iparm1; /*file-creation parameters */ - unsigned iparm2; /*file-creation parameters */ + unsigned iparm1, iparm2; /*file-creation parameters */ #endif /* H5_WANT_H5_V1_4_COMPAT */ tmpl1.getSymk( iparm1, iparm2); verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); |