summaryrefslogtreecommitdiffstats
path: root/test/event_set.c
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 /test/event_set.c
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 'test/event_set.c')
-rw-r--r--test/event_set.c135
1 files changed, 135 insertions, 0 deletions
diff --git a/test/event_set.c b/test/event_set.c
new file mode 100644
index 0000000..6568663
--- /dev/null
+++ b/test/event_set.c
@@ -0,0 +1,135 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * 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://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Quincey Koziol
+ * Wednesday, April 8, 2020
+ *
+ * Purpose: Tests event sets.
+ */
+#include "h5test.h"
+#include "H5srcdir.h"
+
+const char *FILENAME[] = {"event_set_1", NULL};
+
+/*-------------------------------------------------------------------------
+ * Function: test_es_create
+ *
+ * Purpose: Tests creating event sets.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, April 9, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_es_create(void)
+{
+ hid_t es_id; /* Event set ID */
+ size_t count; /* # of events in set */
+ size_t num_errs; /* # of failed events in set */
+ uint64_t num_ops; /* # of events inserted into set */
+ hbool_t err_occurred; /* Whether an error has occurred */
+
+ TESTING("event set creation");
+
+ /* Create an event set */
+ if ((es_id = H5EScreate()) < 0)
+ TEST_ERROR;
+
+ /* Query the # of events in empty event set */
+ count = 0;
+ if (H5ESget_count(es_id, &count) < 0)
+ TEST_ERROR;
+ if (count > 0)
+ FAIL_PUTS_ERROR("should be empty event set");
+
+ /* Check for errors */
+ err_occurred = FALSE;
+ if (H5ESget_err_status(es_id, &err_occurred) < 0)
+ TEST_ERROR;
+ if (err_occurred)
+ FAIL_PUTS_ERROR("should not be an error for the event set");
+
+ /* Check errors count */
+ num_errs = 0;
+ if (H5ESget_err_count(es_id, &num_errs) < 0)
+ TEST_ERROR;
+ if (num_errs)
+ FAIL_PUTS_ERROR("should not be any errors for the event set");
+
+ /* Check errors count */
+ num_ops = 0;
+ if (H5ESget_op_counter(es_id, &num_ops) < 0)
+ TEST_ERROR;
+ if (num_ops)
+ FAIL_PUTS_ERROR("should not be any operations for the event set yet");
+
+ /* Close the event set */
+ if (H5ESclose(es_id) < 0)
+ TEST_ERROR;
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ {
+ H5ESclose(es_id);
+ }
+ H5E_END_TRY;
+ return 1;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests event sets
+ *
+ * Return: Success: EXIT_SUCCESS
+ * Failure: EXIT_FAILURE
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, April 8, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
+ int nerrors = 0; /* Error count */
+
+ /* Setup */
+ h5_reset();
+ fapl_id = h5_fileaccess();
+
+ /* Tests */
+ nerrors += test_es_create();
+
+ /* Cleanup */
+ h5_cleanup(FILENAME, fapl_id);
+
+ /* Check for any errors */
+ if (nerrors) {
+ HDputs("***** EVENT SET TESTS FAILED *****");
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ /* Report status */
+ HDputs("All event set tests passed.");
+
+ HDexit(EXIT_SUCCESS);
+} /* end main() */