ucx/test.h

changeset 69
fb59270b1de3
parent 33
9c219a62070d
child 70
6721482eaf8e
equal deleted inserted replaced
68:88dbea299440 69:fb59270b1de3
31 */ 31 */
32 32
33 #ifndef TEST_H 33 #ifndef TEST_H
34 #define TEST_H 34 #define TEST_H
35 35
36 #include "ucx.h"
36 #include <stdio.h> 37 #include <stdio.h>
37 #include <string.h> 38 #include <string.h>
38 #include <setjmp.h> 39 #include <setjmp.h>
39 #include "list.h" 40 #include "list.h"
40 41
41 #ifdef __cplusplus 42 #ifdef __cplusplus
42 extern "C" { 43 extern "C" {
44 #endif
45
46 #ifndef __FUNCTION__
47 #define __FUNCTION__ __func__
43 #endif 48 #endif
44 49
45 typedef struct { 50 typedef struct {
46 unsigned int success; 51 unsigned int success;
47 unsigned int failure; 52 unsigned int failure;
58 63
59 #define UCX_TEST_DECLARE(name) void name(UcxTestSuite*,FILE *); 64 #define UCX_TEST_DECLARE(name) void name(UcxTestSuite*,FILE *);
60 #define UCX_TEST_IMPLEMENT(name) void name(UcxTestSuite* _suite_,FILE *_output_) 65 #define UCX_TEST_IMPLEMENT(name) void name(UcxTestSuite* _suite_,FILE *_output_)
61 66
62 #define UCX_TEST_BEGIN fwrite("Running ", 1, 8, _output_);\ 67 #define UCX_TEST_BEGIN fwrite("Running ", 1, 8, _output_);\
63 fwrite(__func__, 1, strlen(__func__), _output_);\ 68 fwrite(__FUNCTION__, 1, strlen(__FUNCTION__), _output_);\
64 fwrite("... ", 1, 4, _output_);\ 69 fwrite("... ", 1, 4, _output_);\
65 jmp_buf _env_; \ 70 jmp_buf _env_; \
66 if (!setjmp(_env_)) { 71 if (!setjmp(_env_)) {
67 72
68 #define UCX_TEST_ASSERT(condition,message) if (!(condition)) { \ 73 #define UCX_TEST_ASSERT(condition,message) if (!(condition)) { \

mercurial