00001 /* 00002 * CUnit - A Unit testing framework library for C. 00003 * Copyright (C) 2001 Anil Kumar 00004 * Copyright (C) 2004 Anil Kumar, Jerry St.Clair 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 /* 00022 * Contains CUnit error codes which can be used externally. 00023 * 00024 * Created By : Anil Kumar on ...(in month of Aug 2001) 00025 * Last Modified : 09/Aug/2001 00026 * Comment : ------- 00027 * EMail : aksaharan@yahoo.com 00028 * 00029 * Modified : 02/Oct/2001 00030 * Comment : Added proper Eror Codes 00031 * EMail : aksaharan@yahoo.com 00032 * 00033 * Modified : 13-Oct-2001 00034 * Comment : Added Error Codes for Duplicate TestGroup and Test 00035 * EMail : aksaharan@yahoo.com 00036 * 00037 * Modified : 3-Aug-2004 (JDS) 00038 * Comment : Converted error code macros to an enum, doxygen comments 00039 * moved error handing code here, changed file name from Errno.h, 00040 * added error codes for file open errors, added error action selection 00041 * EMail : jds2@users.sourceforge.net 00042 * 00043 * Modified : 5-Sep-2004 (JDS) 00044 * Comment : Added internal test interface. 00045 * EMail : jds2@users.sourceforge.net 00046 */ 00047 00060 #ifndef _CUNIT_CUERROR_H 00061 #define _CUNIT_CUERROR_H 00062 00063 #include <errno.h> 00064 00065 /*------------------------------------------------------------------------*/ 00073 typedef enum { 00074 /* basic errors */ 00075 CUE_SUCCESS = 0, 00076 CUE_NOMEMORY = 1, 00078 /* Test Registry Level Errors */ 00079 CUE_NOREGISTRY = 10, 00080 CUE_REGISTRY_EXISTS = 11, 00082 /* Test Suite Level Errors */ 00083 CUE_NOSUITE = 20, 00084 CUE_NO_SUITENAME = 21, 00085 CUE_SINIT_FAILED = 22, 00086 CUE_SCLEAN_FAILED = 23, 00087 CUE_DUP_SUITE = 24, 00089 /* Test Case Level Errors */ 00090 CUE_NOTEST = 30, 00091 CUE_NO_TESTNAME = 31, 00092 CUE_DUP_TEST = 32, 00093 CUE_TEST_NOT_IN_SUITE = 33, 00095 /* File handling errors */ 00096 CUE_FOPEN_FAILED = 40, 00097 CUE_FCLOSE_FAILED = 41, 00098 CUE_BAD_FILENAME = 42, 00099 CUE_WRITE_ERROR = 43 00100 } CU_ErrorCode; 00101 00102 /*------------------------------------------------------------------------*/ 00109 typedef enum CU_ErrorAction { 00110 CUEA_IGNORE, 00111 CUEA_FAIL, 00112 CUEA_ABORT 00113 } CU_ErrorAction; 00114 00115 /* Error handling & reporting functions. */ 00116 00117 #ifdef __cplusplus 00118 extern "C" { 00119 #endif 00120 00121 CU_ErrorCode CU_get_error(void); 00122 const char* CU_get_error_msg(void); 00123 void CU_set_error_action(CU_ErrorAction action); 00124 CU_ErrorAction CU_get_error_action(void); 00125 00126 #ifdef CUNIT_BUILD_TESTS 00127 void test_cunit_CUError(void); 00128 #endif 00129 00130 /* Internal function - users should not generally call this function */ 00131 void CU_set_error(CU_ErrorCode error); 00132 00133 #ifdef __cplusplus 00134 } 00135 #endif 00136 00137 #ifdef USE_DEPRECATED_CUNIT_NAMES 00138 00139 #define get_error() CU_get_error_msg() 00140 #endif /* USE_DEPRECATED_CUNIT_NAMES */ 00141 00142 #endif /* _CUNIT_CUERROR_H */ 00143