Debian Codegraph @

libs/gst/check/libcheck/check_pack.h

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