X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-vasnprintf-posix.c;h=dea0d3c1b29b8cd142155c680104bc68cee3f9ce;hb=977389d936eb39475d8540651074ab48fcfd85a1;hp=dd98691ad0da9f32f15e8f01056c7dcde7ef7c4e;hpb=fb95d2ffdee15f80ca9613cf0f30828a1800a2ce;p=gnulib.git diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c index dd98691ad..dea0d3c1b 100644 --- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible vasnprintf() and asnprintf() functions. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 @@ -3568,6 +3568,21 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) } { + size_t length; + char *result = + my_asnprintf (NULL, &length, "%.511f %d", 1.0, 99); + size_t i; + ASSERT (result != NULL); + ASSERT (result[0] == '1'); + ASSERT (result[1] == '.'); + for (i = 0; i < 511; i++) + ASSERT (result[2 + i] == '0'); + ASSERT (strcmp (result + 2 + 511, " 99") == 0); + ASSERT (length == strlen (result)); + free (result); + } + + { char input[5000]; size_t length; char *result;