summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-03-05 01:50:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:49:13 -0500
commit1d75e907e28fa0ee21c4693cbac9e0cdfb11c111 (patch)
tree61c045f1986474deb6e6839b75ff36d5832052b9
parent0a28fbae1b7c00a32fe5b3d8bfa1cb0d8c8d4a85 (diff)
downloadsamba-1d75e907e28fa0ee21c4693cbac9e0cdfb11c111.tar.gz
samba-1d75e907e28fa0ee21c4693cbac9e0cdfb11c111.tar.bz2
samba-1d75e907e28fa0ee21c4693cbac9e0cdfb11c111.zip
r21694: Some more testing updates.
(This used to be commit 9247626b1c5f1eec0cedd6be221aafc41d9a26ab)
-rw-r--r--source4/lib/charset/testsuite.c39
-rw-r--r--source4/lib/compression/testsuite.c2
-rw-r--r--source4/torture/local/config.mk1
-rw-r--r--source4/torture/local/local.c1
-rw-r--r--source4/torture/rpc/winreg.c3
5 files changed, 41 insertions, 5 deletions
diff --git a/source4/lib/charset/testsuite.c b/source4/lib/charset/testsuite.c
index e00b0724e8..4d2acc30b5 100644
--- a/source4/lib/charset/testsuite.c
+++ b/source4/lib/charset/testsuite.c
@@ -113,7 +113,12 @@ static bool test_strncasecmp_m(struct torture_context *tctx)
return true;
}
-
+static bool test_next_token_null(struct torture_context *tctx)
+{
+ char buf[20];
+ torture_assert(tctx, !next_token(NULL, buf, " ", 20), "null ptr works");
+ return true;
+}
static bool test_next_token(struct torture_context *tctx)
{
@@ -135,6 +140,26 @@ static bool test_next_token(struct torture_context *tctx)
return true;
}
+static bool test_next_token_implicit_sep(struct torture_context *tctx)
+{
+ const char *teststr = "foo\tbar\n bla";
+ char buf[20];
+ torture_assert(tctx, next_token(&teststr, buf, NULL, 20), "finding token works");
+ torture_assert_str_equal(tctx, buf, "foo", "token matches");
+ torture_assert_str_equal(tctx, teststr, "bar\n bla", "ptr modified correctly");
+
+ torture_assert(tctx, next_token(&teststr, buf, NULL, 20), "finding token works");
+ torture_assert_str_equal(tctx, buf, "bar", "token matches");
+ torture_assert_str_equal(tctx, teststr, " bla", "ptr modified correctly");
+
+ torture_assert(tctx, next_token(&teststr, buf, NULL, 20), "finding token works");
+ torture_assert_str_equal(tctx, buf, "bla", "token matches");
+ torture_assert_str_equal(tctx, teststr, "", "ptr modified correctly");
+
+ torture_assert(tctx, !next_token(&teststr, buf, NULL, 20), "finding token doesn't work");
+ return true;
+}
+
static bool test_next_token_seps(struct torture_context *tctx)
{
const char *teststr = ",foo bla";
@@ -211,6 +236,15 @@ static bool test_strhasupper(struct torture_context *tctx)
return true;
}
+static bool test_count_chars_w(struct torture_context *tctx)
+{
+ torture_assert_int_equal(tctx, count_chars_w("foo", 'o'), 2, "simple");
+ torture_assert_int_equal(tctx, count_chars_w("", 'o'), 0, "empty");
+ torture_assert_int_equal(tctx, count_chars_w("bla", 'o'), 0, "none");
+ torture_assert_int_equal(tctx, count_chars_w("bla", '\0'), 0, "null");
+ return true;
+}
+
struct torture_suite *torture_local_charset(TALLOC_CTX *mem_ctx)
{
struct torture_suite *suite = torture_suite_create(mem_ctx, "CHARSET");
@@ -224,6 +258,8 @@ struct torture_suite *torture_local_charset(TALLOC_CTX *mem_ctx)
torture_suite_add_simple_test(suite, "string_replace_w", test_string_replace_w);
torture_suite_add_simple_test(suite, "strncasecmp_m", test_strncasecmp_m);
torture_suite_add_simple_test(suite, "next_token", test_next_token);
+ torture_suite_add_simple_test(suite, "next_token_null", test_next_token_null);
+ torture_suite_add_simple_test(suite, "next_token_implicit_sep", test_next_token_implicit_sep);
torture_suite_add_simple_test(suite, "next_token_quotes", test_next_token_quotes);
torture_suite_add_simple_test(suite, "next_token_seps", test_next_token_seps);
torture_suite_add_simple_test(suite, "next_token_quote_wrong", test_next_token_quote_wrong);
@@ -231,6 +267,7 @@ struct torture_suite *torture_local_charset(TALLOC_CTX *mem_ctx)
torture_suite_add_simple_test(suite, "strlen_m_term", test_strlen_m_term);
torture_suite_add_simple_test(suite, "strhaslower", test_strhaslower);
torture_suite_add_simple_test(suite, "strhasupper", test_strhasupper);
+ torture_suite_add_simple_test(suite, "count_chars_w", test_count_chars_w);
return suite;
}
diff --git a/source4/lib/compression/testsuite.c b/source4/lib/compression/testsuite.c
index eb00d096fd..e201e414a6 100644
--- a/source4/lib/compression/testsuite.c
+++ b/source4/lib/compression/testsuite.c
@@ -27,7 +27,5 @@ struct torture_suite *torture_local_compression(TALLOC_CTX *mem_ctx)
{
struct torture_suite *suite = torture_suite_create(mem_ctx, "COMPRESSION");
- torture_suite_add_simple_test(suite, "pull_charset", test_pull_charset);
-
return suite;
}
diff --git a/source4/torture/local/config.mk b/source4/torture/local/config.mk
index 56fd65bc9c..f9e3d58d03 100644
--- a/source4/torture/local/config.mk
+++ b/source4/torture/local/config.mk
@@ -26,6 +26,7 @@ OBJ_FILES = \
../../lib/util/tests/strlist.o \
../../lib/util/tests/file.o \
../../lib/util/tests/genrand.o \
+ ../../lib/compression/testsuite.o \
../../lib/charset/testsuite.o \
sddl.o \
../../lib/tdr/testsuite.o \
diff --git a/source4/torture/local/local.c b/source4/torture/local/local.c
index 174596152c..84dca5fcfa 100644
--- a/source4/torture/local/local.c
+++ b/source4/torture/local/local.c
@@ -46,6 +46,7 @@
torture_local_ndr,
torture_local_tdr,
torture_local_charset,
+ torture_local_compression,
torture_local_event,
torture_local_torture,
torture_local_dbspeed,
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 6c607c0806..d2c6ee493b 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -837,8 +837,7 @@ BOOL torture_rpc_winreg(struct torture_context *torture)
}
for (i = 0; i < ARRAY_SIZE(open_fns); i++) {
- if (!test_Open(p, mem_ctx, open_fns[i].name, open_fns[i].fn))
- ret = False;
+ ret &= test_Open(p, mem_ctx, open_fns[i].name, open_fns[i].fn);
}
talloc_free(mem_ctx);