summaryrefslogtreecommitdiffstats
path: root/c++/test
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
parent23a702e7bad93fc4f14eab07678c75d276e2d0ad (diff)
parent60f76980aab92f0e0730170b99a2363acd3c97fa (diff)
downloadhdf5-b8c6b68c35fa2be23ef488a1d81097ff3ed55000.zip
hdf5-b8c6b68c35fa2be23ef488a1d81097ff3ed55000.tar.gz
hdf5-b8c6b68c35fa2be23ef488a1d81097ff3ed55000.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')
-rw-r--r--c++/test/Makefile.in1
-rw-r--r--c++/test/dsets.cpp30
-rw-r--r--c++/test/h5cpputil.cpp19
-rw-r--r--c++/test/tarray.cpp33
-rw-r--r--c++/test/tattr.cpp19
-rw-r--r--c++/test/tcompound.cpp144
-rw-r--r--c++/test/tdspl.cpp11
-rw-r--r--c++/test/testhdf5.cpp10
-rw-r--r--c++/test/tfile.cpp160
-rw-r--r--c++/test/tfilter.cpp4
-rw-r--r--c++/test/th5s.cpp3
-rw-r--r--c++/test/tlinks.cpp79
-rw-r--r--c++/test/tobject.cpp29
-rw-r--r--c++/test/trefer.cpp2
-rw-r--r--c++/test/ttypes.cpp273
-rw-r--r--c++/test/tvlstr.cpp72
16 files changed, 505 insertions, 384 deletions
diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in
index 686df18..841a797 100644
--- a/c++/test/Makefile.in
+++ b/c++/test/Makefile.in
@@ -585,6 +585,7 @@ dvidir = @dvidir@
enable_shared = @enable_shared@
enable_static = @enable_static@
exec_prefix = @exec_prefix@
+fortran_linux_linker_option = @fortran_linux_linker_option@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index f534e33..8d2618b 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -28,16 +28,12 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
+#include <string>
#include "H5Cpp.h" // C++ API header file
-
- using namespace H5;
+using namespace H5;
#include "h5cpputil.h" // C++ utilility header file
@@ -70,8 +66,6 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
* Programmer: Binh-Minh Ribler (using C version)
* Friday, January 5, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -202,8 +196,6 @@ test_create( H5File& file)
* Programmer: Binh-Minh Ribler (using C version)
* Friday, January 5, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -288,8 +280,6 @@ test_simple_io( H5File& file)
* Programmer: Binh-Minh Ribler
* Thursday, March 22, 2012
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -358,8 +348,6 @@ test_datasize(FileAccPropList &fapl)
* Programmer: Binh-Minh Ribler (using C version)
* Friday, January 5, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -452,8 +440,6 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
* Programmer: Robb Matzke
* Tuesday, April 21, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static size_t
@@ -481,8 +467,6 @@ filter_bogus(unsigned int flags, size_t cd_nelmts,
* Programmer: Binh-Minh Ribler (using C version)
* Friday, January 5, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -884,8 +868,6 @@ static herr_t test_nbit_compression(H5File& file)
* Programmer: Binh-Minh Ribler (using C version)
* Saturday, February 17, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -966,8 +948,6 @@ test_multiopen (H5File& file)
* Programmer: Binh-Minh Ribler (using C version)
* February 17, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1223,8 +1203,6 @@ void test_dset()
*
* Programmer: (use C version)
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp
index ec35821..9f81895 100644
--- a/c++/test/h5cpputil.cpp
+++ b/c++/test/h5cpputil.cpp
@@ -24,17 +24,14 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
-#include "h5test.h"
-#include "H5Cpp.h"
+#include <string>
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
+#include "h5test.h"
#include "h5cpputil.h"
@@ -52,8 +49,6 @@ using namespace H5;
* Programmer: Binh-Minh Ribler (using C code segment for reporting tests)
* Friday, February 6, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int test_report( int nerrors, const H5std_string& testname )
@@ -140,8 +135,6 @@ void issue_fail_msg(const char* where, int line, const char* file_name,
* Programmer: Binh-Minh Ribler (using C code segment for checking values)
* Friday, February 6, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int check_values (hsize_t i, hsize_t j, int apoint, int acheck)
@@ -170,8 +163,6 @@ int check_values (hsize_t i, hsize_t j, int apoint, int acheck)
* Programmer: Binh-Minh Ribler
* May 2, 2010
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void verify_val(const char* x, const char* value, const char* where, int line, const char* file_name)
diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp
index c07ba42..218e4e5 100644
--- a/c++/test/tarray.cpp
+++ b/c++/test/tarray.cpp
@@ -22,19 +22,17 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
+#include <string>
#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5cpputil.h" // C++ utilility header file
const H5std_string FILENAME("tarray.h5");
+const H5std_string ARRAYTYPE_NAME("/Array type 1");
const int SPACE1_RANK = 1;
const hsize_t SPACE1_DIM1 = 4;
const int ARRAY1_RANK = 1;
@@ -60,8 +58,6 @@ typedef enum int_t {
* Programmer: Binh-Minh Ribler (using C version)
* January, 2016
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_array_compound_array()
@@ -131,9 +127,22 @@ static void test_array_compound_array()
// Write dataset to disk
dataset.write(wdata, arrtype);
+ // Test opening ArrayType with opening constructor (Dec 2016)
+
+ // Commit the arrtype to give it a name
+ arrtype.commit(file1, ARRAYTYPE_NAME);
+
+ // Close it, then re-open with the opening constructor
+ arrtype.close();
+ ArrayType named_type(file1, ARRAYTYPE_NAME);
+
+ // Get and verify the type's name
+ H5std_string type_name = named_type.getObjName();
+ verify_val(type_name, ARRAYTYPE_NAME, "DataType::getObjName tests constructor", __LINE__, __FILE__);
+ named_type.close();
+
// Close all
dataset.close();
- arrtype.close();
space.close();
file1.close();
@@ -282,8 +291,6 @@ static void test_array_compound_array()
* Description:
* Used user's sample code in HDFFV-9562
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/*
@@ -353,8 +360,6 @@ static void test_array_assignment()
* Programmer: Binh-Minh Ribler
* April, 2016
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_array_info()
@@ -499,8 +504,6 @@ void test_array()
* Programmer: Binh-Minh Ribler (using C version)
* January, 2016
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index e3526c6..d97d478 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -23,13 +23,10 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
+#include <string>
#include "H5Cpp.h" // C++ API header file
using namespace H5;
@@ -1290,6 +1287,14 @@ static void test_attr_dtype_shared()
// Commit datatype to file
dtype.commit(fid1, TYPE1_NAME);
+ // Retrieve and verify information about the type
+ H5O_info_t oinfo;
+ fid1.getObjectInfo(TYPE1_NAME, &oinfo);
+ if (oinfo.type != H5O_TYPE_NAMED_DATATYPE)
+ TestErrPrintf("Line %d: object type wrong!\n", __LINE__);
+ verify_val(oinfo.num_attrs, 0, "DataType::getObjinfo reference count", __LINE__, __FILE__);
+ verify_val((int)oinfo.rc, 1, "DataType::getObjinfo reference count", __LINE__, __FILE__);
+
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Check reference count on named datatype
fid1.getObjinfo(TYPE1_NAME, statbuf);
@@ -1879,8 +1884,6 @@ void test_attr()
* Programmer: Albert Cheng
* July 2, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp
index 09134ed..ce2d061 100644
--- a/c++/test/tcompound.cpp
+++ b/c++/test/tcompound.cpp
@@ -22,24 +22,21 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
+#include <string>
#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5cpputil.h" // C++ utilility header file
/* Number of elements in each test */
-#define NTESTELEM 100000
+#define NTESTELEM 100000
typedef struct complex_t {
- double re;
- double im;
+ double re;
+ double im;
} complex_t;
@@ -53,8 +50,6 @@ typedef struct complex_t {
* Programmer: Binh-Minh Ribler (using C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_compound_1()
@@ -90,8 +85,6 @@ static void test_compound_1()
* Programmer: Binh-Minh Ribler (use C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_compound_2()
@@ -103,11 +96,11 @@ static void test_compound_2()
int e, d, c[4], b, a;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- const int nelmts = NTESTELEM;
- const hsize_t four = 4;
- int i;
+ src_typ_t *s_ptr;
+ dst_typ_t *d_ptr;
+ const int nelmts = NTESTELEM;
+ const hsize_t four = 4;
+ int i;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
ArrayType *array_dt = NULL;
@@ -115,9 +108,9 @@ static void test_compound_2()
SUBTEST("Compound Element Reordering");
try {
// Sizes should be the same, but be careful just in case
- buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t));
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
for (i=0; i<nelmts; i++) {
s_ptr = ((src_typ_t*)orig) + i;
s_ptr->a = i*8+0;
@@ -183,9 +176,9 @@ static void test_compound_2()
}
}
// Release resources
- free(buf);
- free(bkg);
- free(orig);
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
s_ptr = NULL;
d_ptr = NULL;
st.close();
@@ -215,8 +208,6 @@ static void test_compound_2()
* Programmer: Binh-Minh Ribler (use C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_compound_3()
@@ -228,11 +219,11 @@ static void test_compound_3()
int a, c[4], e;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
- const hsize_t four = 4;
+ src_typ_t *s_ptr;
+ dst_typ_t *d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
+ const hsize_t four = 4;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
ArrayType* array_dt = NULL;
@@ -240,9 +231,9 @@ static void test_compound_3()
SUBTEST("Compound Datatype Subset Conversions");
try {
/* Initialize */
- buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t));
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
for (i=0; i<nelmts; i++) {
s_ptr = ((src_typ_t*)orig) + i;
s_ptr->a = i*8+0;
@@ -305,9 +296,9 @@ static void test_compound_3()
} // for
/* Release resources */
- free(buf);
- free(bkg);
- free(orig);
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
s_ptr = NULL;
d_ptr = NULL;
st.close();
@@ -337,8 +328,6 @@ static void test_compound_3()
* Programmer: Binh-Minh Ribler (use C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_compound_4()
@@ -355,11 +344,11 @@ static void test_compound_4()
int e;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
- const hsize_t four = 4;
+ src_typ_t *s_ptr;
+ dst_typ_t *d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
+ const hsize_t four = 4;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
ArrayType* array_dt = NULL;
@@ -367,9 +356,9 @@ static void test_compound_4()
SUBTEST("Compound Element Shrinking & Reordering");
try {
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t));
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
for (i=0; i<nelmts; i++) {
s_ptr = ((src_typ_t*)orig) + i;
s_ptr->a = i*8+0;
@@ -378,7 +367,7 @@ static void test_compound_4()
s_ptr->c[1] = i*8+3;
s_ptr->c[2] = i*8+4;
s_ptr->c[3] = i*8+5;
- s_ptr->d = (i*8+6) & 0x7fff;
+ s_ptr->d = (i*8+6) & 0x7fff;
s_ptr->e = i*8+7;
}
memcpy(buf, orig, nelmts*sizeof(src_typ_t));
@@ -437,9 +426,9 @@ static void test_compound_4()
} // for
/* Release resources */
- free(buf);
- free(bkg);
- free(orig);
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
s_ptr = NULL;
d_ptr = NULL;
st.close();
@@ -470,8 +459,6 @@ static void test_compound_4()
* Programmer: Binh-Minh Ribler (use C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_compound_5()
@@ -488,12 +475,12 @@ static void test_compound_5()
int coll_ids[4];
} dst_typ_t;
- hsize_t dims[1] = {4};
- src_typ_t src[2] = {{"one", 102, {104, 105, 106, 107}},
- {"two", 202, {204, 205, 206, 207}}};
- dst_typ_t *dst;
- void *buf = calloc(2, sizeof(dst_typ_t));
- void *bkg = calloc(2, sizeof(dst_typ_t));
+ hsize_t dims[1] = {4};
+ src_typ_t src[2] = {{"one", 102, {104, 105, 106, 107}},
+ {"two", 202, {204, 205, 206, 207}}};
+ dst_typ_t *dst;
+ void *buf = HDcalloc(2, sizeof(dst_typ_t));
+ void *bkg = HDcalloc(2, sizeof(dst_typ_t));
ArrayType* array_dt = NULL;
// Output message about test being performed
@@ -545,8 +532,8 @@ static void test_compound_5()
{ H5_FAILED(); }
/* Free memory buffers */
- free(buf);
- free(bkg);
+ HDfree(buf);
+ HDfree(bkg);
dst = NULL;
PASSED();
} // end of try block
@@ -573,8 +560,6 @@ static void test_compound_5()
* Programmer: Binh-Minh Ribler (use C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_compound_6()
@@ -589,23 +574,23 @@ static void test_compound_6()
long d;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
+ src_typ_t *s_ptr;
+ dst_typ_t *d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
// Output message about test being performed
SUBTEST("Compound Element Growing");
try {
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t));
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
for (i=0; i<nelmts; i++) {
s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->b = (i*8+1) & 0x7fff;
- s_ptr->d = (i*8+6) & 0x7fff;
+ s_ptr->b = (i*8+1) & 0x7fff;
+ s_ptr->d = (i*8+6) & 0x7fff;
}
memcpy(buf, orig, nelmts*sizeof(src_typ_t));
@@ -638,9 +623,9 @@ static void test_compound_6()
} // for
/* Release resources */
- free(buf);
- free(bkg);
- free(orig);
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
s_ptr = NULL;
d_ptr = NULL;
st.close();
@@ -665,8 +650,6 @@ static void test_compound_6()
* Programmer: Binh-Minh Ribler (use C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_compound_7()
@@ -731,8 +714,6 @@ static void test_compound_7()
* Programmer: Binh-Minh Ribler (use partial C version test_ooo_order)
* March, 2014
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
const H5std_string COMPFILE("tcompound_types.h5");
@@ -821,15 +802,12 @@ static void test_compound_set_size()
* Programmer: Binh-Minh Ribler
* January 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
void test_compound()
{
// Output message about test being performed
- //MESSAGE("Testing Compound Data Type operations\n");
MESSAGE(5, ("Testing Compound Data Type operations\n"));
test_compound_1(); // various things about compound data types
@@ -850,8 +828,6 @@ void test_compound()
*
* Return: none
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp
index d54d541..0a60a86 100644
--- a/c++/test/tdspl.cpp
+++ b/c++/test/tdspl.cpp
@@ -14,7 +14,7 @@
/*****************************************************************************
FILE
tdspl.cpp - HDF5 C++ testing the dataset memory and transfer property
- list functionality
+ list functionality
***************************************************************************/
@@ -23,13 +23,10 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
+#include <string>
#include "H5Cpp.h" // C++ API header file
using namespace H5;
diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp
index 6a5b70d..b998f76 100644
--- a/c++/test/testhdf5.cpp
+++ b/c++/test/testhdf5.cpp
@@ -44,14 +44,10 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
-#include "h5test.h" // C test header file
+#include <string>
#include "H5Cpp.h" // C++ API header file
using namespace H5;
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)
*
*-------------------------------------------------------------------------
*/
diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp
index 275bdb6..2e3c07c 100644
--- a/c++/test/tfilter.cpp
+++ b/c++/test/tfilter.cpp
@@ -80,8 +80,6 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
* Programmer: Robb Matzke
* Tuesday, April 21, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static size_t
@@ -287,8 +285,6 @@ void test_filters()
* Programmer: Quincey Koziol
* September 10, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp
index e511619..18cd460 100644
--- a/c++/test/th5s.cpp
+++ b/c++/test/th5s.cpp
@@ -556,7 +556,6 @@ static void test_h5s_compound_scalar_read()
* Programmer: Binh-Minh Ribler (using C version)
* Mar 2001
*
- * Modifications:
*-------------------------------------------------------------------------
*/
extern "C"
@@ -584,8 +583,6 @@ void test_h5s()
* Programmer: Albert Cheng
* July 2, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index 1328a19..b38ed39 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -22,13 +22,10 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
+#include <string>
#include "H5Cpp.h" // C++ API header file
using namespace H5;
@@ -44,9 +41,9 @@ using namespace H5;
//#define H5G_TESTING
//#include "h5test.h"
-//#include "H5Gpkg.h" /* Groups */
-//#include "H5Iprivate.h" /* IDs */
-//#include "H5Lprivate.h" /* Links */
+//#include "H5Gpkg.h" // Groups
+//#include "H5Iprivate.h" // IDs
+//#include "H5Lprivate.h" // Links
/* File for external link test. Created with gen_udlinks.c */
#define LINKED_FILE "be_extlink2.h5"
@@ -117,22 +114,22 @@ const char *FILENAME[] = {
#define MAX_NAME_LEN ((64*1024)+1024)
/* Link type IDs */
-#define UD_HARD_TYPE 201
-#define UD_CB_TYPE H5L_TYPE_MAX
-#define UD_PLIST_TYPE 128
-#define UD_CBFAIL_TYPE UD_PLIST_TYPE
-#define UD_ERROR_TYPE 189
-#define UD_BAD_TYPE1 H5L_TYPE_HARD
-#define UD_BAD_TYPE2 (H5L_TYPE_UD_MIN - 5)
-#define UD_BAD_VERS (H5L_LINK_CLASS_T_VERS + 1)
-
-#define DEST_PROP_NAME "destination_group"
-#define REREG_TARGET_NAME "rereg_target"
-
-#define UD_CB_LINK_NAME "ud_callback_link"
+#define UD_HARD_TYPE 201
+#define UD_CB_TYPE H5L_TYPE_MAX
+#define UD_PLIST_TYPE 128
+#define UD_CBFAIL_TYPE UD_PLIST_TYPE
+#define UD_ERROR_TYPE 189
+#define UD_BAD_TYPE1 H5L_TYPE_HARD
+#define UD_BAD_TYPE2 (H5L_TYPE_UD_MIN - 5)
+#define UD_BAD_VERS (H5L_LINK_CLASS_T_VERS + 1)
+
+#define DEST_PROP_NAME "destination_group"
+#define REREG_TARGET_NAME "rereg_target"
+
+#define UD_CB_LINK_NAME "ud_callback_link"
#define NEW_UD_CB_LINK_NAME "ud_callback_link2"
-#define UD_CB_TARGET "ud_target"
-#define UD_CB_TARGET_LEN 10
+#define UD_CB_TARGET "ud_target"
+#define UD_CB_TARGET_LEN 10
#define LE_FILENAME "le_extlink1.h5"
#define BE_FILENAME "be_extlink1.h5"
@@ -145,9 +142,9 @@ const char *FILENAME[] = {
/* Creation order macros */
#define CORDER_GROUP_NAME "corder_group"
#define CORDER_SOFT_GROUP_NAME "corder_soft_group"
-#define CORDER_NLINKS 18
-#define CORDER_ITER_STOP 3
-#define CORDER_EST_ENTRY_LEN 9
+#define CORDER_NLINKS 18
+#define CORDER_ITER_STOP 3
+#define CORDER_EST_ENTRY_LEN 9
/* Timestamp macros */
#define TIMESTAMP_GROUP_1 "timestamp1"
@@ -328,21 +325,19 @@ static const char *FILENAME[] = {
*
* Purpose: Test building a file with assorted links.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
* Programmer: Binh-Minh Ribler
* October 16, 2009
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_basic_links(hid_t fapl_id, hbool_t new_format)
{
- hsize_t size[1] = {1};
- char filename[NAME_BUF_SIZE];
+ hsize_t size[1] = {1};
+ char filename[NAME_BUF_SIZE];
// Use the file access template id to create a file access prop. list.
FileAccPropList fapl(fapl_id);
@@ -443,17 +438,15 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
/*-------------------------------------------------------------------------
* Function: test_num_links
*
- * Purpose Test setting and getting limit of number of links
+ * Purpose: Test setting and getting limit of number of links
*
- * Return Success: 0
+ * Return: Success: 0
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler
+ * Programmer: Binh-Minh Ribler
* Mar, 2017
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_num_links(hid_t fapl_id, hbool_t new_format)
@@ -477,7 +470,7 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format)
size_t nlinks = 5;
lapl.setNumLinks(nlinks);
- // Read it back and verify
+ // Read it back and verify
size_t read_nlinks = lapl.getNumLinks();
verify_val(read_nlinks, nlinks, "LinkAccPropList::setNumLinks", __LINE__, __FILE__);
@@ -504,9 +497,9 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format)
extern "C"
void test_links()
{
- hid_t fapl_id, fapl2_id; /* File access property lists */
- hbool_t new_format; /* Whether to use the new format or not */
- const char *envval;
+ hid_t fapl_id, fapl2_id; // File access property lists
+ hbool_t new_format; // Whether to use the new format or not
+ const char *envval;
envval = HDgetenv("HDF5_DRIVER");
if(envval == NULL)
@@ -687,8 +680,6 @@ void test_links()
* Programmer: Binh-Minh Ribler
* October 16, 2009
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp
index 59716dd..c053604 100644
--- a/c++/test/tobject.cpp
+++ b/c++/test/tobject.cpp
@@ -22,13 +22,10 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
+#include <string>
#include "H5Cpp.h" // C++ API header file
using namespace H5;
@@ -61,8 +58,6 @@ const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset in
* Programmer: Binh-Minh Ribler
* Friday, March 4, 2014
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_get_objname()
@@ -159,8 +154,6 @@ static void test_get_objname()
* Programmer: Binh-Minh Ribler
* March 4, 2014
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_get_objname_ontypes()
@@ -244,8 +237,6 @@ static void test_get_objname_ontypes()
* Programmer: Binh-Minh Ribler
* Friday, March 4, 2014
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_get_objtype()
@@ -301,15 +292,13 @@ static void test_get_objtype()
/*-------------------------------------------------------------------------
* Function: test_open_object_header
*
- * Purpose Test H5Location::openObjId function.
+ * Purpose: Test H5Location::openObjId function.
*
- * Return None
+ * Return: None
*
- * Programmer Binh-Minh Ribler (use C version)
+ * Programmer: Binh-Minh Ribler (use C version)
* May 15, 2017
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
const H5std_string GROUPNAME("group");
@@ -428,8 +417,6 @@ static void test_open_object_header()
* Programmer: Binh-Minh Ribler
* May 15, 2017
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_is_valid()
@@ -483,8 +470,6 @@ static void test_is_valid()
* Programmer: Binh-Minh Ribler
* Friday, Mar 4, 2014
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
@@ -510,8 +495,6 @@ void test_object()
*
* Programmer: (use C version)
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp
index f088240..9f43054 100644
--- a/c++/test/trefer.cpp
+++ b/c++/test/trefer.cpp
@@ -23,8 +23,8 @@
#else
#include <iostream>
#endif
-#include <string>
+#include <string>
#include "H5Cpp.h" // C++ API header file
using namespace H5;
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index 30504bc..a706197 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -22,13 +22,10 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
+#include <string>
#include "H5Cpp.h" // C++ API header file
using namespace H5;
@@ -81,19 +78,23 @@ typedef enum int_t {
INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, INT_OTHER
} int_t;
+typedef struct {
+ int a;
+ float b;
+ long c;
+ double d;
+} src_typ_t;
/*-------------------------------------------------------------------------
* Function: test_classes
*
* Purpose: Test type classes
*
- * Return: None.
+ * Return: None
*
* Programmer: Binh-Minh Ribler (using C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_classes()
@@ -126,15 +127,11 @@ static void test_classes()
*
* Purpose: Test datatype copy functionality
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: None
*
* Programmer: Binh-Minh Ribler (using C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void test_copy()
@@ -183,15 +180,11 @@ static void test_copy()
*
* Purpose: Tests query functions of compound and enumeration types.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: None
*
* Programmer: Binh-Minh Ribler (use C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -200,12 +193,6 @@ const H5std_string EnumT_NAME("Enum_type");
static void test_query()
{
- typedef struct {
- int a;
- float b;
- long c;
- double d;
- } src_typ_t;
short enum_val;
// Output message about test being performed
@@ -311,15 +298,11 @@ static void test_query()
*
* Purpose: Tests transient datatypes.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: None
*
* Programmer: Binh-Minh Ribler (use C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
const char* filename1 = "dtypes1.h5";
@@ -390,15 +373,11 @@ static void test_transient ()
*
* Purpose: Tests named datatypes.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: None
*
* Programmer: Binh-Minh Ribler (use C version)
* January, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
const H5std_string filename2("dtypes2.h5");
@@ -550,6 +529,227 @@ static void test_named ()
} // test_named
+/*-------------------------------------------------------------------------
+ * Function: test_encode_decode
+ *
+ * Purpose: Test datatype encode/decode functionality.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (using C version)
+ * October, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+const H5std_string filename3("encode_decode.h5");
+const int ARRAY1_RANK = 1;
+const int ARRAY1_DIM = 10;
+static void test_encode_decode()
+{
+ short enum_val;
+
+ SUBTEST("DataType::encode() and DataType::decode()");
+ try {
+ // Create the file.
+ H5File file(filename3, H5F_ACC_TRUNC);
+
+ //
+ // Test with CompType
+ //
+
+ // Create a compound datatype
+ CompType cmptyp(sizeof(src_typ_t));
+
+ cmptyp.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT);
+ cmptyp.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_FLOAT);
+ cmptyp.insertMember("c", HOFFSET(src_typ_t, c), PredType::NATIVE_LONG);
+ cmptyp.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_DOUBLE);
+
+ // Encode compound type in its buffer
+ cmptyp.encode();
+
+ // Verify that encoding had been done
+ verify_val(cmptyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
+
+ // Decode compound type's buffer to a new CompType
+ CompType* decoded_cmp_ptr(static_cast<CompType *>(cmptyp.decode()));
+
+ // Verify that the datatype was copied exactly via encoding/decoding
+ verify_val(cmptyp == *decoded_cmp_ptr, true, "DataType::decode", __LINE__, __FILE__);
+
+ // Verify again via querying member number and member index by name.
+ verify_val(decoded_cmp_ptr->getNmembers(), 4, "DataType::decode", __LINE__, __FILE__);
+ verify_val(decoded_cmp_ptr->getMemberIndex("c"), 2, "DataType::decode", __LINE__, __FILE__);
+
+ // Create a CompType instance from the pointer and verify it
+ CompType cmptyp_clone(*decoded_cmp_ptr);
+ verify_val(cmptyp == cmptyp_clone, true, "DataType::decode", __LINE__, __FILE__);
+ verify_val(cmptyp_clone.getNmembers(), 4, "DataType::decode", __LINE__, __FILE__);
+ verify_val(cmptyp_clone.getMemberIndex("c"), 2, "DataType::decode", __LINE__, __FILE__);
+
+ delete decoded_cmp_ptr;
+
+ //
+ // Test with EnumType
+ //
+
+ // Create a enumerate datatype
+ EnumType enumtyp(sizeof(short));
+
+ enumtyp.insert("RED", (enum_val=0,&enum_val));
+ enumtyp.insert("GREEN", (enum_val=1,&enum_val));
+ enumtyp.insert("BLUE", (enum_val=2,&enum_val));
+ enumtyp.insert("ORANGE", (enum_val=3,&enum_val));
+ enumtyp.insert("YELLOW", (enum_val=4,&enum_val));
+
+ // Encode compound type in a buffer
+ enumtyp.encode();
+
+ // Verify that encoding had been done
+ verify_val(enumtyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
+
+ // Decode enumeration type's buffer to a new EnumType
+ EnumType* decoded_enum_ptr(static_cast<EnumType *>(enumtyp.decode()));
+
+ // Verify that the datatype was copied exactly via encoding/decoding
+ verify_val(enumtyp == *decoded_enum_ptr, true, "DataType::decode", __LINE__, __FILE__);
+
+ // Verify again via querying member number and member index by name.
+ verify_val(decoded_enum_ptr->getNmembers(), 5, "DataType::decode", __LINE__, __FILE__);
+ verify_val(decoded_enum_ptr->getMemberIndex("GREEN"), 1, "DataType::decode", __LINE__, __FILE__);
+
+ // Create a EnumType instance from the pointer and verify it
+ EnumType enumtyp_clone(*decoded_enum_ptr);
+ verify_val(enumtyp == enumtyp_clone, true, "DataType::decode", __LINE__, __FILE__);
+ verify_val(enumtyp_clone.getNmembers(), 5, "DataType::decode", __LINE__, __FILE__);
+ verify_val(enumtyp_clone.getMemberIndex("GREEN"), 1, "DataType::decode", __LINE__, __FILE__);
+
+ delete decoded_enum_ptr;
+
+ //
+ // Test with variable-length string
+ //
+
+ // Create a variable-length string type
+ StrType vlsttyp(PredType::C_S1);
+ vlsttyp.setSize(H5T_VARIABLE);
+
+ // Encode the variable-length type in its buffer
+ vlsttyp.encode();
+
+ // Verify that encoding had been done
+ verify_val(vlsttyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
+
+ // Decode the variable-length type's buffer to a new StrType
+ StrType* decoded_str_ptr(static_cast<StrType *>(vlsttyp.decode()));
+
+ verify_val(vlsttyp == *decoded_str_ptr, true, "DataType::decode", __LINE__, __FILE__);
+ verify_val(decoded_str_ptr->isVariableStr(), true, "DataType::decode", __LINE__, __FILE__);
+
+ delete decoded_str_ptr;
+
+ // Test decoding the type by way of DataType*
+
+ // Decode variable-length string type to a new DataType
+ DataType* decoded_vlstr_ptr(vlsttyp.decode());
+
+ // Create a StrType instance from the DataType object and verify it
+ StrType decoded_vlsttyp(decoded_vlstr_ptr->getId());
+ verify_val(vlsttyp == decoded_vlsttyp, true, "DataType::decode", __LINE__, __FILE__);
+ verify_val(decoded_vlsttyp.isVariableStr(), true, "DataType::decode", __LINE__, __FILE__);
+
+ delete decoded_vlstr_ptr;
+
+ //
+ // Test with ArrayType
+ //
+
+ hsize_t tdims1[] = {ARRAY1_DIM};
+
+ // Create an array datatype of the compound datatype
+ ArrayType arrtyp(cmptyp, ARRAY1_RANK, tdims1);
+
+ // Encode the array type in its buffer
+ arrtyp.encode();
+
+ // Verify that encoding had been done
+ verify_val(arrtyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
+
+ // Create an ArrayType instance from the decoded pointer and verify it
+ ArrayType* decoded_arr_ptr(static_cast<ArrayType *>(arrtyp.decode()));
+
+ verify_val(arrtyp == *decoded_arr_ptr, true, "DataType::decode", __LINE__, __FILE__);
+
+ delete decoded_arr_ptr;
+
+ // Test decoding the type by way of DataType*
+
+ // Decode the array type's buffer
+ DataType *decoded_dt_ptr = arrtyp.decode();
+
+ // Create a ArrayType instance from the decoded pointer and verify it
+ ArrayType decoded_arrtyp(decoded_dt_ptr->getId());
+ verify_val(arrtyp == decoded_arrtyp, true, "DataType::decode", __LINE__, __FILE__);
+ verify_val(decoded_arrtyp.getArrayNDims(), ARRAY1_RANK, "DataType::decode", __LINE__, __FILE__);
+
+ delete decoded_dt_ptr;
+
+ //
+ // Test with IntType
+ //
+
+ // Create an int datatype
+ IntType inttyp(PredType::NATIVE_UINT);
+
+ // Encode the array type in its buffer
+ inttyp.encode();
+
+ // Verify that encoding had been done
+ verify_val(inttyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
+
+ // Create an IntType instance from the decoded pointer and verify it
+ IntType* decoded_int_ptr(static_cast<IntType *>(inttyp.decode()));
+ H5T_sign_t int_sign = decoded_int_ptr->getSign();
+ verify_val(int_sign, H5T_SGN_NONE, "DataType::decode", __LINE__, __FILE__);
+ verify_val(inttyp == *decoded_int_ptr, true, "DataType::decode", __LINE__, __FILE__);
+
+ delete decoded_int_ptr;
+
+ //
+ // Test decoding FloatType by way of DataType*
+ //
+
+ // Create a float datatype
+ FloatType flttyp(PredType::NATIVE_FLOAT);
+
+ // Encode the float type in its buffer
+ flttyp.encode();
+
+ // Verify that encoding had been done
+ verify_val(flttyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
+
+ // Decode the array type's buffer
+ DataType* decoded_flt_ptr(flttyp.decode());
+
+ // Create a IntType instance from the decoded pointer and verify it
+ FloatType decoded_flttyp(decoded_flt_ptr->getId());
+ verify_val(flttyp == decoded_flttyp, true, "DataType::decode", __LINE__, __FILE__);
+
+ H5std_string norm_string;
+ H5T_norm_t mant_norm = decoded_flttyp.getNorm(norm_string);
+ //verify_val(decoded_flttyp.isVariableStr(), true, "DataType::decode", __LINE__, __FILE__);
+
+ delete decoded_flt_ptr;
+
+ PASSED();
+ }
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_encode_decode", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+}
+
+
/****************************************************************
**
** test_types(): Main datatypes testing routine.
@@ -567,6 +767,7 @@ void test_types()
test_query();
test_transient();
test_named();
+ test_encode_decode();
} // test_types()
@@ -581,8 +782,6 @@ void test_types()
* Programmer: Quincey Koziol
* September 10, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"
diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp
index f49dbc0..d5f2afe 100644
--- a/c++/test/tvlstr.cpp
+++ b/c++/test/tvlstr.cpp
@@ -24,13 +24,10 @@
#else
#include <iostream>
#endif
-#include <string>
-
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
+using std::cerr;
+using std::endl;
+#include <string>
#include "H5Cpp.h" // C++ API header file
using namespace H5;
@@ -56,9 +53,9 @@ const hsize_t SPACE1_DIM1 = 4;
#if 0 // not used now
static void *test_vlstr_alloc_custom(size_t size, void *info)
{
- void *ret_value=NULL; // Pointer to return
+ void *ret_value=NULL; // Pointer to return
size_t *mem_used=(size_t *)info; // Get the pointer to the memory used
- size_t extra; // Extra space needed
+ size_t extra; // Extra space needed
/*
* This weird contortion is required on the DEC Alpha to keep the
@@ -92,7 +89,7 @@ static void test_vlstr_free_custom(void *_mem, void *info)
{
unsigned char *mem;
size_t *mem_used=(size_t *)info; // Get the pointer to the memory used
- size_t extra; // Extra space needed
+ size_t extra; // Extra space needed
/*
* This weird contortion is required on the DEC Alpha to keep the
@@ -349,7 +346,7 @@ static void test_vlstrings_special()
dataset.read(rdata, vlst);
// Check data read in.
- hsize_t ii; // counting variable
+ hsize_t ii; // counting variable
for (ii=0; ii<SPACE1_DIM1; ii++)
if(rdata[ii]!=NULL)
TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
@@ -359,14 +356,17 @@ static void test_vlstrings_special()
dataset.read(rdata, vlst);
// Compare data read in.
- for (ii = 0; ii < SPACE1_DIM1; ii++) {
+ for (ii = 0; ii < SPACE1_DIM1; ii++)
+ {
size_t wlen = HDstrlen(wdata[ii]);
size_t rlen = HDstrlen(rdata[ii]);
- if(wlen != rlen) {
+ if(wlen != rlen)
+ {
TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n", (int)ii, (unsigned)wlen, (int)ii, (unsigned)rlen);
continue;
} // end if
- if(HDstrcmp(wdata[ii],rdata[ii]) != 0) {
+ if(HDstrcmp(wdata[ii],rdata[ii]) != 0)
+ {
TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)ii, wdata[ii], (int)ii, rdata[ii]);
continue;
} // end if
@@ -385,7 +385,7 @@ static void test_vlstrings_special()
// Create the property list and set the fill value for the second
// dataset.
DSetCreatPropList dcpl;
- char *fill = NULL; // Fill value
+ char *fill = NULL; // Fill value
dcpl.setFillValue(vlst, &fill);
dataset = file1.createDataSet("Dataset4", vlst, sid1, dcpl);
@@ -397,8 +397,8 @@ static void test_vlstrings_special()
// Check data read in.
for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+ if(rdata[ii]!=NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
// Try to write nil strings to disk.
dataset.write(wdata2, vlst);
@@ -408,8 +408,8 @@ static void test_vlstrings_special()
// Check data read in.
for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+ if(rdata[ii]!=NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
// Close objects and file.
dataset.close();
@@ -480,27 +480,45 @@ static void test_vlstring_type()
vlst.close();
// Try opening datatype again.
- vlst = file1->openStrType(VLSTR_TYPE);
+ vlst = file1->openStrType(VLSTR_TYPE); // deprecated
- // Close datatype and file.
+ // Close again and reopen with constructor.
vlst.close();
+ StrType vlst1(*file1, VLSTR_TYPE);
+
+ // Close datatype and file.
+ vlst1.close();
file1->close();
delete file1;
// Open file.
file1 = new H5File(FILENAME, H5F_ACC_RDWR);
- // Open the variable-length string datatype just created
+ { // deprecated
+ // Open the variable-length string datatype just created.
vlst = file1->openStrType(VLSTR_TYPE);
- // Verify character set and padding
+ // Verify character set and padding.
cset = vlst.getCset();
verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__);
pad = vlst.getStrpad();
verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
- // Close datatype and file
+ // Close type to test new function.
vlst.close();
+ } // deprecated
+
+ // Open the variable-length string datatype just created.
+ StrType vlst2(*file1, VLSTR_TYPE);
+
+ // Verify character set and padding.
+ cset = vlst2.getCset();
+ verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__);
+ pad = vlst2.getStrpad();
+ verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
+
+ // Close datatype and file.
+ vlst2.close();
file1->close();
PASSED();
@@ -818,7 +836,7 @@ static void test_vlstring_array_attribute()
/* Helper routine for test_vl_rewrite() */
static void write_scalar_dset(H5File& file, DataType& type, DataSpace& space,
- char *name, char *data)
+ char *name, char *data)
{
DataSet dset;
try {
@@ -836,7 +854,7 @@ static void write_scalar_dset(H5File& file, DataType& type, DataSpace& space,
/* Helper routine for test_vl_rewrite() */
static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space,
- char *name, char *data)
+ char *name, char *data)
{
char *data_read;
DataSet dset;
@@ -891,7 +909,7 @@ static void test_vl_rewrite()
// Create in file 1.
int i;
- char name[256]; // Buffer for names & data
+ char name[256]; // Buffer for names & data
for (i=0; i<REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
write_scalar_dset(file1, type, space, name, name);
@@ -987,8 +1005,6 @@ void test_vlstrings()
* Programmer: Quincey Koziol
* September 10, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
extern "C"