diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-04-16 09:43:48 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:50:46 -0500 |
commit | 43b16443de76bb8bc11be811ac515374337970bd (patch) | |
tree | 48b39c7f412ec396a113c66769f74843f9753a4b /source4/lib/replace/test/testsuite.c | |
parent | f0c9bc037ed78f6bf0999ef669612b4003ec51ad (diff) | |
download | samba-43b16443de76bb8bc11be811ac515374337970bd.tar.gz samba-43b16443de76bb8bc11be811ac515374337970bd.tar.bz2 samba-43b16443de76bb8bc11be811ac515374337970bd.zip |
r22253: - make the strtoll tests more verbose
- add initial strtoull tests
metze
(This used to be commit 5d1e0f167add3c75955a27aa1ff3b16523ccf5c2)
Diffstat (limited to 'source4/lib/replace/test/testsuite.c')
-rw-r--r-- | source4/lib/replace/test/testsuite.c | 63 |
1 files changed, 56 insertions, 7 deletions
diff --git a/source4/lib/replace/test/testsuite.c b/source4/lib/replace/test/testsuite.c index a394810f61..025e5256f9 100644 --- a/source4/lib/replace/test/testsuite.c +++ b/source4/lib/replace/test/testsuite.c @@ -478,26 +478,75 @@ static int test_inet_ntoa(void) static int test_strtoll(void) { + int64_t v; + printf("test: strtoll\n"); - if (strtoll("15", NULL, 10) != 15) { - printf("failure: strtoll [\nstrtoll failed\n]\n"); + + v = strtoll("15", NULL, 10); + if (v != 15) { + printf("failure: strtoll [\n" + "strtoll failed: %lld != 15\n" + "]\n", + v); return false; } - if (strtoll("10", NULL, 16) != 16) { - printf("failure: strtoll [\nstrtoll hex failed\n]\n"); + + v = strtoll("10", NULL, 16); + if (v != 16) { + printf("failure: strtoll [\n" + "strtoll hex failed: %lld != 16\n" + "]\n", + v); return false; } - if (strtoll("11", NULL, 2) != 3) { - printf("failure: strtoll [\nstrtoll binary failed\n]\n"); + + v = strtoll("11", NULL, 2); + if (v != 3) { + printf("failure: strtoll [\n" + "strtoll binary failed: %lld != 3\n" + "]\n", + v); return false; } + printf("success: strtoll\n"); return true; } static int test_strtoull(void) { - /* FIXME */ + uint64_t v; + + printf("test: strtoull\n"); + + v = strtoull("15", NULL, 10); + if (v != 15) { + printf("failure: strtoull [\n" + "strtoull failed: %llu != 15\n" + "]\n", + v); + return false; + } + + v = strtoull("10", NULL, 16); + if (v != 16) { + printf("failure: strtoull [\n" + "strtoull hex failed: %llu != 16\n" + "]\n", + v); + return false; + } + + v = strtoull("11", NULL, 2); + if (v != 3) { + printf("failure: strtoull [\n" + "strtoull binary failed: %llu != 3\n" + "]\n", + v); + return false; + } + + printf("success: strtuoll\n"); return true; } |