mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -04:00
Convert test_evutil_strtoll to new framework.
svn:r1074
This commit is contained in:
parent
a8203b3490
commit
4e9470b481
@ -2275,28 +2275,20 @@ rpc_test(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_evutil_strtoll(void)
|
test_evutil_strtoll(void *ptr)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
test_ok = 0;
|
|
||||||
|
|
||||||
if (evutil_strtoll("5000000000", NULL, 10) != ((ev_int64_t)5000000)*1000)
|
tt_want(evutil_strtoll("5000000000", NULL, 10) ==
|
||||||
goto err;
|
((ev_int64_t)5000000)*1000);
|
||||||
if (evutil_strtoll("-5000000000", NULL, 10) != ((ev_int64_t)5000000)*-1000)
|
tt_want(evutil_strtoll("-5000000000", NULL, 10) ==
|
||||||
goto err;
|
((ev_int64_t)5000000)*-1000);
|
||||||
s = " 99999stuff";
|
s = " 99999stuff";
|
||||||
if (evutil_strtoll(s, &endptr, 10) != (ev_int64_t)99999)
|
tt_want(evutil_strtoll(s, &endptr, 10) == (ev_int64_t)99999);
|
||||||
goto err;
|
tt_want(endptr == s+6);
|
||||||
if (endptr != s+6)
|
tt_want(evutil_strtoll("foo", NULL, 10) == 0);
|
||||||
goto err;
|
}
|
||||||
if (evutil_strtoll("foo", NULL, 10) != 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
test_ok = 1;
|
|
||||||
err:
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_evutil_snprintf(void *ptr)
|
test_evutil_snprintf(void *ptr)
|
||||||
@ -2364,7 +2356,7 @@ struct testcase_t legacy_testcases[] = {
|
|||||||
{ "evutil_snprintf", test_evutil_snprintf, 0, NULL, NULL },
|
{ "evutil_snprintf", test_evutil_snprintf, 0, NULL, NULL },
|
||||||
|
|
||||||
/* These are still using the old API */
|
/* These are still using the old API */
|
||||||
LEGACY(evutil_strtoll, 0),
|
{ "evutil_strtoll", test_evutil_strtoll, 0, NULL, NULL },
|
||||||
LEGACY(persistent_timeout, TT_FORK|TT_NEED_BASE),
|
LEGACY(persistent_timeout, TT_FORK|TT_NEED_BASE),
|
||||||
LEGACY(priorities, TT_FORK|TT_NEED_BASE),
|
LEGACY(priorities, TT_FORK|TT_NEED_BASE),
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user