summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-05-24 07:46:26 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-05-24 07:46:26 +0000
commitba423bb9e48fda4cab53d453d54ba3817dd937ae (patch)
treef9bb18d71961ea18d536ad59919aae532690385c
parent49aeedbc4cd1c5fad4548acc5cb08ac854af3200 (diff)
downloadmpfr-ba423bb9e48fda4cab53d453d54ba3817dd937ae.tar.gz
[tests/tprintf.c] Added tests with %ln.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11525 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tprintf.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/tests/tprintf.c b/tests/tprintf.c
index 3c23adf75..deddc84d9 100644
--- a/tests/tprintf.c
+++ b/tests/tprintf.c
@@ -163,8 +163,35 @@ check_long_string (void)
if (large_prec >= INT_MAX - 512)
{
- check_vprintf_failure ("%Rb %512d", x, 1);
- check_vprintf_failure ("%RA %RA %Ra %Ra %512d", x, x, x, x, 1);
+#define LS1 "%Rb %512d"
+#define LS2 "%RA %RA %Ra %Ra %512d"
+ check_vprintf_failure (LS1, x, 1);
+ check_vprintf_failure (LS2, x, x, x, x, 1);
+ if (sizeof (long) * CHAR_BIT > 40)
+ {
+ long n1, n2;
+
+ n1 = large_prec + 517;
+ check_vprintf_failure (LS1 "%ln", x, 1, &n2);
+ if (n1 != n2)
+ {
+ fprintf (stderr, "Error in check_long_string(\"%s\", ...)\n"
+ "Expected n = %ld\n"
+ "Got n = %ld\n",
+ LS1 "%ln", n1, n2);
+ exit (1);
+ }
+ n1 = ((large_prec - 2) / 4) * 4 + 548;
+ check_vprintf_failure (LS2 "%ln", x, x, x, x, 1, &n2);
+ if (n1 != n2)
+ {
+ fprintf (stderr, "Error in check_long_string(\"%s\", ...)\n"
+ "Expected n = %ld\n"
+ "Got n = %ld\n",
+ LS2 "%ln", n1, n2);
+ exit (1);
+ }
+ }
}
mpfr_clear (x);