MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tap.h
1 /* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
15 
16  Library for providing TAP support for testing C and C++ was written
17  by Mats Kindahl <mats@mysql.com>.
18 */
19 
20 #ifndef TAP_H
21 #define TAP_H
22 
23 #include "my_global.h"
24 
25 /*
26  @defgroup MyTAP MySQL support for performing unit tests according to
27  the Test Anything Protocol (TAP).
28 */
29 
30 #define NO_PLAN (0)
31 
41 typedef struct TEST_DATA {
48  int plan;
49 
51  int last;
52 
54  int failed;
55 
57  char todo[128];
58 } TEST_DATA;
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
80 extern int skip_big_tests;
81 
109 void plan(int const count);
110 
111 
128 void ok(int const pass, char const *fmt, ...)
129  __attribute__((format(printf,2,3)));
130 
131 
140 void ok1(int const pass);
141 
142 
171 void skip(int how_many, char const *reason, ...)
172  __attribute__((format(printf,2,3)));
173 
174 
192 #define SKIP_BLOCK_IF(SKIP_IF_TRUE, COUNT, REASON) \
193  if (SKIP_IF_TRUE) skip((COUNT),(REASON)); else
194 
195 
210 #define SKIP_BIG_TESTS(COUNT) \
211  if (skip_big_tests) skip((COUNT), "big test"); else
212 
213 
220 void diag(char const *fmt, ...)
221  __attribute__((format(printf,1,2)));
222 
223 
242 void BAIL_OUT(char const *fmt, ...)
243  __attribute__((noreturn, format(printf,1,2)));
244 
245 
262 int exit_status(void);
263 
264 
273 void skip_all(char const *reason, ...)
274  __attribute__((noreturn, format(printf, 1, 2)));
275 
276 
298 void todo_start(char const *message, ...)
299  __attribute__((format(printf, 1, 2)));
300 
301 
306 void todo_end();
307 
310 #ifdef __cplusplus
311 }
312 #endif
313 
314 #endif /* TAP_H */