summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-11-05 12:00:44 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-11-17 10:12:13 +1100
commit3d0a3c1078d936a52ce82720ddc09b4037653655 (patch)
treeda77341aea222bee4f9adea670d9eb5211b9fdca
parent16a3a2da78b1f2d5a1077e382a26466944f6c59e (diff)
downloadsamba-3d0a3c1078d936a52ce82720ddc09b4037653655.tar.gz
samba-3d0a3c1078d936a52ce82720ddc09b4037653655.tar.xz
samba-3d0a3c1078d936a52ce82720ddc09b4037653655.zip
Add helpful function for comparison of DATA_BLOB elements
-rw-r--r--lib/torture/torture.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index f16d2707bb3..73ea1eb6431 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -284,6 +284,21 @@ void torture_result(struct torture_context *test,
} \
} while(0)
+#define torture_assert_data_blob_equal(torture_ctx,got,expected,cmt)\
+ do { const DATA_BLOB __got = (got), __expected = (expected); \
+ if (__got.length != __expected.length) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got".len %d did not match "#expected" len %d: %s", \
+ (int)__got.length, (int)__expected.length, cmt); \
+ return false; \
+ } \
+ if (memcmp(__got.data, __expected.data, __got.length) != 0) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got" of len %d did not match"#expected": %s", (int)__got.length, cmt); \
+ return false; \
+ } \
+ } while(0)
+
#define torture_assert_file_contains_text(torture_ctx,filename,expected,cmt)\
do { \
char *__got; \