From 582d46ec42144bddccddacadd52a0256f58cb453 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 16 Jun 2006 22:06:09 +0000 Subject: r16304: Improve testing UI API. This now allows registering the full test suite tree, looks a bit more like other unit testing API's, fixes some memory responsibility issues, introduces testcases, and removes the need for tests to call torture_ok(). (This used to be commit 0445b1a56a02552f895f400960b9ced39244a144) --- source4/torture/local/ndr.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'source4/torture/local/ndr.c') diff --git a/source4/torture/local/ndr.c b/source4/torture/local/ndr.c index 9950531a26..4f743b5229 100644 --- a/source4/torture/local/ndr.c +++ b/source4/torture/local/ndr.c @@ -24,12 +24,11 @@ #include "torture/ui.h" #include "librpc/ndr/libndr.h" -static BOOL test_check_string_terminator(struct torture_context *torture) +static BOOL test_check_string_terminator(struct torture_context *test, + const void *_data) { struct ndr_pull *ndr; DATA_BLOB blob; - struct torture_test *test = torture_test(torture, "string_terminator", - "string terminator"); /* Simple test */ blob = strhex_to_data_blob("0000"); @@ -45,7 +44,6 @@ static BOOL test_check_string_terminator(struct torture_context *torture) if (NT_STATUS_IS_OK(ndr_check_string_terminator(ndr, 1, 3))) { torture_fail(test, "check_string_terminator checked beyond string boundaries"); - talloc_free(test); return False; } @@ -68,21 +66,22 @@ static BOOL test_check_string_terminator(struct torture_context *torture) if (NT_STATUS_IS_OK(ndr_check_string_terminator(ndr, 2, 1))) { torture_fail(test, "check_string_terminator erroneously reported terminator"); - talloc_free(test); return False; } torture_assert (test, ndr->offset == 0, "check_string_terminator did not reset offset"); - talloc_free(test); - return True; } BOOL torture_local_ndr(struct torture_context *torture) { - test_check_string_terminator(torture); + struct torture_suite *suite = torture_suite_create(torture, "LOCAL-NDR"); + + torture_suite_add_simple_tcase(suite, "string terminator", + test_check_string_terminator, + NULL); - return torture_result(torture); + return torture_run_suite(torture, suite); } -- cgit