From eaba7784160be9dcf40f57c30c6f01a691082ba6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 13 Oct 2008 16:29:19 +0200 Subject: Add test for data_blob_string_const_null. --- lib/util/tests/data_blob.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/util') 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); -- cgit