From e33d677636b860f8f6b95c0ee3736395541a2610 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 4 Dec 2017 12:21:12 -0600 Subject: Various code cleanup Description: - Replaced H5Location::exists with H5Location::nameExists and marked H5Location::exists as deprecated. - Miscellaneous test cleanup for consistency. Platforms tested: Linux/32 2.6 (jam) Linux/64 (jelly) Darwin (osx1010test) --- c++/src/H5DataType.cpp | 2 +- c++/src/H5DataType.h | 11 +- c++/src/H5IntType.cpp | 2 +- c++/src/H5Location.cpp | 44 ++++++- c++/src/H5Location.h | 5 + c++/test/dsets.cpp | 70 +++-------- c++/test/h5cpputil.cpp | 9 -- c++/test/tarray.cpp | 58 ++++----- c++/test/tattr.cpp | 320 +++++++++++++++++++++++++++++-------------------- c++/test/tcompound.cpp | 34 +----- c++/test/tdspl.cpp | 22 +++- c++/test/tfile.cpp | 49 ++++---- c++/test/tfilter.cpp | 33 ++--- c++/test/th5s.cpp | 38 +++--- c++/test/titerate.cpp | 59 ++++----- c++/test/tlinks.cpp | 20 ++-- c++/test/tobject.cpp | 57 +++++---- c++/test/trefer.cpp | 116 +++++++++--------- c++/test/ttypes.cpp | 51 +++----- c++/test/tvlstr.cpp | 64 +++++----- 20 files changed, 521 insertions(+), 543 deletions(-) diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index d2bfbda..444a77a 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -899,7 +899,7 @@ hid_t DataType::p_opentype(const H5Location& loc, const char *dtype_name) const // Call C function to open the named datatype at this location hid_t ret_value = H5Topen2(loc.getId(), dtype_name, H5P_DEFAULT); if (ret_value < 0) - throw DataTypeIException("DataType constructor", "H5Topen2 failed"); + throw DataTypeIException(inMemFunc("constructor"), "H5Topen2 failed"); return(ret_value); } diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 5b8f924..906ccef 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -36,6 +36,10 @@ class H5_DLLCPP DataType : public H5Object { // Creates a copy of a predefined type DataType(const PredType& pred_type); + // Constructors to open a generic named datatype at a given location. + DataType(const H5Location& loc, const char* name); + DataType(const H5Location& loc, const H5std_string& name); + // Creates a datatype by way of dereference. DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); @@ -124,13 +128,6 @@ class H5_DLLCPP DataType : public H5Object { ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataType"); } -// From CommonFG then H5Location - // Constructors to open a generic named datatype at a given location. - DataType(const H5Location& loc, const char* name); - DataType(const H5Location& loc, const H5std_string& name); - -// End of From CommonFG then H5Location - // Creates a copy of an existing DataType using its id DataType(const hid_t type_id); diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp index ef4e1a9..f68e858 100644 --- a/c++/src/H5IntType.cpp +++ b/c++/src/H5IntType.cpp @@ -117,7 +117,7 @@ IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType() // Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openArrayType(const H5std_string&) +// existing function CommonFG::openIntType(const H5std_string&) // to improve usability. // -BMR, Dec 2016 //-------------------------------------------------------------------------- diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index a00e181..d0b5f9d 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -76,15 +76,15 @@ H5Location::H5Location() : IdComponent() {} #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::exists +// Function: H5Location::nameExists ///\brief Checks if a link of a given name exists in a location ///\param name - IN: Searched name ///\param lapl - IN: Link access property list ///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Nov, 2016 // Modification +// Renamed from exists() in 1.10.2 -BMR //-------------------------------------------------------------------------- -bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const +bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const { htri_t ret_value = H5Lexists(getId(), name, lapl.getId()); if (ret_value > 0) @@ -93,22 +93,54 @@ bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const return false; else // Raise exception when H5Lexists returns a negative value { - throw LocationException(inMemFunc("exists"), "H5Lexists failed"); + throw LocationException(inMemFunc("nameExists"), "H5Lexists failed"); } } //-------------------------------------------------------------------------- -// Function: H5Location::exists +// Function: H5Location::nameExists ///\brief Checks if a link of a given name exists in a location ///\param name - IN: Searched name ///\param lapl - IN: Link access property list ///\exception H5::LocationException +// Modification +// Renamed from exists() in 1.10.2 -BMR +//-------------------------------------------------------------------------- +bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lapl) const +{ + return(nameExists(name.c_str(), lapl)); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::exists - Deprecated +// Purpose Checks if a link of a given name exists in a location +///\brief Deprecated in favor of nameExists +///\param name - IN: Searched name +///\param lapl - IN: Link access property list +///\exception H5::LocationException +// Programmer Binh-Minh Ribler - Nov, 2016 +// Modification +// Renamed to nameExists() in 1.10.2 -BMR +//-------------------------------------------------------------------------- +bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const +{ + return(nameExists(name, lapl)); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::exists - Deprecated +// Purpose Checks if a link of a given name exists in a location +///\brief Deprecated in favor of nameExists +///\param name - IN: Searched name +///\param lapl - IN: Link access property list +///\exception H5::LocationException // Programmer Binh-Minh Ribler - Dec, 2016 // Modification +// Renamed to nameExists() in 1.10.2 -BMR //-------------------------------------------------------------------------- bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) const { - return(exists(name.c_str(), lapl)); + return(nameExists(name.c_str(), lapl)); } //-------------------------------------------------------------------------- diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 2631169..e5fbc84 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -31,6 +31,11 @@ namespace H5 { class H5_DLLCPP H5Location : public IdComponent { public: // Checks if a link of a given name exists in a location + bool nameExists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + bool nameExists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + + // Checks if a link of a given name exists in a location + // Deprecated in favor of nameExists for better name. bool exists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; bool exists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index a765fb1..250ce90 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -66,13 +66,9 @@ 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 -test_create( H5File& file) +static herr_t test_create( H5File& file) { SUBTEST("Create, open, close"); @@ -198,13 +194,9 @@ test_create( H5File& file) * * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_simple_io( H5File& file) +static herr_t test_simple_io( H5File& file) { SUBTEST("Simple I/O"); @@ -284,13 +276,9 @@ test_simple_io( H5File& file) * * Programmer Binh-Minh Ribler * Thursday, March 22, 2012 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_datasize(FileAccPropList &fapl) +static herr_t test_datasize(FileAccPropList &fapl) { SUBTEST("DataSet::getInMemDataSize()"); try @@ -354,13 +342,9 @@ test_datasize(FileAccPropList &fapl) * * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_tconv(H5File& file) +static herr_t test_tconv(H5File& file) { // Prepare buffers for input/output char *out=NULL, *in=NULL; @@ -437,6 +421,7 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ (H5Z_func_t)filter_bogus, /* The actual filter function */ }}; + /*------------------------------------------------------------------------- * Function: bogus * @@ -448,13 +433,9 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ * * Programmer Robb Matzke * Tuesday, April 21, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static size_t -filter_bogus(unsigned int flags, size_t cd_nelmts, +static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes, size_t *buf_size, void **buf) // H5_ATTR_UNUSED variables caused warning, but taking them out caused failure. @@ -477,13 +458,9 @@ filter_bogus(unsigned int flags, size_t cd_nelmts, * * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_compression(H5File& file) +static herr_t test_compression(H5File& file) { #ifndef H5_HAVE_FILTER_DEFLATE const char *not_supported; @@ -764,9 +741,10 @@ test_compression(H5File& file) * *------------------------------------------------------------------------- */ -const H5std_string DSET_NBIT_NAME("nbit_dataset"); +const H5std_string DSET_NBIT_NAME("nbit_dataset"); const hsize_t DIM1 = 2; const hsize_t DIM2 = 5; + static herr_t test_nbit_compression(H5File& file) { typedef struct { @@ -880,13 +858,9 @@ static herr_t test_nbit_compression(H5File& file) * * Programmer Binh-Minh Ribler (using C version) * Saturday, February 17, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_multiopen (H5File& file) +static herr_t test_multiopen (H5File& file) { SUBTEST("Multi-open with extending"); @@ -963,13 +937,9 @@ test_multiopen (H5File& file) * * Programmer Binh-Minh Ribler (using C version) * February 17, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_types(H5File& file) +static herr_t test_types(H5File& file) { SUBTEST("Various datatypes"); @@ -1148,23 +1118,21 @@ test_types(H5File& file) /*------------------------------------------------------------------------- * Function: test_virtual * - * Purpose: Tests fixed, unlimited, and printf selections in the same + * Purpose Tests fixed, unlimited, and printf selections in the same * VDS * - * Return: Success: 0 + * Return Success: 0 * * Failure: number of errors * - * Programmer: Binh-Minh Ribler + * Programmer Binh-Minh Ribler * Friday, March 10, 2017 * - * Modifications: - * *------------------------------------------------------------------------- */ const int RANK = 2; -static herr_t -test_virtual() + +static herr_t test_virtual() { SUBTEST("DSetCreatPropList::setVirtual"); @@ -1293,17 +1261,15 @@ void test_dset() cleanup_dsets(); } // test_dset + /*------------------------------------------------------------------------- * Function: cleanup_dsets * * Purpose Cleanup temporary test files * - * Return none + * Return None * * Programmer (use C version) - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index f0c403c..f271eed 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -47,9 +47,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 ) @@ -135,9 +132,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) @@ -191,9 +185,6 @@ void check_values(const char *value, const char* msg, int line, const char* file * * 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 a1de9c5..6bd4ca6 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -53,13 +53,10 @@ typedef enum int_t { * * Purpose Tests 1-D array of compound datatypes (with array fields) * - * Return None. + * Return None * * Programmer Binh-Minh Ribler (using C version) * January, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_array_compound_array() @@ -280,35 +277,33 @@ static void test_array_compound_array() } // end test_array_compound_array() +/* + * Helper routine to demonstrate the issue in HDFFV-9562 + */ +H5::DataType getArr() +{ + hsize_t *dims = new hsize_t; + *dims = 5; + H5::ArrayType ret; + ret = H5::ArrayType(H5::PredType::NATIVE_INT, 1, dims); + delete[] dims; + return ret; +} + /*------------------------------------------------------------------------- * Function: test_array_assignment * * Purpose Tests the operator= * - * Return None. + * Return None * * Programmer Binh-Minh Ribler (using C version) * March, 2016 * * Description: * Used user's sample code in HDFFV-9562 - * - * Modifications: - * *------------------------------------------------------------------------- */ -/* - * Helper routine to demonstrate the issue in HDFFV-9562 - */ -H5::DataType getArr() -{ - hsize_t *dims = new hsize_t; - *dims = 5; - H5::ArrayType ret; - ret = H5::ArrayType(H5::PredType::NATIVE_INT, 1, dims); - delete[] dims; - return ret; } - static void test_array_assignment() { hsize_t sdims1[] = {SPACE1_DIM1}; @@ -359,13 +354,10 @@ static void test_array_assignment() * * Purpose Tests getting array information using the const methods. * - * Return None. + * Return None * * Programmer Binh-Minh Ribler * April, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_array_info() @@ -477,11 +469,14 @@ static void test_array_info() } // end test_array_info() -/**************************************************************** -** -** test_array(): Main datatypes testing routine. -** -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_array + * + * Purpose Main datatypes testing routine + * + * Return None + *------------------------------------------------------------------------- + */ extern "C" void test_array() { @@ -505,13 +500,10 @@ void test_array() * * Purpose Cleanup temporary test files * - * Return none + * Return None * * 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 d1a0d67..5aa4bf5 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -101,12 +101,15 @@ float attr_data5 = (float)-5.123; // Test data for 5th attribute const H5std_string ATTR1A_NAME("Attr1_a"); int attr_data1a[ATTR1_DIM1]={256,11945,-22107}; -/**************************************************************** -** -** test_attr_basic_write(): Test basic write attribute. -** Tests integer attributes on both datasets and groups -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_basic_write + * + * Purpose Test basic write attribute on both datasets and groups. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_basic_write() { hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; @@ -233,29 +236,34 @@ static void test_attr_basic_write() } } // test_attr_basic_write() -/**************************************************************** -** -** test_attr_getname(): Test getting attribute name functions. -** -** Test these functions: -** A. ssize_t Attribute::getName(char* attr_name, size_t buf_size) -** 1. With arbitrary buf_size that is larger than the name size -** 2. With arbitrary buf_size that is smaller than the name's length. -** 3. With a buf_size that equals the name's length. -** -** B. ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size) -** 1. With buffer smaller than the actual name -** 2. Same test but with retiring overloaded function -** ssize_t Attribute::getName(size_t buf_size, H5std_string& attr_name) -** -** C. H5std_string Attribute::getName() -** -** D. H5std_string Attribute::getName(size_t len) -** -** E. ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size) -** With buffer size equals the name's length, i.e., buf_size=0 -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_getname + * + * Purpose Test getting attribute name. + * + * Description + * Test these functions: + * A. ssize_t Attribute::getName(char* attr_name, size_t buf_size) + * 1. With arbitrary buf_size that is larger than the name size + * 2. With arbitrary buf_size that is smaller than the name's length. + * 3. With a buf_size that equals the name's length. + * + * B. ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size) + * 1. With buffer smaller than the actual name + * 2. Same test but with retiring overloaded function + * ssize_t Attribute::getName(size_t buf_size, H5std_string& attr_name) + * + * C. H5std_string Attribute::getName() + * + * D. H5std_string Attribute::getName(size_t len) + * + * E. ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size) + * With buffer size equals the name's length, i.e., buf_size=0 + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_getname() { // Output message about test being performed @@ -368,11 +376,15 @@ static void test_attr_getname() } } // test_attr_getname() -/**************************************************************** -** -** test_attr_rename(): Test renaming attribute function. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_rename + * + * Purpose Test renaming attribute function. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_rename() { int read_data1[ATTR1_DIM1]={0}; // Buffer for reading the attribute @@ -479,11 +491,15 @@ static void test_attr_rename() } } // test_attr_rename() -/******************************************************************** -** -** test_attr_basic_read(): Test basic read attribute. -** -********************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_basic_read + * + * Purpose Test basic read attribute. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_basic_read() { hsize_t i, j; @@ -548,11 +564,15 @@ static void test_attr_basic_read() } } // test_attr_basic_read() -/**************************************************************** -** -** test_attr_compound_write(): Tests compound datatype attributes -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_compound_write + * + * Purpose Test writing attributes with compound datatype. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_compound_write() { @@ -608,11 +628,15 @@ static void test_attr_compound_write() } } // test_attr_compound_write() -/**************************************************************** -** -** test_attr_compound_read(): Test basic H5A (attribute) code. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_compound_read + * + * Purpose Test reading attributes with compound datatype. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_compound_read() { hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions @@ -760,11 +784,15 @@ static void test_attr_compound_read() } } // test_attr_compound_read() -/**************************************************************** -** -** test_attr_scalar_write(): Test scalar attribute writing functionality. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_scalar_write + * + * Purpose Test scalar attribute writing functionality. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_scalar_write() { // Output message about test being performed @@ -815,11 +843,15 @@ static void test_attr_scalar_write() } } // test_attr_scalar_write() -/**************************************************************** -** -** test_attr_scalar_read(): Test scalar attribute reading functionality. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_scalar_read + * + * Purpose Test scalar attribute reading functionality. + * + * Return None + *------------------------------------------------------------------------- + */ /* Epsilon for floating-point comparisons */ #define FP_EPSILON 0.000001F @@ -864,11 +896,15 @@ static void test_attr_scalar_read() } } // test_attr_scalar_read() -/**************************************************************** -** -** test_attr_mult_write(): Test multiple attributes -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_mult_write + * + * Purpose Test writing multiple attributes. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_mult_write() { // Output message about test being performed @@ -937,11 +973,15 @@ static void test_attr_mult_write() } } // test_attr_mult_write() -/**************************************************************** -** -** test_attr_mult_read(): Test reading multiple attributes. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_mult_read + * + * Purpose Test reading multiple attributes. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_mult_read() { int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute @@ -1128,12 +1168,15 @@ static void test_attr_mult_read() } } // test_attr_mult_read() -/**************************************************************** -** -** test_attr_delete(): Test deleting attribute from different -** hdf5 objects. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_delete + * + * Purpose Test deleting attribute from different hdf5 objects. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_delete() { H5std_string attr_name; // Buffer for attribute names @@ -1245,20 +1288,23 @@ static void test_attr_delete() } } // test_attr_delete() -/**************************************************************** -** -** test_attr_dtype_shared(): Test code for using shared datatypes -** in attributes. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_dtype_shared + * + * Purpose Test accessing attributes using shared datatypes. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_dtype_shared() { - int data=8; /* Data to write */ - int rdata=0; /* Read read in */ + int data=8; // Data to write + int rdata=0; // Data read in #ifndef H5_NO_DEPRECATED_SYMBOLS - H5G_stat_t statbuf; /* Object's information */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - h5_stat_size_t filesize; /* Size of file after modifications */ + H5G_stat_t statbuf; // Object's information +#endif + h5_stat_size_t filesize; // Size of file after modifications // Output message about test being performed SUBTEST("Shared Datatypes with Attributes"); @@ -1294,7 +1340,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Create dataspace for dataset DataSpace dspace; @@ -1305,7 +1351,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Create attribute on dataset Attribute attr = dset.createAttribute(ATTR1_NAME,dtype,dspace); @@ -1314,7 +1360,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Close attribute attr.close(); @@ -1326,7 +1372,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Create attribute on dataset attr = dset.createAttribute(ATTR1_NAME,dtype,dspace); @@ -1335,7 +1381,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Write data into the attribute attr.write(PredType::NATIVE_INT,&data); @@ -1372,7 +1418,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif } // end of second enclosing // Unlink the dataset @@ -1382,7 +1428,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 1, "H5File::unlink", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Unlink the named datatype fid1.unlink(TYPE1_NAME); @@ -1403,12 +1449,15 @@ static void test_attr_dtype_shared() } } // test_attr_dtype_shared() -/**************************************************************** -** -** test_string_attr(): Test read/write string attribute. -** Tests string attributes on groups. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_string_attr + * + * Purpose Test read/write string attribute. + * + * Return None + *------------------------------------------------------------------------- + */ /* Info for a string attribute */ const H5std_string ATTR1_FL_STR_NAME("String_attr 1"); const H5std_string ATTR2_FL_STR_NAME("String_attr 2"); @@ -1528,12 +1577,18 @@ static void test_string_attr() } } // test_string_attr() -/**************************************************************** -** -** test_attr_exists(): Test checking for attribute existence. -** (additional attrExists tests are in test_attr_rename()) -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_exists + * + * Purpose Test checking for attribute existence. + * + * Return None + * + * Note + * Additional attrExists tests are in test_attr_rename(). + *------------------------------------------------------------------------- + */ static void test_attr_exists() { // Output message about test being performed @@ -1577,12 +1632,15 @@ static void test_attr_exists() } } // test_attr_exists() -/**************************************************************** -** -** test_attr_dense_create(): Test phase change properties -** Tests "dense" attribute storage creation -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_dense_create + * + * Purpose Test phase change properties + * + * Return None + *------------------------------------------------------------------------- + */ const H5std_string FILE_CRTPROPS("tattr_crt_properties.h5"); const int NAME_BUF_SIZE = 1024; const unsigned MAX_COMPACT_DEF = 8; @@ -1686,12 +1744,15 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, } } // test_attr_dense_create() -/**************************************************************** -** -** test_attr_corder_create_basic(): Test creation order properties -** Tests creating an object w/attribute creation order info -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_corder_create_basic + * + * Purpose Test creation order properties + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_corder_create_basic(FileCreatPropList& fcpl, FileAccPropList& fapl) { @@ -1771,11 +1832,15 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl, } } // test_attr_corder_create_basic() -/**************************************************************** -** -** test_attr(): Main attribute testing routine. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr + * + * Purpose Main attribute testing routine + * + * Return None + *------------------------------------------------------------------------- + */ extern "C" void test_attr() { @@ -1858,19 +1923,14 @@ void test_attr() issue_fail_msg("test_attr()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_attr() + /*------------------------------------------------------------------------- - * Function cleanup_attr + * Function: cleanup_attr * * Purpose Cleanup temporary test files * - * Return none - * - * Programmer Albert Cheng - * July 2, 1998 - * - * Modifications: - * + * Return None *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 3af78c5..55d4744 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -49,9 +49,6 @@ typedef struct complex_t { * * Programmer Binh-Minh Ribler (using C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_1() @@ -86,9 +83,6 @@ static void test_compound_1() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_2() @@ -211,9 +205,6 @@ static void test_compound_2() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_3() @@ -333,9 +324,6 @@ static void test_compound_3() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_4() @@ -466,9 +454,6 @@ static void test_compound_4() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_5() @@ -569,9 +554,6 @@ static void test_compound_5() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_6() @@ -651,6 +633,7 @@ static void test_compound_6() } } // test_compound_6() + /*------------------------------------------------------------------------- * Function: test_compound_7 * @@ -661,9 +644,6 @@ static void test_compound_6() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_7() @@ -717,6 +697,7 @@ static void test_compound_7() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } } // test_compound_7() + /*------------------------------------------------------------------------- * Function: test_compound_set_size @@ -727,12 +708,10 @@ 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"); + static void test_compound_set_size() { typedef struct { @@ -807,6 +786,7 @@ static void test_compound_set_size() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } } // test_compound_set_size() + /*------------------------------------------------------------------------- * Function: test_compound @@ -817,9 +797,6 @@ static void test_compound_set_size() * * Programmer Binh-Minh Ribler * January 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" @@ -845,9 +822,6 @@ void test_compound() * Purpose Cleanup temporary test files - nothing at this time. * * Return none - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index 4aaa93a..438f385 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -111,11 +111,14 @@ static void test_transfplist() } -/**************************************************************** -** -** test_dsproplist(): Main dataset property list testing routine. -** -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_dsproplist + * + * Purpose Main dataset property list testing routine + * + * Return None + *------------------------------------------------------------------------- + */ extern "C" void test_dsproplist() { @@ -126,6 +129,15 @@ void test_dsproplist() } // test_dsproplist() + +/*------------------------------------------------------------------------- + * Function: cleanup_dsproplist + * + * Purpose Cleanup temporary test files + * + * Return none + *------------------------------------------------------------------------- + */ extern "C" void cleanup_dsproplist() { diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 51682a3..ba5b486 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -78,7 +78,6 @@ const H5std_string FILE4("tfile4.h5"); * passed to verify_val to 'long' as well. If problems * arises later, this will have to be specificly handled * with a special routine. - * *------------------------------------------------------------------------- */ static void test_file_create() @@ -285,7 +284,6 @@ static void test_file_create() * passed to verify_val to 'long' as well. If problems * arises later, this will have to be specificly handled * with a special routine. - * *------------------------------------------------------------------------- */ static void test_file_open() @@ -360,9 +358,6 @@ static void test_file_open() * * Programmer Raymond Lu * June, 2004 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_file_size() @@ -425,9 +420,6 @@ static void test_file_size() * * Programmer Binh-Minh Ribler * July, 2004 - * - * Modifications: - * *------------------------------------------------------------------------- */ const int RANK = 2; @@ -507,6 +499,15 @@ static void test_file_name() } // test_file_name() +/*------------------------------------------------------------------------- + * + * Function: test_file_attribute + * + * Purpose Test file attributes + * + * Return None + *------------------------------------------------------------------------- + */ const int RANK1 = 1; const int ATTR1_DIM1 = 3; const H5std_string FILE5("tfattrs.h5"); @@ -618,11 +619,6 @@ static void test_file_attribute() } // test_file_attribute() -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 * @@ -634,9 +630,13 @@ const H5std_string SUBGROUP3("/G1/G3"); * * Programmer Binh-Minh Ribler (use C version) * March, 2015 - * *------------------------------------------------------------------------- */ +const H5std_string FILE6("tfile5.h5"); +const H5std_string ROOTGROUP("/"); +const H5std_string GROUP1("/G1"); +const H5std_string SUBGROUP3("/G1/G3"); + static void test_libver_bounds_real( H5F_libver_t libver_create, unsigned oh_vers_create, H5F_libver_t libver_mod, unsigned oh_vers_mod) @@ -707,6 +707,7 @@ static void test_libver_bounds_real( } /* end test_libver_bounds_real() */ + /*------------------------------------------------------------------------- * * Function: test_libver_bounds @@ -718,7 +719,6 @@ static void test_libver_bounds_real( * * Programmer Binh-Minh Ribler (use C version) * March 2015 - * *------------------------------------------------------------------------- */ static void test_libver_bounds() @@ -731,9 +731,10 @@ static void test_libver_bounds() test_libver_bounds_real(H5F_LIBVER_LATEST, H5O_VERSION_2, H5F_LIBVER_EARLIEST, H5O_VERSION_2); PASSED(); } /* end test_libver_bounds() */ + /*------------------------------------------------------------------------- - * Function: test_commonfg + * Function: test_commonfg * * Purpose Verify that H5File works as a root group. * @@ -741,7 +742,6 @@ static void test_libver_bounds() * * Programmer Binh-Minh Ribler (use C version) * March, 2015 - * *------------------------------------------------------------------------- */ static void test_commonfg() @@ -793,9 +793,8 @@ static void test_commonfg() } } /* end test_commonfg() */ - -const H5std_string FILE7("tfile7.h5"); + /*------------------------------------------------------------------------- * Function: test_file_info * @@ -807,11 +806,12 @@ const H5std_string FILE7("tfile7.h5"); * * Programmer Binh-Minh Ribler * February, 2017 - * *------------------------------------------------------------------------- */ +const H5std_string FILE7("tfile7.h5"); const hsize_t FSP_SIZE_DEF = 4096; const hsize_t FSP_SIZE512 = 512; + static void test_file_info() { // Output message about test being performed @@ -932,6 +932,7 @@ static void test_file_info() issue_fail_msg("test_filespace_info()", __LINE__, __FILE__, E.getCDetailMsg()); } } /* test_file_info() */ + /*------------------------------------------------------------------------- * Function: test_file @@ -942,9 +943,6 @@ static void test_file_info() * * Programmer Binh-Minh Ribler (use C version) * January 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" @@ -970,11 +968,6 @@ void test_file() * Purpose Cleanup temporary test files * * Return none - * - * Programmer (use C version) - * - * Modifications: - * *------------------------------------------------------------------------- */ #ifdef __cplusplus diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 5de6590..5a493ac 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -65,6 +65,7 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ (H5Z_func_t)filter_bogus, /* The actual filter function */ }}; + /*------------------------------------------------------------------------- * Function: filter_bogus * @@ -76,9 +77,6 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ * * Programmer Robb Matzke * Tuesday, April 21, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t @@ -92,6 +90,7 @@ filter_bogus(size_t nbytes) return nbytes; } + /*------------------------------------------------------------------------- * Function: test_null_filter * @@ -104,11 +103,8 @@ filter_bogus(size_t nbytes) * * Modifications: * Note: H5Z interface is not implemented yet. - * *------------------------------------------------------------------------- */ - -// Chunk dimensions const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; static void test_null_filter() @@ -144,6 +140,7 @@ static void test_null_filter() } } // test_null_filter + /*------------------------------------------------------------------------- * Function: test_szip_filter * @@ -156,11 +153,9 @@ static void test_null_filter() * * Modifications: * Note: H5Z interface is not implemented yet. - * *------------------------------------------------------------------------- */ - -const H5std_string DSET_SZIP_NAME("szipped dataset"); +const H5std_string DSET_SZIP_NAME("szipped dataset"); static void test_szip_filter(H5File& file1) { @@ -242,11 +237,14 @@ static void test_szip_filter(H5File& file1) } // test_szip_filter -/**************************************************************** -** -** test_filters(): Main routine for testing filters. -** -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_filters + * + * Purpose Main routine for testing filters + * + * Return None + *------------------------------------------------------------------------- + */ const H5std_string FILE1("tfilters.h5"); extern "C" void test_filters() @@ -274,18 +272,13 @@ void test_filters() } } // test_filters() + /*------------------------------------------------------------------------- * Function: cleanup_filters * * Purpose Cleanup temporary test files * * Return none - * - * Programmer Quincey Koziol - * September 10, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index e99ce99..9c92b64 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -82,13 +82,13 @@ struct space4_struct { /* Null dataspace */ int space5_data = 7; + /*------------------------------------------------------------------------- - * * Function: test_h5s_basic * * Purpose Test basic H5S (dataspace) code * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 @@ -214,13 +214,13 @@ static void test_h5s_basic() } } // test_h5s_basic() + /*------------------------------------------------------------------------- - * * Function: test_h5s_scalar_write * * Purpose Test scalar H5S (dataspace) writing code * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 @@ -278,13 +278,13 @@ static void test_h5s_scalar_write() } } // test_h5s_scalar_write() + /*------------------------------------------------------------------------- - * * Function: test_h5s_scalar_read * * Purpose Test scalar H5S (dataspace) reading code * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 @@ -340,13 +340,13 @@ static void test_h5s_scalar_read() } // test_h5s_scalar_read() + /*------------------------------------------------------------------------- - * * Function: test_h5s_null * * Purpose Test null H5S (dataspace) code * - * Return none + * Return None * * Programmer Raymond Lu (using C version) * May 18, 2004 @@ -394,14 +394,14 @@ static void test_h5s_null() } } // test_h5s_null() + /*------------------------------------------------------------------------- - * * Function: test_h5s_compound_scalar_write * * Purpose Test scalar H5S (dataspace) writing for compound * datatypes * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 @@ -467,14 +467,14 @@ static void test_h5s_compound_scalar_write() } } // test_h5s_compound_scalar_write() + /*------------------------------------------------------------------------- - * * Function: test_h5s_compound_scalar_read * * Purpose Test scalar H5S (dataspace) reading for compound * datatypes * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 @@ -541,18 +541,16 @@ static void test_h5s_compound_scalar_read() } } // test_h5s_compound_scalar_read() + /*------------------------------------------------------------------------- - * * Function: test_h5s * * Purpose Main dataspace testing routine * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 - * - * Modifications: *------------------------------------------------------------------------- */ extern "C" @@ -575,13 +573,7 @@ void test_h5s() * * Purpose Cleanup temporary test files * - * Return none - * - * Programmer Albert Cheng - * July 2, 1998 - * - * Modifications: - * + * Return None *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index 5c760f3..e77ebcc 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -78,23 +78,25 @@ typedef struct { int iter_strcmp(const void *s1, const void *s2); -/**************************************************************** -** -** iter_strcmp(): String comparison routine for qsort -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: iter_strcmp + * + * Purpose String comparison routine for qsort + *------------------------------------------------------------------------- + */ int iter_strcmp(const void *s1, const void *s2) { return(HDstrcmp(*(const char * const *)s1,*(const char * const *)s2)); } -/**************************************************************** -** -** liter_cb(): Custom link iteration callback routine. -** -****************************************************************/ -static herr_t -liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data) +/*------------------------------------------------------------------------- + * Function: liter_cb + * + * Purpose Custom link iteration callback routine + *------------------------------------------------------------------------- + */ +static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data) { iter_info *info = (iter_info *)op_data; static int count = 0; @@ -123,6 +125,7 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_ } /* end switch */ } /* end liter_cb() */ + /*------------------------------------------------------------------------- * Function: test_iter_group * @@ -133,9 +136,6 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_ * * Programmer Binh-Minh Ribler * Friday, September 9, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_iter_group(FileAccPropList& fapl) @@ -348,13 +348,13 @@ static void test_iter_group(FileAccPropList& fapl) #endif } /* test_iter_group() */ - -/**************************************************************** -** -** printelems(): Open an attribute and verify that it has a -** the correct name -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: printelems + * + * Purpose Open an attribute and verify that it has a the correct name + *------------------------------------------------------------------------- + */ const H5std_string FILE_NAME("titerate.h5"); const H5std_string GRP_NAME("/Group_A"); const H5std_string FDATASET_NAME("file dset"); @@ -386,6 +386,7 @@ void printelems(const Group& group, const H5std_string& dsname, const H5std_stri } } + /*------------------------------------------------------------------------- * Function: test_HDFFV_9920 * @@ -393,9 +394,6 @@ void printelems(const Group& group, const H5std_string& dsname, const H5std_stri * * Programmer Binh-Minh Ribler * Friday, September 9, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_HDFFV_9920() @@ -444,7 +442,7 @@ static void test_HDFFV_9920() } } - + /*------------------------------------------------------------------------- * Function: test_iterate * @@ -455,9 +453,6 @@ static void test_HDFFV_9920() * * Programmer Binh-Minh Ribler * Tuesday, September 6, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" @@ -476,17 +471,13 @@ void test_iterate() } // test_iterate + /*------------------------------------------------------------------------- * Function: cleanup_iterate * * Purpose Cleanup temporary test files * * Return none - * - * Programmer (use C version) - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index dc592b3..e348d64 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -328,9 +328,6 @@ static const char *FILENAME[] = { * * Programmer Binh-Minh Ribler * October 16, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_basic_links(hid_t fapl_id, hbool_t new_format) @@ -414,6 +411,11 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format) H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); // Verify link existence + if(file.nameExists("dset1", LinkAccPropList::DEFAULT) != TRUE) + throw InvalidActionException("H5File::nameExists", "dset1 doesn't exist"); + if(file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE) + throw InvalidActionException("H5File::nameExists", "grp1/soft doesn't exist"); + // Deprecated if(file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE) throw InvalidActionException("H5File::exists", "dset1 doesn't exist"); if(file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE) @@ -446,9 +448,6 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format) * * Programmer Binh-Minh Ribler * October 16, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_num_links(hid_t fapl_id, hbool_t new_format) @@ -483,6 +482,7 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format) issue_fail_msg("test_num_links()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_num_links + /*------------------------------------------------------------------------- * Function: test_links @@ -493,7 +493,6 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format) * * Programmer Binh-Minh Ribler * October 16, 2009 - * *------------------------------------------------------------------------- */ extern "C" @@ -671,18 +670,13 @@ void test_links() } + /*------------------------------------------------------------------------- * Function: cleanup_links * * Purpose Cleanup temporary test files * * Return none - * - * Programmer Binh-Minh Ribler - * October 16, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index d9f4075..9980ce0 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -45,6 +45,7 @@ const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1"); const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2"); const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2"); + /*------------------------------------------------------------------------- * Function: test_get_objname * @@ -65,9 +66,6 @@ const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_ * * Programmer Binh-Minh Ribler * Friday, March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_get_objname() @@ -153,6 +151,7 @@ static void test_get_objname() } } // test_get_objname + /*------------------------------------------------------------------------- * Function: test_existance * @@ -173,9 +172,6 @@ static void test_get_objname() * * Programmer Binh-Minh Ribler * Friday, March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_existance() @@ -187,18 +183,30 @@ static void test_existance() H5File file(FILE_OBJECTS, H5F_ACC_RDONLY); // Check if GROUP1 exists in the file - bool exists = file.exists(GROUP1); + bool exists = file.nameExists(GROUP1); + verify_val(exists, TRUE, "Group::nameExists GROUP1_1", __LINE__, __FILE__); + // Deprecated + exists = file.exists(GROUP1); + verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__); // Open GROUP1 Group grp1 = file.openGroup(GROUP1); // Check if GROUP1_1 and GROUP1_2 exist in GROUP1 + exists = grp1.nameExists(GROUP1_1); + verify_val(exists, TRUE, "Group::nameExists GROUP1_1", __LINE__, __FILE__); + exists = grp1.nameExists(GROUP1_2); + verify_val(exists, TRUE, "Group::nameExists GROUP1_2", __LINE__, __FILE__); + // Deprecated exists = grp1.exists(GROUP1_1); verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__); exists = grp1.exists(GROUP1_2); verify_val(exists, TRUE, "Group::exists GROUP1_2", __LINE__, __FILE__); // Check if DSET_IN_GRP1 exists in GROUP1 + exists = grp1.nameExists(DSET_IN_GRP1); + verify_val(exists, TRUE, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__); + // Deprecated exists = grp1.exists(DSET_IN_GRP1); verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); @@ -206,14 +214,22 @@ static void test_existance() Group grp1_2 = grp1.openGroup(GROUP1_2); // Check if DSET_IN_GRP1_2 exists in GROUP1_2 + exists = grp1_2.nameExists(DSET_IN_GRP1_2); + verify_val(exists, TRUE, "Group::nameExists DSET_IN_GRP1_2", __LINE__, __FILE__); + // Deprecated exists = grp1_2.exists(DSET_IN_GRP1_2); verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__); // Check if a dataset exists given dataset as location with full path name DataSet dset1 = file.openDataSet(DSET_IN_FILE); + exists = dset1.nameExists("/Top Group/Dataset_in_Group_1"); + verify_val(exists, TRUE, "Group::nameExists given dataset with full path name", __LINE__, __FILE__); + + exists = grp1_2.nameExists(DSET_IN_GRP1); + verify_val(exists, FALSE, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__); + // Deprecated exists = dset1.exists("/Top Group/Dataset_in_Group_1"); verify_val(exists, TRUE, "Group::exists given dataset with full path name", __LINE__, __FILE__); - exists = grp1_2.exists(DSET_IN_GRP1); verify_val(exists, FALSE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); @@ -229,6 +245,7 @@ static void test_existance() } } // test_existance + /*------------------------------------------------------------------------- * Function: test_get_objname_ontypes * @@ -239,9 +256,6 @@ static void test_existance() * * Programmer Binh-Minh Ribler * March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_get_objname_ontypes() @@ -330,6 +344,7 @@ static void test_get_objname_ontypes() } } // test_get_objname_ontypes + /*------------------------------------------------------------------------- * Function: test_get_objtype * @@ -340,9 +355,6 @@ static void test_get_objname_ontypes() * * Programmer Binh-Minh Ribler * Friday, March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_get_objtype() @@ -394,6 +406,7 @@ static void test_get_objtype() issue_fail_msg("test_get_objtype", __LINE__, __FILE__); } } // test_get_objtype + /*------------------------------------------------------------------------- * Function: test_open_object_header @@ -404,9 +417,6 @@ static void test_get_objtype() * * Programmer Binh-Minh Ribler (use C version) * March, 2017 - * - * Modifications: - * *------------------------------------------------------------------------- */ const H5std_string GROUPNAME("group"); @@ -416,6 +426,7 @@ const H5std_string DSETNAME("dataset"); #define RANK 2 #define DIM0 5 #define DIM1 10 + static void test_open_object_header() { hsize_t dims[2]; @@ -513,6 +524,7 @@ static void test_open_object_header() issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg()); } } /* test_open_object_header() */ + /*------------------------------------------------------------------------- * Function: test_objects @@ -524,9 +536,6 @@ static void test_open_object_header() * * Programmer Binh-Minh Ribler * Friday, Mar 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" @@ -543,17 +552,13 @@ void test_object() } // test_objects + /*------------------------------------------------------------------------- * Function: cleanup_objects * * Purpose Cleanup temporary test files * - * Return none - * - * Programmer (use C version) - * - * Modifications: - * + * Return None *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 9074154..bb09616 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -61,14 +61,16 @@ typedef struct s1_t { float c; } s1_t; -/**************************************************************** -** -** test_reference_params(): Test basic H5R (reference) parameters -** for correct processing -** -****************************************************************/ -static void -test_reference_params(void) + +/*------------------------------------------------------------------------- + * Function: test_reference_params + * + * Purpose Test basic H5R (reference) parameters for correct processing + * + * Return None + *------------------------------------------------------------------------- + */ +static void test_reference_params() { const char *write_comment = "Foo!"; /* Comments for group */ @@ -177,13 +179,17 @@ test_reference_params(void) delete file1; } /* test_reference_param() */ -/**************************************************************** -** -** test_reference_obj(): Test basic object reference functions -** to various kinds of objects -** -****************************************************************/ -static void test_reference_obj(void) + +/*------------------------------------------------------------------------- + * Function: test_reference_obj + * + * Purpose Test basic object reference functions to various kinds + * of objects + * + * Return None + *------------------------------------------------------------------------- + */ +static void test_reference_obj() { int i; // counting variables const H5std_string write_comment="Foo!"; // Comments for group @@ -369,14 +375,15 @@ static void test_reference_obj(void) delete file1; } // test_reference_obj() - -/**************************************************************** -** -** test_reference_group(): Test object reference functionality -** Tests for correct behavior of various routines on -** dereferenced group -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_reference_group + * + * Purpose Test object reference functionality on group. + * + * Return None + *------------------------------------------------------------------------- + */ #define GROUPNAME "/group" #define GROUPNAME2 "group2" #define GROUPNAME3 "group3" @@ -384,8 +391,7 @@ static void test_reference_obj(void) #define DSETNAME2 "dset2" #define NAME_SIZE 16 -static void -test_reference_group(void) +static void test_reference_group() { hobj_ref_t wref; /* Reference to write */ hobj_ref_t rref; /* Reference to read */ @@ -498,14 +504,16 @@ test_reference_group(void) delete file1; } /* test_reference_group() */ -/**************************************************************** -** -** test_reference_region_1D(): Test 1-D reference functionality -** Tests 1-D references to various kinds of objects -** -****************************************************************/ -static void -test_reference_region_1D(void) + +/*------------------------------------------------------------------------- + * Function: test_reference_region_1D + * + * Purpose Test 1-D reference functionality on various kinds of objects. + * + * Return None + *------------------------------------------------------------------------- + */ +static void test_reference_region_1D() { hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ @@ -787,26 +795,14 @@ test_reference_region_1D(void) } } /* test_reference_region_1D() */ - -/**************************************************************** -** -** test_reference_compat(): Test basic object reference functionality. -** Tests references to various kinds of objects using deprecated API. -** -****************************************************************/ -static void test_reference_compat(void) -{ - // Not yet -} // test_reference_compat() - - -/**************************************************************** -** -** test_reference(): Main reference testing routine. -** -****************************************************************/ +/*------------------------------------------------------------------------- + * + * test_reference(): Main reference testing routine. + * + *------------------------------------------------------------------------- + */ extern "C" -void test_reference(void) +void test_reference() { // Output message about test being performed MESSAGE(5, ("Testing References\n")); @@ -815,18 +811,20 @@ void test_reference(void) test_reference_obj(); // Test basic object reference functionality test_reference_group(); // Test group reference functionality test_reference_region_1D(); // Test 1-D reference functionality - test_reference_compat(); // Tests deprecated reference routines (not yet) } // test_reference() -/**************************************************************** -** Function: cleanup_reference -** Purpose Cleanup temporary test files -** Return none -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: cleanup_reference + * + * Purpose Cleanup temporary test files + * + * Return None + *------------------------------------------------------------------------- + */ extern "C" -void cleanup_reference(void) +void cleanup_reference() { HDremove(FILE1.c_str()); HDremove(FILE2.c_str()); diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 3cf0920..a2bd561 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -87,6 +87,7 @@ typedef struct { long c; double d; } src_typ_t; + /*------------------------------------------------------------------------- * Function: test_classes @@ -97,9 +98,6 @@ typedef struct { * * Programmer Binh-Minh Ribler (using C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_classes() @@ -126,6 +124,7 @@ static void test_classes() issue_fail_msg("test_classes", __LINE__, __FILE__, E.getCDetailMsg()); } } + /*------------------------------------------------------------------------- * Function: test_copy @@ -136,9 +135,6 @@ static void test_classes() * * Programmer Binh-Minh Ribler (using C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_copy() @@ -192,9 +188,6 @@ static void test_copy() * * Programmer Binh-Minh Ribler (using C version) * August, 2017 - * - * Modifications: - * *------------------------------------------------------------------------- */ typedef struct { /* Struct with atomic fields */ @@ -390,9 +383,6 @@ static void test_detect_type_class() * * Programmer Binh-Minh Ribler (use C version) * August, 2017 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_vltype() @@ -465,12 +455,8 @@ static void test_vltype() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ - const H5std_string CompT_NAME("Compound_type"); const H5std_string EnumT_NAME("Enum_type"); @@ -591,12 +577,10 @@ static void test_query() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ const char* filename1 = "dtypes1.h5"; + static void test_transient () { static hsize_t ds_size[2] = {10, 20}; @@ -668,12 +652,10 @@ static void test_transient () * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ const H5std_string filename2("dtypes2.h5"); + static void test_named () { static hsize_t ds_size[2] = {10, 20}; @@ -831,14 +813,12 @@ static void test_named () * * Programmer Binh-Minh Ribler (using C version) * August, 2017 - * - * Modifications: - * *------------------------------------------------------------------------- */ 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; @@ -1045,11 +1025,14 @@ static void test_encode_decode() } -/**************************************************************** -** -** test_types(): Main datatypes testing routine. -** -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_types + * + * Purpose Main datatypes testing routine + * + * Return None + *------------------------------------------------------------------------- + */ extern "C" void test_types() { @@ -1074,13 +1057,7 @@ void test_types() * * Purpose Cleanup temporary test files * - * Return none - * - * Programmer Quincey Koziol - * September 10, 1999 - * - * Modifications: - * + * Return None *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index d5fea07..2421a87 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -40,16 +40,22 @@ const H5std_string FILENAME("tvlstr.h5"); const int SPACE1_RANK = 1; const hsize_t SPACE1_DIM1 = 4; -/**************************************************************** -** -** test_vlstr_alloc_custom(): Test VL datatype custom memory -** allocation routines. This routine just uses malloc to -** allocate the memory and increments the amount of memory -** allocated. It is passed into setVlenMemManager. -** -** Note: exact copy from the C version. -** (Not used now) -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_vlstr_alloc_custom + * + * Purpose Test VL datatype custom memory allocation routines. + * + * Return None + * + * Description + * This routine just uses malloc to allocate the memory and + * increments the amount of memory allocated. It is passed + * into setVlenMemManager. + * + * Note: exact copy from the C version. + * (Not used now) + *------------------------------------------------------------------------- + */ #if 0 // not used now static void *test_vlstr_alloc_custom(size_t size, void *info) { @@ -74,16 +80,22 @@ static void *test_vlstr_alloc_custom(size_t size, void *info) } #endif -/**************************************************************** -** -** test_vlstr_free_custom(): Test VL datatype custom memory -** allocation routines. This routine just uses free to -** release the memory and decrements the amount of memory -** allocated. It is passed into setVlenMemManager. -** -** Note: exact copy from the C version. -** (Not used now) -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_vlstr_free_custom + * + * Purpose Test VL datatype custom memory de-allocation routines. + * + * Return None + * + * Description + * This routine just uses free to release the memory and + * decrements the amount of memory allocated. It is passed + * into setVlenMemManager. + * + * Note: exact copy from the C version. + * (Not used now) + *------------------------------------------------------------------------- + */ #if 0 // not used now static void test_vlstr_free_custom(void *_mem, void *info) { @@ -221,6 +233,7 @@ static void test_vlstring_dataset() *------------------------------------------------------------------------- */ const H5std_string DSSTRARR_NAME("StringArray_dset"); + static void test_vlstring_array_dataset() { const char *string_ds_array[SPACE1_DIM1]= { @@ -440,6 +453,7 @@ static void test_vlstrings_special() *------------------------------------------------------------------------- */ const H5std_string VLSTR_TYPE("vl_string_type"); + static void test_vlstring_type() { // Output message about test being performed. @@ -608,10 +622,7 @@ static void test_compact_vlstring() * *------------------------------------------------------------------------- */ -// String for writing to attribute static char *string_att_write=NULL; - -// Info for a string attribute const H5std_string ATTRSTR_NAME("String_attr"); const H5std_string ATTRSTR_DATA("String Attribute"); @@ -877,6 +888,7 @@ static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space, */ const H5std_string FILENAME2("tvlstr2.h5"); const int REWRITE_NDATASETS = 32; + static void test_vl_rewrite() { // Output message about test being performed @@ -987,12 +999,6 @@ void test_vlstrings() * Purpose Cleanup temporary test files * * Return none - * - * Programmer Quincey Koziol - * September 10, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" -- cgit v0.12 From 17d148434fff055a2e22c6ac715c7ecff536a5c3 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 4 Dec 2017 16:57:37 -0600 Subject: Fixed typo. --- c++/test/tcompound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 55d4744..ec8adf0 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -821,7 +821,7 @@ void test_compound() * * Purpose Cleanup temporary test files - nothing at this time. * - * Return none + * Return None *------------------------------------------------------------------------- */ extern "C" -- cgit v0.12