summaryrefslogtreecommitdiffstats
path: root/c++/test/dsets.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/test/dsets.cpp')
-rw-r--r--c++/test/dsets.cpp115
1 files changed, 68 insertions, 47 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 0116d6c..52e3e73 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -23,11 +23,7 @@
***************************************************************************/
-#ifdef OLD_HEADER_FILENAME
-#include <iostream.h>
-#else
#include <iostream>
-#endif
using std::cerr;
using std::endl;
@@ -46,6 +42,8 @@ const H5std_string DSET_SIMPLE_IO_NAME("simple_io");
const H5std_string DSET_TCONV_NAME("tconv");
const H5std_string DSET_COMPRESS_NAME("compressed");
const H5std_string DSET_BOGUS_NAME("bogus");
+const H5std_string DSET_OPERATOR("testing operator=");
+const H5std_string DSET_OPERATOR_PATH("/testing operator=");
/* Temporary filter IDs used for testing */
const int H5Z_FILTER_BOGUS = 305;
@@ -62,9 +60,6 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -188,9 +183,6 @@ test_create(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -267,9 +259,6 @@ test_simple_io(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler
- * Thursday, March 22, 2012
*-------------------------------------------------------------------------
*/
static herr_t
@@ -329,9 +318,6 @@ test_datasize(FileAccPropList &fapl)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -398,13 +384,13 @@ test_tconv(H5File &file)
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
- H5Z_FILTER_BOGUS, /* Filter id number */
- 1, 1, /* Encode and decode enabled */
- "bogus", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)filter_bogus, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
+ H5Z_FILTER_BOGUS, /* Filter id number */
+ 1, 1, /* Encode and decode enabled */
+ "bogus", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_bogus, /* The actual filter function */
}};
/*-------------------------------------------------------------------------
@@ -439,9 +425,6 @@ filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -712,10 +695,6 @@ test_compression(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler
- * Friday, April 22, 2016
- *
*-------------------------------------------------------------------------
*/
const H5std_string DSET_NBIT_NAME("nbit_dataset");
@@ -827,9 +806,6 @@ test_nbit_compression(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Saturday, February 17, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -903,9 +879,6 @@ test_multiopen(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * February 17, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1161,7 +1134,7 @@ const int RANK1 = 1;
const H5std_string FILE_ACCPLIST("test_accplist.h5");
static herr_t
-test_chunk_cache(FileAccPropList fapl)
+test_chunk_cache(const FileAccPropList &fapl)
{
SUBTEST("DSetAccPropList::set/getChunkCache");
@@ -1173,7 +1146,7 @@ test_chunk_cache(FileAccPropList fapl)
// Verify that chunk cache parameters are the same
int mdc_nelmts = 0;
size_t nslots_1 = 0, nslots_4 = 0, nbytes_1 = 0, nbytes_4 = 0;
- double w0_1 = 0.0F, w0_4 = 0.0F;
+ double w0_1 = 0.0, w0_4 = 0.0;
fapl_def.getCache(mdc_nelmts, nslots_1, nbytes_1, w0_1);
dapl.getChunkCache(nslots_4, nbytes_4, w0_4);
verify_val(nslots_1, nslots_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
@@ -1191,7 +1164,7 @@ test_chunk_cache(FileAccPropList fapl)
// Set new rdcc settings on fapl local
size_t nslots_2 = nslots_1 * 2;
size_t nbytes_2 = nbytes_1 * 2;
- double w0_2 = w0_1 / (double)2.0F;
+ double w0_2 = w0_1 / 2.0;
fapl_local.getCache(mdc_nelmts, nslots_2, nbytes_2, w0_2);
// Create a new file using default fcpl and the passed-in fapl
@@ -1262,10 +1235,6 @@ test_chunk_cache(FileAccPropList fapl)
*
* Return Success: 0
* Failure: number of errors
- *
- * Programmer Binh-Minh Ribler
- * Friday, March 10, 2017
- *
*-------------------------------------------------------------------------
*/
const int RANK = 2;
@@ -1332,6 +1301,60 @@ test_virtual()
} // test_virtual
/*-------------------------------------------------------------------------
+ * Function: test_operator
+ *
+ * Purpose Tests DataSet::operator=
+ *
+ * Return Success: 0
+ *
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_operator(H5File &file)
+{
+ SUBTEST("DataSet::operator=");
+
+ try {
+ // Create a data space
+ hsize_t dims[2];
+ dims[0] = 256;
+ dims[1] = 512;
+ DataSpace space(2, dims, NULL);
+
+ // Create a dataset using the default dataset creation properties.
+ // We're not sure what they are, so we won't check.
+ DataSet dataset = file.createDataSet(DSET_OPERATOR, PredType::NATIVE_DOUBLE, space);
+
+ // Add a comment to the dataset
+ file.setComment(DSET_OPERATOR, "Dataset using operator=");
+
+ // Close the dataset
+ dataset.close();
+
+ // Re-open the dataset
+ DataSet another_dataset(file.openDataSet(DSET_OPERATOR));
+
+ // Try operator= to make another dataset
+ DataSet copied_dataset = another_dataset;
+
+ H5std_string copied_dataset_name = copied_dataset.getObjName();
+ H5std_string another_dataset_name = another_dataset.getObjName();
+
+ PASSED();
+ return 0;
+ } // try block
+
+ // catch all other exceptions
+ catch (Exception &E) {
+ issue_fail_msg("test_operator", __LINE__, __FILE__);
+
+ // clean up and return with failure
+ return -1;
+ }
+} // test_operator
+
+/*-------------------------------------------------------------------------
* Function: test_dset
*
* Purpose Tests the dataset interface (H5D)
@@ -1340,9 +1363,6 @@ test_virtual()
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
- *
* Modifications:
* Nov 12, 01:
* - moved h5_cleanup to outside of try block because
@@ -1380,6 +1400,7 @@ test_dset()
nerrors += test_multiopen(file) < 0 ? 1 : 0;
nerrors += test_types(file) < 0 ? 1 : 0;
nerrors += test_virtual() < 0 ? 1 : 0;
+ nerrors += test_operator(file) < 0 ? 1 : 0;
nerrors += test_chunk_cache(fapl) < 0 ? 1 : 0;
// Close group "emit diagnostics".