summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-11-01 19:27:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-11-01 19:27:15 (GMT)
commit1f3aede7c7adb1a12efb839a15c8cf3a1bce8f1c (patch)
tree1f652a1f70bf984c56553e7fea01535136fd9ce2 /test
parent24f2310b1284c569ea277be00f57248bfd306378 (diff)
downloadhdf5-1f3aede7c7adb1a12efb839a15c8cf3a1bce8f1c.zip
hdf5-1f3aede7c7adb1a12efb839a15c8cf3a1bce8f1c.tar.gz
hdf5-1f3aede7c7adb1a12efb839a15c8cf3a1bce8f1c.tar.bz2
[svn-r14230] Description:
Add H5Ecreate_stack() API routine, to fill a minor gap in the error routines. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'test')
-rw-r--r--test/error_test.c57
1 files changed, 56 insertions, 1 deletions
diff --git a/test/error_test.c b/test/error_test.c
index 97da864..027f31b 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -17,7 +17,7 @@
* Programmer: Raymond Lu
* October 14, 2001
*
- * Purpose: Tests the H5Tget_native_type function.
+ * Purpose: Tests the error API routines.
*/
#include "h5test.h"
@@ -454,6 +454,58 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_create
+ *
+ * Purpose: Test creating an empty error stack
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * November 1, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_create(void)
+{
+ const char *err_func = "test_create"; /* Function name for pushing error */
+ const char *err_msg = "Error message"; /* Error message for pushing error */
+ int err_num; /* Number of errors on stack */
+ hid_t estack_id; /* Error stack ID */
+
+ /* Create an empty error stack */
+ if((estack_id = H5Ecreate_stack()) < 0) TEST_ERROR
+
+ /* Check the number of errors on stack */
+ err_num = H5Eget_num(estack_id);
+ if(err_num != 0) TEST_ERROR
+
+ /* Push an error with a long description */
+ if(H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, err_msg) < 0) TEST_ERROR;
+
+ /* Check the number of errors on stack */
+ err_num = H5Eget_num(estack_id);
+ if(err_num != 1) TEST_ERROR
+
+ /* Clear the error stack */
+ if(H5Eclear2(estack_id) < 0) TEST_ERROR
+
+ /* Check the number of errors on stack */
+ err_num = H5Eget_num(estack_id);
+ if(err_num != 0) TEST_ERROR
+
+ /* Close error stack */
+ if(H5Eclose_stack(estack_id) < 0) TEST_ERROR
+
+ return(0);
+
+error:
+ return(-1);
+} /* end test_create() */
+
+
+/*-------------------------------------------------------------------------
* Function: close_error
*
* Purpose: Closes error information.
@@ -551,6 +603,9 @@ main(void)
/* Test pushing a very long error description */
if(test_long_desc() < 0) TEST_ERROR;
+ /* Test creating a new error stack */
+ if(test_create() < 0) TEST_ERROR;
+
if(H5Fclose(file) < 0) TEST_ERROR;
h5_cleanup(FILENAME, fapl);