From bce94d35f125eaeaa4db7866503418b8f281edf2 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 8 Apr 2003 08:05:01 +0000 Subject: Integrate abartlet's t_push_ucs2 test into test framework: - Build t_push_ucs2 as part of check-programs, the prerequisite for "make check". - t_push_ucs2.c: Load configuration from /dev/null so that we get a unix_charset of UTF-8 and can do meaningful UCS2 tests. Better comment. - Add a test to strings.py which tries conversion UTF8->UCS2->UTF8 and checks the results. Do this for English, Latin-1, and Katakana strings. - Add Python module with symbolic names for a handful of UNICODE characters. (This used to be commit 275e095c92ac74815ab9e388a0e83cdb7ddd85f3) --- source3/torture/t_push_ucs2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/torture/t_push_ucs2.c') diff --git a/source3/torture/t_push_ucs2.c b/source3/torture/t_push_ucs2.c index ca04394acc..86ae1b9b6c 100644 --- a/source3/torture/t_push_ucs2.c +++ b/source3/torture/t_push_ucs2.c @@ -30,10 +30,14 @@ static int check_push_ucs2(const char *orig) int main(int argc, char *argv[]) { int i, ret = 0; - + + /* Needed to initialize character set */ + lp_load("/dev/null", True, False, False); + if (argc != 2) { fprintf(stderr, "usage: %s STRING1\n" - "Converts a string, prints the results of strcmp\n", + "Checks that a string translated UNIX->UCS2->UNIX is unchanged\n" + "Should be always 0\n", argv[0]); return 2; } -- cgit From 80cd7c552ff95b3aa4caf79768af5b1e5c07c506 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Wed, 9 Apr 2003 05:22:17 +0000 Subject: t_push_ucs2, t_strcmp: Run tests only once by default, rather than 10000 times. (In theory they should be pure functions....) You can specify a parameter to repeat them if you want to e.g. measure performance. (This used to be commit 92acecd28c3374abcadbff0ab9cb765411f453f4) --- source3/torture/t_push_ucs2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source3/torture/t_push_ucs2.c') diff --git a/source3/torture/t_push_ucs2.c b/source3/torture/t_push_ucs2.c index 86ae1b9b6c..8bfc6f7ad9 100644 --- a/source3/torture/t_push_ucs2.c +++ b/source3/torture/t_push_ucs2.c @@ -30,19 +30,22 @@ static int check_push_ucs2(const char *orig) int main(int argc, char *argv[]) { int i, ret = 0; + int count = 1; /* Needed to initialize character set */ lp_load("/dev/null", True, False, False); - if (argc != 2) { - fprintf(stderr, "usage: %s STRING1\n" + if (argc < 2) { + fprintf(stderr, "usage: %s STRING1 [COUNT]\n" "Checks that a string translated UNIX->UCS2->UNIX is unchanged\n" "Should be always 0\n", argv[0]); return 2; } + if (argc >= 3) + count = atoi(argv[2]); - for (i = 0; ((i < 10000) && (!ret)); i++) + for (i = 0; ((i < count) && (!ret)); i++) ret = check_push_ucs2(argv[1]); printf("%d\n", ret); -- cgit