2 ** OSSP ts - Test Suite Library
3 ** Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
4 ** Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
5 ** Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
7 ** This file is part of OSSP ts, a small test suite library which
8 ** can be found at http://www.ossp.org/pkg/lib/ts/.
10 ** Permission to use, copy, modify, and distribute this software for
11 ** any purpose with or without fee is hereby granted, provided that
12 ** the above copyright notice and this permission notice appear in all
15 ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
16 ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 ** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
19 ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 ** ts.h: test suite library API
34 /* test suite object type */
36 typedef struct ts_suite_st ts_suite_t;
38 /* test object type */
40 typedef struct ts_test_st ts_test_t;
42 /* test callback function type */
43 typedef void (*ts_test_cb_t)(ts_test_t *);
45 /* test suite operations */
46 ts_suite_t *ts_suite_new (const char *fmt, ...);
47 void ts_suite_test (ts_suite_t *s, ts_test_cb_t func, const char *fmt, ...);
48 int ts_suite_run (ts_suite_t *s);
49 void ts_suite_free (ts_suite_t *s);
52 ts_test_t *ts_test_ctx (ts_test_t *t, const char *file, int line);
53 void ts_test_check (ts_test_t *t, const char *fmt, ...);
54 void ts_test_fail (ts_test_t *t, const char *fmt, ...);
55 void ts_test_log (ts_test_t *t, const char *fmt, ...);
57 /* test suite short-cut macros */
58 #define TS_TEST(name) \
59 static void name(ts_test_t *_t)
61 ts_test_ctx(_t, __FILE__, __LINE__)