From: Nick Mathewson Date: Fri, 30 Jan 2009 17:43:48 +0000 (+0000) Subject: Convert test_evutil_strtoll to new framework. X-Git-Tag: release-2.0.1-alpha~111 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e9470b481f2ad2e1ddb9967de8e5599d9b5fe6d;p=libevent Convert test_evutil_strtoll to new framework. svn:r1074 --- diff --git a/test/regress.c b/test/regress.c index 40a9b2cc..ee348aba 100644 --- a/test/regress.c +++ b/test/regress.c @@ -2275,28 +2275,20 @@ rpc_test(void) } static void -test_evutil_strtoll(void) +test_evutil_strtoll(void *ptr) { const char *s; char *endptr; - test_ok = 0; - - if (evutil_strtoll("5000000000", NULL, 10) != ((ev_int64_t)5000000)*1000) - goto err; - if (evutil_strtoll("-5000000000", NULL, 10) != ((ev_int64_t)5000000)*-1000) - goto err; - s = " 99999stuff"; - if (evutil_strtoll(s, &endptr, 10) != (ev_int64_t)99999) - goto err; - if (endptr != s+6) - goto err; - if (evutil_strtoll("foo", NULL, 10) != 0) - goto err; - test_ok = 1; -err: - ; -} + tt_want(evutil_strtoll("5000000000", NULL, 10) == + ((ev_int64_t)5000000)*1000); + tt_want(evutil_strtoll("-5000000000", NULL, 10) == + ((ev_int64_t)5000000)*-1000); + s = " 99999stuff"; + tt_want(evutil_strtoll(s, &endptr, 10) == (ev_int64_t)99999); + tt_want(endptr == s+6); + tt_want(evutil_strtoll("foo", NULL, 10) == 0); + } static void test_evutil_snprintf(void *ptr) @@ -2364,7 +2356,7 @@ struct testcase_t legacy_testcases[] = { { "evutil_snprintf", test_evutil_snprintf, 0, NULL, NULL }, /* 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(priorities, TT_FORK|TT_NEED_BASE),