2 Unix SMB/CIFS implementation.
3 SMB torture UI functions
5 Copyright (C) Jelmer Vernooij 2006
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef __TORTURE_UI_H__
22 #define __TORTURE_UI_H__
24 /****************************************************************************
25 ****************************************************************************/
34 struct torture_context
{
35 enum torture_result last_result
;
41 /****************************************************************************
42 ****************************************************************************/
44 #define torture_assert(torture_ctx,expr,cmt) do {\
46 torture_result(torture_ctx, TORTURE_FAIL, __location__": Expression `%s' failed: %s", __STRING(expr), cmt); \
51 #define torture_assert_str_equal(torture_ctx,got,expected,cmt)\
52 do { const char *__got = (got), *__expected = (expected); \
53 if (strcmp(__got, __expected) != 0) { \
54 torture_result(torture_ctx, TORTURE_FAIL, \
55 __location__": "#got" was %s, expected %s: %s", \
56 __got, __expected, cmt); \
61 #define torture_assert_int_equal(torture_ctx,got,expected,cmt)\
62 do { int __got = (got), __expected = (expected); \
63 if (__got != __expected) { \
64 torture_result(torture_ctx, TORTURE_FAIL, \
65 __location__": "#got" was %d, expected %d: %s", \
66 __got, __expected, cmt); \
71 #define torture_assert_mem_equal(torture_ctx,got,expected,len,cmt)\
72 do { const void *__got = (got), *__expected = (expected); \
73 if (memcmp(__got, __expected, len) != 0) { \
74 torture_result(torture_ctx, TORTURE_FAIL, \
75 __location__": "#got" of len %d did not match "#expected": %s", (int)len, cmt); \
80 #define torture_skip(torture_ctx,cmt) do {\
81 torture_result(torture_ctx, TORTURE_SKIP, __location__": %s", cmt);\
85 #define torture_fail(torture_ctx,cmt) do {\
86 torture_result(torture_ctx, TORTURE_FAIL, __location__": %s", cmt);\
90 #include "torture_proto.h"