summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-12-15 17:44:23 +0100
committerGünther Deschner <gd@samba.org>2010-12-17 11:33:05 +0100
commit28d618ddf015f502ef0fa8a5f8472123c7cd9102 (patch)
treec6210d5625ceaa4475d36eb07301bf670ca1ed98 /lib
parentf08fdfae27ee0da5750c3f843ad829e1fa8f57b1 (diff)
downloadsamba-28d618ddf015f502ef0fa8a5f8472123c7cd9102.tar.gz
samba-28d618ddf015f502ef0fa8a5f8472123c7cd9102.tar.bz2
samba-28d618ddf015f502ef0fa8a5f8472123c7cd9102.zip
s4-smbtorture: add torture_assert_strn_equal macro.
Guenther
Diffstat (limited to 'lib')
-rw-r--r--lib/torture/torture.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index aeedd71e6b..39f83df4e4 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -311,6 +311,16 @@ void torture_result(struct torture_context *test,
} \
} while(0)
+#define torture_assert_strn_equal(torture_ctx,got,expected,len,cmt)\
+ do { const char *__got = (got), *__expected = (expected); \
+ if (strncmp(__got, __expected, len) != 0) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got" %s of len %d did not match "#expected" %s: %s", \
+ __got, (int)len, __expected, cmt); \
+ return false; \
+ } \
+ } while(0)
+
#define torture_assert_str_equal_goto(torture_ctx,got,expected,ret,label,cmt)\
do { const char *__got = (got), *__expected = (expected); \
if (strcmp_safe(__got, __expected) != 0) { \