diff options
author | Günther Deschner <gd@samba.org> | 2010-12-15 17:44:23 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-12-17 11:33:05 +0100 |
commit | 28d618ddf015f502ef0fa8a5f8472123c7cd9102 (patch) | |
tree | c6210d5625ceaa4475d36eb07301bf670ca1ed98 /lib/torture | |
parent | f08fdfae27ee0da5750c3f843ad829e1fa8f57b1 (diff) | |
download | samba-28d618ddf015f502ef0fa8a5f8472123c7cd9102.tar.gz samba-28d618ddf015f502ef0fa8a5f8472123c7cd9102.tar.xz samba-28d618ddf015f502ef0fa8a5f8472123c7cd9102.zip |
s4-smbtorture: add torture_assert_strn_equal macro.
Guenther
Diffstat (limited to 'lib/torture')
-rw-r--r-- | lib/torture/torture.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/torture/torture.h b/lib/torture/torture.h index aeedd71e6b5..39f83df4e4f 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) { \ |