2 Unix SMB/CIFS implementation.
3 Simplistic implementation of tap interface.
5 Copyright (C) Rusty Russell 2012
7 ** NOTE! The following LGPL license applies to the talloc
8 ** library. This does NOT imply that all of Samba is released
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Lesser General Public
13 License as published by the Free Software Foundation; either
14 version 3 of the License, or (at your option) any later version.
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public
22 License along with this library; if not, see <http://www.gnu.org/licenses/>.
25 #include <ccan/err/err.h>
29 #define __TAP_STRING_LINE1__(s) #s
30 #define __TAP_STRING_LINE2__(s) __TAP_STRING_LINE1__(s)
31 #define __TAP_STRING_LINE3__ __TAP_STRING_LINE2__(__LINE__)
32 #define __location__ __FILE__ ":" __TAP_STRING_LINE3__
35 extern unsigned tap_ok_count
, tap_ok_target
;
36 #define plan_tests(num) do { tap_ok_target = (num); } while(0)
37 #define ok(e, ...) ((e) ? (printf("."), tap_ok_count++, true) : (warnx(__VA_ARGS__), false))
38 #define ok1(e) ok((e), "%s:%s", __location__, #e)
39 #define pass(...) (printf("."), tap_ok_count++)
40 #define fail(...) warnx(__VA_ARGS__)
41 #define diag(...) do { printf(__VA_ARGS__); printf("\n"); } while(0)
42 #define exit_status() (tap_ok_count == tap_ok_target ? 0 : 1)