summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-10-13 16:29:19 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-13 16:29:19 +0200
commiteaba7784160be9dcf40f57c30c6f01a691082ba6 (patch)
treef73b396ba51274db4621b8fae111c9b5609b78fc /lib
parent3d6f759d08b1ff79dd3941a96656847eebfa39db (diff)
downloadsamba-eaba7784160be9dcf40f57c30c6f01a691082ba6.tar.gz
samba-eaba7784160be9dcf40f57c30c6f01a691082ba6.tar.bz2
samba-eaba7784160be9dcf40f57c30c6f01a691082ba6.zip
Add test for data_blob_string_const_null.
Diffstat (limited to 'lib')
-rw-r--r--lib/util/tests/data_blob.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/util/tests/data_blob.c b/lib/util/tests/data_blob.c
index e0be7a4046..875e5fdef8 100644
--- a/lib/util/tests/data_blob.c
+++ b/lib/util/tests/data_blob.c
@@ -32,6 +32,16 @@ static bool test_string(struct torture_context *tctx)
return true;
}
+static bool test_string_null(struct torture_context *tctx)
+{
+ DATA_BLOB blob = data_blob_string_const_null("bla");
+
+ torture_assert_int_equal(tctx, blob.length, 4, "blob length");
+ torture_assert_str_equal(tctx, (char *)blob.data, "bla", "blob data");
+
+ return true;
+}
+
static bool test_zero(struct torture_context *tctx)
{
int i;
@@ -77,6 +87,7 @@ struct torture_suite *torture_local_util_data_blob(TALLOC_CTX *mem_ctx)
struct torture_suite *suite = torture_suite_create(mem_ctx, "DATABLOB");
torture_suite_add_simple_test(suite, "string", test_string);
+ torture_suite_add_simple_test(suite, "string_null", test_string_null);
torture_suite_add_simple_test(suite, "zero", test_zero);;
torture_suite_add_simple_test(suite, "clear", test_clear);
torture_suite_add_simple_test(suite, "cmp", test_cmp);