summaryrefslogtreecommitdiffstats
path: root/c++/test/dsets.cpp
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-05-21 13:34:16 (GMT)
committerGitHub <noreply@github.com>2021-05-21 13:34:16 (GMT)
commit9ed46a47c2aea4fc22f40aee93709f3cf2bcc404 (patch)
tree850d70507b2b8501fdfb22b6ca5d94de1ee7ceeb /c++/test/dsets.cpp
parent16c9027a70327e51d104ea9616daf5f87cd30e55 (diff)
downloadhdf5-9ed46a47c2aea4fc22f40aee93709f3cf2bcc404.zip
hdf5-9ed46a47c2aea4fc22f40aee93709f3cf2bcc404.tar.gz
hdf5-9ed46a47c2aea4fc22f40aee93709f3cf2bcc404.tar.bz2
Merge DataSet::operator= to Hdf5 1 12 (#667)
* Snapshot version 1.12 release 1-3. Update version to 1.12.1-4. * First cut of the H5 public API documentation. (#80) * First cut of the H5 public API documentation. * Added H5Z "bonus track." * Applied Quincey's patch. * Added the missing patches from Quincey's original patch. * H5PL (complete) and basic H5VL API documentation. * Added H5I API docs. * Added H5L API docs. * First installment from Elena's H5T batch. * Second installment of Elena's H5T batch. * Final installment of Elena's H5T batch. * Full set of current H5F documentation. (#105) * First cut of the H5 public API documentation. * Added H5Z "bonus track." * Applied Quincey's patch. * Added the missing patches from Quincey's original patch. * H5PL (complete) and basic H5VL API documentation. * Added H5I API docs. * Added H5L API docs. * First installment from Elena's H5T batch. * Second installment of Elena's H5T batch. * Final installment of Elena's H5T batch. * Migrated documentation for SWMR functions. * Catching up on MDC functions. * Integrated the H5F MDC function documentation. * Added MDC and parallel H5F functions. * Slightly updated main page. * Added doxygen/dox/H5AC_cache_config_t.dox to MANIFEST. * Doxygen - added (mostly) beginner functions (#112) * Doxygen - added (mostly) beginner functions * Removed duplicate H5Pset_szip function * Add src/H5module.h to MANIFEST. * Revert addition of & to 2 parameters in DSetCreatPropList::setVirtual from PR #448 Various clang tidy warning fixes, to maintain binary compatibility in hdf5_1_12. * Commit H5Trace3 macro change for code change merged from develop. * Enable maintainer mode. * BUG: DataSet assignment operator is missing (#503) * BUG: DataSet assignment operator is missing * Some compilers complain if the copy constructor is given explicitly but the assignment operator is implicitly set to default. * Explicitly defining the assignment operator allows us to properly handle reference counters for shared resources. * BUG: DataSet assignment operator is missing. * Mimicking code of H5DataType::operator() as suggested by @bmribler. * Added test Description: Added test for DataSet::operator= that Leengit added Platform tested: Linux/64 (jelly) * Removed Author field. * Commit clang format changes. * Entry for Leengit's github PR #503 * Removed lines left by mistake Co-authored-by: Binh-Minh Ribler <bmribler@hdfgroup.org> Co-authored-by: Larry Knox <lrknox@hdfgroup.org> Co-authored-by: Gerd Heber <gheber@hdfgroup.org> Co-authored-by: bljhdf <58825073+bljhdf@users.noreply.github.com> Co-authored-by: Lee Newberg <35611400+Leengit@users.noreply.github.com> Co-authored-by: Binh-Minh Ribler <bmribler@hdfgroup.org>
Diffstat (limited to 'c++/test/dsets.cpp')
-rw-r--r--c++/test/dsets.cpp89
1 files changed, 57 insertions, 32 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 472ccb3..52e3e73 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -42,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;
@@ -58,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
@@ -184,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
@@ -263,9 +259,6 @@ test_simple_io(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler
- * Thursday, March 22, 2012
*-------------------------------------------------------------------------
*/
static herr_t
@@ -325,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
@@ -435,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
@@ -708,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");
@@ -823,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
@@ -899,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
@@ -1258,10 +1235,6 @@ test_chunk_cache(const FileAccPropList &fapl)
*
* Return Success: 0
* Failure: number of errors
- *
- * Programmer Binh-Minh Ribler
- * Friday, March 10, 2017
- *
*-------------------------------------------------------------------------
*/
const int RANK = 2;
@@ -1328,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)
@@ -1336,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
@@ -1376,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".