/home/oden/RPM/BUILD/apr-util-1.0.0/test/CuTest.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef CU_TEST_H
00033 #define CU_TEST_H
00034
00035 #include <setjmp.h>
00036 #include <stdarg.h>
00037
00038
00039
00040 char* CuStrAlloc(int size);
00041 char* CuStrCopy(const char* old);
00042
00043 #define CU_ALLOC(TYPE) ((TYPE*) malloc(sizeof(TYPE)))
00044
00045 #define HUGE_STRING_LEN 8192
00046 #define STRING_MAX 256
00047 #define STRING_INC 256
00048
00049 typedef struct
00050 {
00051 int length;
00052 int size;
00053 char* buffer;
00054 } CuString;
00055
00056 void CuStringInit(CuString* str);
00057 CuString* CuStringNew(void);
00058 void CuStringRead(CuString* str, char* path);
00059 void CuStringAppend(CuString* str, const char* text);
00060 void CuStringAppendChar(CuString* str, char ch);
00061 void CuStringAppendFormat(CuString* str, const char* format, ...);
00062 void CuStringResize(CuString* str, int newSize);
00063
00064
00065
00066 typedef struct CuTest CuTest;
00067
00068 typedef void (*TestFunction)(CuTest *);
00069
00070 struct CuTest
00071 {
00072 char* name;
00073 TestFunction function;
00074 int notimpl;
00075 int failed;
00076 int ran;
00077 char* message;
00078 jmp_buf *jumpBuf;
00079 };
00080
00081 void CuInit(int argc, char *argv[]);
00082 void CuTestInit(CuTest* t, char* name, TestFunction function);
00083 CuTest* CuTestNew(char* name, TestFunction function);
00084 void CuFail(CuTest* tc, const char* message);
00085 void CuNotImpl(CuTest* tc, const char* message);
00086 void CuAssert(CuTest* tc, const char* message, int condition);
00087 void CuAssertTrue(CuTest* tc, int condition);
00088 void CuAssertStrEquals(CuTest* tc, const char* expected, const char* actual);
00089 void CuAssertStrNEquals(CuTest* tc, const char* expected, const char* actual,
00090 int n);
00091 void CuAssertIntEquals(CuTest* tc, int expected, int actual);
00092 void CuAssertPtrEquals(CuTest* tc, const void* expected, const void* actual);
00093 void CuAssertPtrNotNull(CuTest* tc, const void* pointer);
00094
00095 void CuTestRun(CuTest* tc);
00096
00097
00098
00099 #define MAX_TEST_CASES 1024
00100
00101 #define SUITE_ADD_TEST(SUITE,TEST) CuSuiteAdd(SUITE, CuTestNew(#TEST, TEST))
00102
00103 typedef struct
00104 {
00105 char *name;
00106 int count;
00107 CuTest* list[MAX_TEST_CASES];
00108 int failCount;
00109 int notimplCount;
00110
00111 } CuSuite;
00112
00113
00114 void CuSuiteInit(CuSuite* testSuite, char* name);
00115 CuSuite* CuSuiteNew(char* name);
00116 void CuSuiteAdd(CuSuite* testSuite, CuTest *testCase);
00117 void CuSuiteAddSuite(CuSuite* testSuite, CuSuite* testSuite2);
00118 void CuSuiteRun(CuSuite* testSuite);
00119 void CuSuiteSummary(CuSuite* testSuite, CuString* summary);
00120 void CuSuiteOverView(CuSuite* testSuite, CuString* details);
00121 void CuSuiteDetails(CuSuite* testSuite, CuString* details);
00122
00123 typedef struct
00124 {
00125 char *name;
00126 int count;
00127 CuSuite* list[MAX_TEST_CASES];
00128 } CuSuiteList;
00129
00130
00131 CuSuiteList* CuSuiteListNew(char* name);
00132 void CuSuiteListAdd(CuSuiteList* testSuite, CuSuite *testCase);
00133 void CuSuiteListRun(CuSuiteList* testSuite);
00134 void CuSuiteListRunWithSummary(CuSuiteList* testSuite);
00135 void CuSuiteListSummary(CuSuiteList* testSuite, CuString* summary);
00136
00137
00138 int CuSuiteListDetails(CuSuiteList* testSuite, CuString* details);
00139 #endif
00140
Generated on Thu Sep 16 13:48:14 2004 for Apache Portable Runtime Utility Library by
1.3.7