summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-05-28 14:10:51 (GMT)
committerGitHub <noreply@github.com>2021-05-28 14:10:51 (GMT)
commit2ddf5fbd92ebdb0d59e208d88f159eec8a1ffbf8 (patch)
tree40975e0846d101360a838d42e16f4687fed77f4a /c++/test
parente22687912dbc6fcf4fff57e86e2cd5d75c81f81e (diff)
downloadhdf5-2ddf5fbd92ebdb0d59e208d88f159eec8a1ffbf8.zip
hdf5-2ddf5fbd92ebdb0d59e208d88f159eec8a1ffbf8.tar.gz
hdf5-2ddf5fbd92ebdb0d59e208d88f159eec8a1ffbf8.tar.bz2
Much normalization with develop (#701)
* Brings CMake updates from develop * Brings reduction in pedantic casts from develop * Purges UFAIL from the library (#637) * Committing clang-format changes * Purges UFAIL from the library * H5HL_insert change requested in PR Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Removes gratuitous (double)x.yF casts (#632) * Committing clang-format changes * Removes gratuitous (double)x.yF casts * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Committing clang-format changes * Cleans up a const warning left over from previous constification (#633) * Committing clang-format changes * Adds consts to a few global variables * Cleans up a const warning left over from previous constification Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Formatted source * Bring over some VOL registration changes * VOL cleanup * H5VL_request_status_t substitutions * H5F.c cleanup * Minor API tweaks from develop * Moves H5G package init/teardown to H5Gint.c * H5G cleanup * H5M cleanup * H5SM cleanup * H5T cleanup * H5R cleanup * H5Lpublic.h cleanup * H5L cleanup * H5O cleanup * H5A, H5CS, and H5AC cleanup * Moved H5A init/teardown code to H5Aint.c * Moves H5D I/O functions to H5D.c * H5D cleanup * Misc minor cleanup * H5P close cleanup * H5Tpublic.h cleanup * Fixes err_compat test * H5PLpublic.h cleanup * Updates H5Ppublic.h * H5Fpublic.h updates * H5A.c cleanup * Brings over H5Aexists and related changes * Brings CMake shell testing changes from develop * Close callback changes * H5R and H5Tcommit normalization * err_compat test works now * H5O tweaks * Updates VOL registration code * Brings over H5VL_create_object * H5Tconv.c reformatting * H5T.c tweaks * Brings datatype and reference updates from develop * Brings VOL plugin loading changes from develop * Brings event sets from develop * Brings async functions over * Tools changes * Brings over many tools changes from develop * Brings VOL flags from develop * Fixes h5dump double/float tests * Updates h5repack tests * Brings h5diff test changes from develop * Last h5dump changes * Brings test changes from develop * Committing clang-format changes * Tidied h5_testing() * Brings chunk iteration code + misc from develop * Updates vds test * Enables external link parallel test * Brings updated property lists from develop * H5G changes from develop * H5MF cleanup * Brings vfd_swmr test back into CMake * Updates threadsafe test * Updates plist test * Brings recent changes from develop Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/dsets.cpp93
1 files changed, 59 insertions, 34 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 356112e..a16061b 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
@@ -182,9 +181,6 @@ test_create(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -260,9 +256,6 @@ test_simple_io(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler
- * Thursday, March 22, 2012
*-------------------------------------------------------------------------
*/
static herr_t
@@ -322,9 +315,6 @@ test_datasize(FileAccPropList &fapl)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -432,9 +422,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
@@ -703,10 +690,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");
@@ -818,9 +801,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
@@ -893,9 +873,6 @@ test_multiopen(H5File &file)
* Return Success: 0
*
* Failure: -1
- *
- * Programmer Binh-Minh Ribler (using C version)
- * February 17, 2001
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1157,7 +1134,7 @@ test_chunk_cache(const 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__);
@@ -1175,7 +1152,7 @@ test_chunk_cache(const 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
@@ -1246,10 +1223,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;
@@ -1316,6 +1289,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)
@@ -1324,9 +1351,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
@@ -1364,6 +1388,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".