X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-strtoumax.c;h=fbacb72808dc86bbef378e43a9051c617b57b20d;hb=906943bafa97f097349474b393980d7e84855036;hp=c6811d4a135f097e2f3c6c2907c497201e179002;hpb=1602f0afed21be664fcf5c42d59db07cc22c56d6;p=gnulib.git diff --git a/tests/test-strtoumax.c b/tests/test-strtoumax.c index c6811d4a1..fbacb7280 100644 --- a/tests/test-strtoumax.c +++ b/tests/test-strtoumax.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2012 Free Software Foundation, Inc. + * Copyright (C) 2011-2013 Free Software Foundation, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -144,5 +144,37 @@ main (void) ASSERT (errno == 0); } + /* Large integer values. */ + { + const char input[] = "2147483647"; + char *ptr; + uintmax_t result; + errno = 0; + result = strtoumax (input, &ptr, 10); + ASSERT (result == 2147483647); + ASSERT (ptr == input + 10); + ASSERT (errno == 0); + } + { + const char input[] = "-2147483648"; + char *ptr; + uintmax_t result; + errno = 0; + result = strtoumax (input, &ptr, 10); + ASSERT (result == - (uintmax_t) 2147483648U); + ASSERT (ptr == input + 11); + ASSERT (errno == 0); + } + { + const char input[] = "4294967295"; + char *ptr; + uintmax_t result; + errno = 0; + result = strtoumax (input, &ptr, 10); + ASSERT (result == 4294967295U); + ASSERT (ptr == input + 10); + ASSERT (errno == 0); + } + return 0; }