diff options
author | Martin Pool <mbp@samba.org> | 2003-04-09 05:22:17 +0000 |
---|---|---|
committer | Martin Pool <mbp@samba.org> | 2003-04-09 05:22:17 +0000 |
commit | 92acecd28c3374abcadbff0ab9cb765411f453f4 (patch) | |
tree | 7d9dcd7f1db98db54adfc82e43677592e3dcef3e /source/torture | |
parent | 4d42067cb89220a1b275bc8408c9c1ba2ef7766a (diff) | |
download | samba-92acecd28c3374abcadbff0ab9cb765411f453f4.tar.gz samba-92acecd28c3374abcadbff0ab9cb765411f453f4.tar.xz samba-92acecd28c3374abcadbff0ab9cb765411f453f4.zip |
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.
Diffstat (limited to 'source/torture')
-rw-r--r-- | source/torture/t_push_ucs2.c | 9 | ||||
-rw-r--r-- | source/torture/t_strcmp.c | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/source/torture/t_push_ucs2.c b/source/torture/t_push_ucs2.c index 86ae1b9b6ca..8bfc6f7ad9e 100644 --- a/source/torture/t_push_ucs2.c +++ b/source/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); diff --git a/source/torture/t_strcmp.c b/source/torture/t_strcmp.c index 1d26ad22dec..47327a0e065 100644 --- a/source/torture/t_strcmp.c +++ b/source/torture/t_strcmp.c @@ -9,15 +9,18 @@ int main(int argc, char *argv[]) { int i, ret; + int iters = 1; - if (argc != 3) { - fprintf(stderr, "usage: %s STRING1 STRING2\n" + if (argc < 3) { + fprintf(stderr, "usage: %s STRING1 STRING2 [ITERS]\n" "Compares two strings, prints the results of StrCaseCmp\n", argv[0]); return 2; } + if (argc >= 4) + iters = atoi(argv[3]); - for (i = 0; i < 10000; i++) + for (i = 0; i < iters; i++) ret = StrCaseCmp(argv[1], argv[2]); printf("%d\n", ret); |