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;
40 /****************************************************************************
41 ****************************************************************************/
43 #define torture_assert(torture_ctx,expr,cmt) do {\
45 torture_result(torture_ctx, TORTURE_FAIL, __location__": Expression `%s' failed: %s", __STRING(expr), cmt); \
50 #define torture_assert_str_equal(torture_ctx,got,expected,cmt)\
51 do { const char *__got = (got), *__expected = (expected); \
52 if (strcmp_safe(__got, __expected) != 0) { \
53 torture_result(torture_ctx, TORTURE_FAIL, \
54 __location__": "#got" was %s, expected %s: %s", \
55 __got, __expected, cmt); \
60 #define torture_assert_int_equal(torture_ctx,got,expected,cmt)\
61 do { int __got = (got), __expected = (expected); \
62 if (__got != __expected) { \
63 torture_result(torture_ctx, TORTURE_FAIL, \
64 __location__": "#got" was %d, expected %d: %s", \
65 __got, __expected, cmt); \
70 #define torture_assert_mem_equal(torture_ctx,got,expected,len,cmt)\
71 do { const void *__got = (got), *__expected = (expected); \
72 if (memcmp(__got, __expected, len) != 0) { \
73 torture_result(torture_ctx, TORTURE_FAIL, \
74 __location__": "#got" of len %d did not match "#expected": %s", (int)len, cmt); \
79 #define torture_skip(torture_ctx,cmt) do {\
80 torture_result(torture_ctx, TORTURE_SKIP, __location__": %s", cmt);\
84 #define torture_fail(torture_ctx,cmt) do {\
85 torture_result(torture_ctx, TORTURE_FAIL, __location__": %s", cmt);\
89 #include "torture_proto.h"