head 1.6; access; symbols LMTP2NNTP_1_4_1:1.5 LMTP2NNTP_1_4_0:1.5 SIO_0_9_3:1.5 SA_1_2_6:1.5 SA_1_2_5:1.5 SA_1_2_4:1.5 SA_1_2_3:1.5 LMTP2NNTP_1_3_0:1.4 LMTP2NNTP_1_3b2:1.4 SA_1_2_2:1.4 LMTP2NNTP_1_3b1:1.4 SA_1_2_1:1.4 LMTP2NNTP_1_3a3:1.4 LMTP2NNTP_1_3a2:1.4 LMTP2NNTP_1_3a1:1.4 SA_1_2_0:1.4 SA_1_1_0:1.3 SIO_0_9_2:1.3 SIO_0_9_1:1.3 LMTP2NNTP_1_2_0:1.3 LMTP2NNTP_1_2b4:1.3 LMTP2NNTP_1_2b3:1.3 LMTP2NNTP_1_2b2:1.3 LMTP2NNTP_1_2b1:1.3 LMTP2NNTP_1_2a8:1.3 SIO_0_9_0:1.3 LMTP2NNTP_1_2a7:1.3 SA_1_0_5:1.3 SA_1_0_4:1.3 SA_1_0_3:1.3 SA_1_0_2:1.3 SA_1_0_1:1.3 SA_1_0_0:1.3 SA_0_9_3:1.3 SA_0_9_2:1.3 LMTP2NNTP_1_2a6:1.3 LMTP2NNTP_1_2a5:1.3 SA_0_9_1:1.3 LMTP2NNTP_1_2a4:1.3 LMTP2NNTP_1_2a3:1.3 SA_0_9_0:1.3 LMTP2NNTP_1_2a1:1.2 LMTP2NNTP_1_1_1:1.2 LMTP2NNTP_1_1_0:1.2 LMTP2NNTP_1_1b4:1.2 LMTP2NNTP_1_1b3:1.2 LMTP2NNTP_1_1b2:1.1 LMTP2NNTP_1_1b1:1.1; locks; strict; comment @ * @; 1.6 date 2006.06.10.10.00.17; author rse; state Exp; branches; next 1.5; commitid JpcJR7gM5uNpwrAr; 1.5 date 2005.01.24.15.10.09; author rse; state Exp; branches; next 1.4; 1.4 date 2004.04.02.18.21.07; author rse; state Exp; branches; next 1.3; 1.3 date 2002.01.02.12.43.50; author rse; state Exp; branches; next 1.2; 1.2 date 2001.10.31.19.28.49; author rse; state Exp; branches; next 1.1; 1.1 date 2001.10.10.15.01.56; author rse; state Exp; branches; next ; desc @@ 1.6 log @Adjusted all copyright messages for year 2006 @ text @/* ** TS - OSSP Test Suite Library ** Copyright (c) 2001-2006 Ralf S. Engelschall ** Copyright (c) 2001-2006 The OSSP Project ** Copyright (c) 2001-2005 Cable & Wireless ** ** This file is part of OSSP TS, a small test suite library which ** can be found at http://www.ossp.org/pkg/ts/. ** ** Permission to use, copy, modify, and distribute this software for ** any purpose with or without fee is hereby granted, provided that ** the above copyright notice and this permission notice appear in all ** copies. ** ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ** SUCH DAMAGE. ** ** ts.h: test suite library API */ #ifndef _TS_H_ #define _TS_H_ /* test suite object type */ struct ts_suite_st; typedef struct ts_suite_st ts_suite_t; /* test object type */ struct ts_test_st; typedef struct ts_test_st ts_test_t; /* test callback function type */ typedef void (*ts_test_cb_t)(ts_test_t *); /* test suite operations */ ts_suite_t *ts_suite_new (const char *fmt, ...); void ts_suite_test (ts_suite_t *s, ts_test_cb_t func, const char *fmt, ...); int ts_suite_run (ts_suite_t *s); void ts_suite_free (ts_suite_t *s); /* test operations */ ts_test_t *ts_test_ctx (ts_test_t *t, const char *file, int line); void ts_test_check (ts_test_t *t, const char *fmt, ...); void ts_test_fail (ts_test_t *t, const char *fmt, ...); void ts_test_log (ts_test_t *t, const char *fmt, ...); /* test suite short-cut macros */ #define TS_TEST(name) \ static void name(ts_test_t *_t) #define TS_CTX \ ts_test_ctx(_t, __FILE__, __LINE__) #endif /* _TS_H_ */ @ 1.5 log @welcome 2005 in OSSP sa, too @ text @d3 2 a4 2 ** Copyright (c) 2001-2005 Ralf S. Engelschall ** Copyright (c) 2001-2005 The OSSP Project @ 1.4 log @Adjusted all copyright messages for new year 2004. @ text @d3 3 a5 3 ** Copyright (c) 2001-2004 Ralf S. Engelschall ** Copyright (c) 2001-2004 The OSSP Project ** Copyright (c) 2001-2004 Cable & Wireless @ 1.3 log @bump copyright year @ text @d3 3 a5 3 ** Copyright (c) 2001-2002 Ralf S. Engelschall ** Copyright (c) 2001-2002 The OSSP Project ** Copyright (c) 2001-2002 Cable & Wireless Deutschland @ 1.2 log @Rename test suite library name spaces in order to get rid of problems under Sun Solaris 2.x. @ text @d3 3 a5 3 ** Copyright (c) 2001 Ralf S. Engelschall ** Copyright (c) 2001 The OSSP Project ** Copyright (c) 2001 Cable & Wireless Deutschland @ 1.1 log @Implemented a new sub-library OSSP TS (Test Suite) and use this new beast for the first cut of an OSSP SA test suite. The TS library produces nice test suite reports like this one (for a failed test suite): | Test Suite: OSSP SA (Socket Abstraction Library) | __________________________________________________________________ | | Test: socket address abstraction .............................. OK | Test: socket abstraction .................................. FAILED | Ops, 1/1 checks failed! Detailed report follows: | Check: testerliX [sa_test.c:43] | Log: sorry [sa_test.c:44] | __________________________________________________________________ | | Test Summary: 2 tests (1 ok, 1 failed), 5 checks (4 ok, 1 failed) | Test Suite: FAILED (Test Suite Failed) Or this one (for a successfull test suite): | Test Suite: OSSP SA (Socket Abstraction Library) | __________________________________________________________________ | | Test: socket address abstraction .............................. OK | Test: socket abstraction ...................................... OK | __________________________________________________________________ | | Test Summary: 2 tests (2 ok, 0 failed), 5 checks (5 ok, 0 failed) | Test Suite: OK (Test Suite Successfully) @ text @d7 1 a7 1 ** This file is part of OSSP TS, a test suite library which d34 28 a61 26 struct ts_st; typedef struct ts_st ts_t; struct tst_st; typedef struct tst_st tst_t; typedef void (*tst_func_t)(tst_t *); #define TST_FUNC(name) \ static void name(tst_t *tst) #define TST_CTX(tst) \ tst_ctx(tst, __FILE__, __LINE__) #define TST \ TST_CTX(tst) ts_t *ts_new (const char *fmt, ...); void ts_test (ts_t *ts, tst_func_t func, const char *fmt, ...); int ts_run (ts_t *ts); void ts_free (ts_t *ts); tst_t *tst_ctx (tst_t *tst, const char *file, int line); void tst_check (tst_t *tst, const char *fmt, ...); void tst_fail (tst_t *tst, const char *fmt, ...); void tst_log (tst_t *tst, const char *fmt, ...); @