forked from libcheck/check
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_pack.h
84 lines (70 loc) · 1.8 KB
/
check_pack.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Check: a unit test framework for C
* Copyright (C) 2001, 2002 Arien Malec
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef CHECK_PACK_H
#define CHECK_PACK_H
enum ck_msg_type
{
CK_MSG_CTX,
CK_MSG_FAIL,
CK_MSG_LOC,
CK_MSG_DURATION,
CK_MSG_LAST
};
typedef struct CtxMsg
{
enum ck_result_ctx ctx;
} CtxMsg;
typedef struct LocMsg
{
int line;
char *file;
} LocMsg;
typedef struct FailMsg
{
char *msg;
} FailMsg;
typedef struct DurationMsg
{
int duration;
} DurationMsg;
typedef union
{
CtxMsg ctx_msg;
FailMsg fail_msg;
LocMsg loc_msg;
DurationMsg duration_msg;
} CheckMsg;
typedef struct RcvMsg
{
enum ck_result_ctx lastctx;
enum ck_result_ctx failctx;
char *fixture_file;
int fixture_line;
char *test_file;
int test_line;
char *msg;
int duration;
} RcvMsg;
void rcvmsg_free(RcvMsg * rmsg);
int pack(enum ck_msg_type type, char **buf, CheckMsg * msg);
int upack(char *buf, CheckMsg * msg, enum ck_msg_type *type);
void ppack(FILE * fdes, enum ck_msg_type type, CheckMsg * msg);
RcvMsg *punpack(FILE * fdes);
#endif /*CHECK_PACK_H */