summaryrefslogtreecommitdiffstats
path: root/c++/test/tfile.cpp
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2017-12-01 18:41:26 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2017-12-01 18:41:26 (GMT)
commitb8c6b68c35fa2be23ef488a1d81097ff3ed55000 (patch)
treec3429ee577e454526c8704d66a84f0c45b7959a1 /c++/test/tfile.cpp
parent23a702e7bad93fc4f14eab07678c75d276e2d0ad (diff)
parent60f76980aab92f0e0730170b99a2363acd3c97fa (diff)
downloadhdf5-hdf5-1_8_20.zip
hdf5-hdf5-1_8_20.tar.gz
hdf5-hdf5-1_8_20.tar.bz2
Merge pull request #811 in HDFFV/hdf5 from hdf5_1_8_20 to 1.8/masterhdf5-1_8_20
* commit '60f76980aab92f0e0730170b99a2363acd3c97fa': (108 commits) Update version numbers and remove empty sections in RELEASE.txt. Restore line 1154: C2Cppfunction_map.mht to HTML_EXTRA_FILES. Update version for 1.8.20 release. Fixed documentation warnings HDFFV-10329 Correct LINK INTERFACE and VS20013 compile Switch default build mode from development to production. Increment version string to pre2. Add RELEASE.txt note for HDFFV-10274. (cherry picked from commit f7a7d0a00613cba997212fa8032091629a678797) Initialize hid_t variables in test_Attr_bug9. (cherry picked from commit 97bc393449f3fe02c5992872ab2842e12f611ef0) Fix HDFFV-10274. When deleting all (or almost all) of the messages in an object header chunk, where the total amount deleted was greater than 64K, an error would occur due to an off by one error in the code that handled that case. Fixed this and added a test case. (cherry picked from commit 1b2c2ca9a6a7d7e1fcd5c3302e203f2e2dabf0af) Fix linking of libs Changed file path to relative. iAdd NAG to supported compilers in RELEASE.txt. Add description to RELEASE.txt for HDFFV-10323 Correct issue number Set version to 1.8.20-pre1 Update supported and tested platforms in RELEASE.txt. HDFFV-10321 Merge from 1.8 Incremented lib file .so numbers: revision for all except c++ for code change; current incremented, revision and age set to 0 for c++ due to symbols added and removed. updated issues related to Fortran Incremented lib file .so numbers: revision for all except c++ for dcode change; current incremented, revision and age set to 0 for c++ due to symbols added and removed. ...
Diffstat (limited to 'c++/test/tfile.cpp')
-rw-r--r--c++/test/tfile.cpp160
1 files changed, 77 insertions, 83 deletions
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index 8c626aa..059c548 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -35,30 +35,30 @@ using namespace H5;
#include "h5cpputil.h" // C++ utilility header file
-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);
-const unsigned F1_SYM_LEAF_K = 4;
-const unsigned F1_SYM_INTERN_K = 16;
-const H5std_string FILE1("tfile1.h5");
-
-const hsize_t F2_USERBLOCK_SIZE = (hsize_t)512;
-const size_t F2_OFFSET_SIZE = 8;
-const size_t F2_LENGTH_SIZE = 8;
-const unsigned F2_SYM_LEAF_K = 8;
-const unsigned F2_SYM_INTERN_K = 32;
-const unsigned F2_ISTORE = 64;
+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);
+const unsigned F1_SYM_LEAF_K = 4;
+const unsigned F1_SYM_INTERN_K = 16;
+const H5std_string FILE1("tfile1.h5");
+
+const hsize_t F2_USERBLOCK_SIZE = (hsize_t)512;
+const size_t F2_OFFSET_SIZE = 8;
+const size_t F2_LENGTH_SIZE = 8;
+const unsigned F2_SYM_LEAF_K = 8;
+const unsigned F2_SYM_INTERN_K = 32;
+const unsigned F2_ISTORE = 64;
const H5std_string FILE2("tfile2.h5");
-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;
-const unsigned F3_SYM_LEAF_K = F2_SYM_LEAF_K;
-const unsigned F3_SYM_INTERN_K = F2_SYM_INTERN_K;
+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;
+const unsigned F3_SYM_LEAF_K = F2_SYM_LEAF_K;
+const unsigned F3_SYM_INTERN_K = F2_SYM_INTERN_K;
const H5std_string FILE3("tfile3.h5");
-const int KB = 1024;
-const H5std_string FILE4("tfile4.h5");
+const int KB = 1024;
+const H5std_string FILE4("tfile4.h5");
/*-------------------------------------------------------------------------
@@ -73,11 +73,11 @@ const H5std_string FILE4("tfile4.h5");
*
* Modifications:
* January, 2005: C tests' macro VERIFY casts values to 'long' for all
- * cases. Since there are no operator<< for 'long long'
- * or int64 in VS C++ ostream, I casted the hsize_t values
- * passed to verify_val to 'long' as well. If problems
- * arises later, this will have to be specificly handled
- * with a special routine.
+ * cases. Since there are no operator<< for 'long long'
+ * or int64 in VS C++ ostream, I casted the hsize_t values
+ * passed to verify_val to 'long' as well. If problems
+ * arises later, this will have to be specificly handled
+ * with a special routine.
*
*-------------------------------------------------------------------------
*/
@@ -99,7 +99,7 @@ static void test_file_create()
// Create file FILE1
file1 = new H5File (FILE1, H5F_ACC_EXCL);
- // try to create the same file with H5F_ACC_TRUNC. This should fail
+ // Try to create the same file with H5F_ACC_TRUNC. This should fail
// because file1 is the same file and is currently open.
try {
H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
@@ -156,12 +156,12 @@ static void test_file_create()
hsize_t ublock = tmpl1.getUserblock();
verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
- size_t parm1, parm2; // file-creation parameters
+ size_t parm1, parm2; // file-creation parameters
tmpl1.getSizes( parm1, parm2);
verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; // file-creation parameters
+ unsigned iparm1,iparm2; // file-creation parameters
tmpl1.getSymk( iparm1, iparm2);
verify_val(iparm1, F1_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F1_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
@@ -214,12 +214,12 @@ static void test_file_create()
hsize_t ublock = tmpl1->getUserblock();
verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
- size_t parm1, parm2; // file-creation parameters
+ 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__);
- unsigned iparm1,iparm2; // file-creation parameters
+ unsigned iparm1,iparm2; // file-creation parameters
tmpl1->getSymk( iparm1, iparm2);
verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
@@ -280,11 +280,11 @@ static void test_file_create()
*
* Modifications:
* January, 2005: C tests' macro VERIFY casts values to 'long' for all
- * cases. Since there are no operator<< for 'long long'
- * or int64 in VS C++ ostream, I casted the hsize_t values
- * passed to verify_val to 'long' as well. If problems
- * arises later, this will have to be specificly handled
- * with a special routine.
+ * cases. Since there are no operator<< for 'long long'
+ * or int64 in VS C++ ostream, I casted the hsize_t values
+ * passed to verify_val to 'long' as well. If problems
+ * arises later, this will have to be specificly handled
+ * with a special routine.
*
*-------------------------------------------------------------------------
*/
@@ -305,13 +305,13 @@ static void test_file_open()
hsize_t ublock = tmpl1.getUserblock();
verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
- size_t parm1, parm2; // file-creation parameters
- tmpl1.getSizes( parm1, parm2);
+ 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__);
- unsigned iparm1,iparm2; // file-creation parameters
- tmpl1.getSymk( iparm1, iparm2);
+ unsigned iparm1,iparm2; // file-creation parameters
+ tmpl1.getSymk(iparm1, iparm2);
verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
@@ -361,8 +361,6 @@ static void test_file_open()
* Programmer: Raymond Lu
* June, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_file_size()
@@ -370,7 +368,7 @@ static void test_file_size()
// Output message about test being performed
SUBTEST("File Size");
- hid_t fapl_id;
+ hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
try {
@@ -408,8 +406,10 @@ static void test_file_size()
issue_fail_msg("test_file_size()", __LINE__, __FILE__, E.getCDetailMsg());
}
- // use C test utility routine to close property list.
- H5Pclose(fapl_id);
+ // This fapl_id was returned from h5_fileaccess.
+ herr_t ret = H5Pclose(fapl_id);
+ if (ret < 0)
+ issue_fail_msg("test_file_size()", __LINE__, __FILE__, "H5Pclose failed");
} // test_file_size()
@@ -424,18 +424,16 @@ static void test_file_size()
* Programmer: Binh-Minh Ribler
* July, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-const int RANK = 2;
-const int NX = 4;
-const int NY = 5;
-const H5std_string GROUPNAME ("group");
-const H5std_string DSETNAME ("dataset");
-const H5std_string DATTRNAME ("dataset attribute");
-const H5std_string FATTRNAME ("file attribute");
-const H5std_string DTYPENAME ("compound");
+const int RANK = 2;
+const int NX = 4;
+const int NY = 5;
+const H5std_string GROUPNAME ("group");
+const H5std_string DSETNAME ("dataset");
+const H5std_string DATTRNAME ("dataset attribute");
+const H5std_string FATTRNAME ("file attribute");
+const H5std_string DTYPENAME ("compound");
// Compound datatype
typedef struct s1_t {
@@ -502,15 +500,14 @@ static void test_file_name()
{
issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg());
}
-
} // test_file_name()
-const int RANK1 = 1;
-const int ATTR1_DIM1 = 3;
-const H5std_string FILE5("tfattrs.h5");
-const H5std_string FATTR1_NAME ("file attribute 1");
-const H5std_string FATTR2_NAME ("file attribute 2");
+const int RANK1 = 1;
+const int ATTR1_DIM1 = 3;
+const H5std_string FILE5("tfattrs.h5");
+const H5std_string FATTR1_NAME ("file attribute 1");
+const H5std_string FATTR2_NAME ("file attribute 2");
int fattr_data[ATTR1_DIM1]={512,-234,98123}; // Test data for file attribute
int dattr_data[ATTR1_DIM1]={256,-123,1000}; // Test data for dataset attribute
@@ -627,11 +624,12 @@ static void test_file_attribute()
issue_fail_msg("test_file_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_file_attribute()
+
-const H5std_string FILE6("tfile5.h5");
-const H5std_string ROOTGROUP("/");
-const H5std_string GROUP1("/G1");
-const H5std_string SUBGROUP3("/G1/G3");
+const H5std_string FILE6("tfile5.h5");
+const H5std_string ROOTGROUP("/");
+const H5std_string GROUP1("/G1");
+const H5std_string SUBGROUP3("/G1/G3");
/*-------------------------------------------------------------------------
* Function: test_libver_bounds_real
@@ -744,13 +742,13 @@ static void test_libver_bounds()
/*-------------------------------------------------------------------------
- * Function: test_commonfg
+ * Function: test_commonfg
*
- * Purpose Verify that H5File works as a root group.
+ * Purpose: Verify that H5File works as a root group.
*
- * Return None
+ * Return: None
*
- * Programmer Binh-Minh Ribler (use C version)
+ * Programmer: Binh-Minh Ribler (use C version)
* March, 2015
*
*-------------------------------------------------------------------------
@@ -811,13 +809,13 @@ const H5std_string FILE7("tfile7.h5");
/*-------------------------------------------------------------------------
* Function: test_file_info
*
- * Purpose Verify that various properties in a file creation property
+ * Purpose: Verify that various properties in a file creation property
* lists are stored correctly in the file and can be retrieved
* when the file is re-opened.
*
- * Return None
+ * Return: None
*
- * Programmer Binh-Minh Ribler
+ * Programmer: Binh-Minh Ribler
* February, 2017
*
*-------------------------------------------------------------------------
@@ -862,7 +860,7 @@ static void test_file_info()
fcpl.close();
// Get the file's version information.
- file7.getFileInfo(finfo); // there's no C test for H5Fget_info
+ file7.getFileInfo(finfo); // there's no C test for H5Fget_info
// Close the file.
file7.close();
@@ -874,7 +872,7 @@ static void test_file_info()
FileCreatPropList fcpl2 = file7.getCreatePlist();
// Get the file's version information.
- file7.getFileInfo(finfo); // there's no C test for H5Fget_info
+ file7.getFileInfo(finfo); // there's no C test for H5Fget_info
// Retrieve the property values & check them.
hsize_t userblock = fcpl2.getUserblock();
@@ -905,15 +903,13 @@ static void test_file_info()
/*-------------------------------------------------------------------------
* Function: test_file
*
- * Purpose Main file testing routine
+ * Purpose: Main file testing routine
*
- * Return None
+ * Return: None
*
- * Programmer Binh-Minh Ribler (use C version)
+ * Programmer: Binh-Minh Ribler (use C version)
* January 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
@@ -936,13 +932,11 @@ void test_file()
/*-------------------------------------------------------------------------
* Function: cleanup_file
*
- * Purpose Cleanup temporary test files
+ * Purpose: Cleanup temporary test files
*
- * Return none
+ * Return: none
*
- * Programmer (use C version)
- *
- * Modifications:
+ * Programmer: (use C version)
*
*-------------------------------------------------------------------------
*/