ucx/test.h

changeset 83
3b552d7a9610
parent 70
6721482eaf8e
child 88
18823857ce79
equal deleted inserted replaced
82:6068d965328b 83:3b552d7a9610
35 35
36 #include "ucx.h" 36 #include "ucx.h"
37 #include <stdio.h> 37 #include <stdio.h>
38 #include <string.h> 38 #include <string.h>
39 #include <setjmp.h> 39 #include <setjmp.h>
40 #include "list.h"
41 40
42 #ifdef __cplusplus 41 #ifdef __cplusplus
43 extern "C" { 42 extern "C" {
44 #endif 43 #endif
45 44
46 #ifndef __FUNCTION__ 45 #ifndef __FUNCTION__
47 #define __FUNCTION__ __func__ 46 #define __FUNCTION__ __func__
48 #endif 47 #endif
49 48
50 typedef struct { 49 typedef struct UcxTestList UcxTestList;
50 typedef struct UcxTestSuite UcxTestSuite;
51 typedef void(*UcxTest)(UcxTestSuite*,FILE*);
52
53 struct UcxTestList{
54 UcxTest test;
55 UcxTestList *next;
56 };
57
58 struct UcxTestSuite {
51 unsigned int success; 59 unsigned int success;
52 unsigned int failure; 60 unsigned int failure;
53 UcxList *tests; 61 UcxTestList *tests;
54 } UcxTestSuite; 62 };
55
56 typedef void(*UcxTest)(UcxTestSuite*,FILE*);
57 63
58 UcxTestSuite* ucx_test_suite_new(); 64 UcxTestSuite* ucx_test_suite_new();
59 void ucx_test_suite_free(UcxTestSuite*); 65 void ucx_test_suite_free(UcxTestSuite*);
60 66
61 void ucx_test_register(UcxTestSuite*, UcxTest); 67 int ucx_test_register(UcxTestSuite*, UcxTest);
62 void ucx_test_run(UcxTestSuite*, FILE*); 68 void ucx_test_run(UcxTestSuite*, FILE*);
63 69
64 #define UCX_TEST_DECLARE(name) void name(UcxTestSuite*,FILE *) 70 #define UCX_TEST_DECLARE(name) void name(UcxTestSuite*,FILE *)
65 #define UCX_TEST_IMPLEMENT(name) void name(UcxTestSuite* _suite_,FILE *_output_) 71 #define UCX_TEST_IMPLEMENT(name) void name(UcxTestSuite* _suite_,FILE *_output_)
66 72

mercurial