summaryrefslogtreecommitdiff
path: root/tests/unistdio
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-03 19:11:32 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-03 19:11:32 +0100
commit00893e79fc62966067af1a106567db96bd170338 (patch)
tree52b35cd0b42ca28e62a2ffbecade2e13dd8332cf /tests/unistdio
parent26112352a774737e1ce5580c93654a26c1e82b39 (diff)
New upstream version 1.2upstream/1.2
Diffstat (limited to 'tests/unistdio')
-rw-r--r--tests/unistdio/test-u16-asnprintf1.c2
-rw-r--r--tests/unistdio/test-u16-asnprintf1.h2
-rw-r--r--tests/unistdio/test-u16-printf1.h372
-rw-r--r--tests/unistdio/test-u16-vasnprintf1.c2
-rw-r--r--tests/unistdio/test-u16-vasnprintf2.c2
-rw-r--r--tests/unistdio/test-u16-vasnprintf3.c2
-rw-r--r--tests/unistdio/test-u16-vasprintf1.c2
-rw-r--r--tests/unistdio/test-u16-vsnprintf1.c2
-rw-r--r--tests/unistdio/test-u16-vsprintf1.c2
-rw-r--r--tests/unistdio/test-u32-asnprintf1.c2
-rw-r--r--tests/unistdio/test-u32-asnprintf1.h2
-rw-r--r--tests/unistdio/test-u32-printf1.h372
-rw-r--r--tests/unistdio/test-u32-vasnprintf1.c2
-rw-r--r--tests/unistdio/test-u32-vasnprintf2.c2
-rw-r--r--tests/unistdio/test-u32-vasnprintf3.c2
-rw-r--r--tests/unistdio/test-u32-vasprintf1.c2
-rw-r--r--tests/unistdio/test-u32-vsnprintf1.c2
-rw-r--r--tests/unistdio/test-u32-vsprintf1.c2
-rw-r--r--tests/unistdio/test-u8-asnprintf1.c2
-rw-r--r--tests/unistdio/test-u8-asnprintf1.h2
-rw-r--r--tests/unistdio/test-u8-printf1.h292
-rw-r--r--tests/unistdio/test-u8-vasnprintf1.c2
-rw-r--r--tests/unistdio/test-u8-vasnprintf2.c2
-rw-r--r--tests/unistdio/test-u8-vasnprintf3.c2
-rw-r--r--tests/unistdio/test-u8-vasprintf1.c2
-rw-r--r--tests/unistdio/test-u8-vsnprintf1.c2
-rw-r--r--tests/unistdio/test-u8-vsprintf1.c2
-rw-r--r--tests/unistdio/test-ulc-asnprintf1.c2
-rw-r--r--tests/unistdio/test-ulc-asnprintf1.h2
-rw-r--r--tests/unistdio/test-ulc-printf1.h206
-rw-r--r--tests/unistdio/test-ulc-vasnprintf1.c2
-rw-r--r--tests/unistdio/test-ulc-vasnprintf2.c2
-rw-r--r--tests/unistdio/test-ulc-vasnprintf3.c2
-rw-r--r--tests/unistdio/test-ulc-vasprintf1.c2
-rw-r--r--tests/unistdio/test-ulc-vsnprintf1.c2
-rw-r--r--tests/unistdio/test-ulc-vsprintf1.c2
36 files changed, 1270 insertions, 36 deletions
diff --git a/tests/unistdio/test-u16-asnprintf1.c b/tests/unistdio/test-u16-asnprintf1.c
index a95e6bfc..67ce490a 100644
--- a/tests/unistdio/test-u16-asnprintf1.c
+++ b/tests/unistdio/test-u16-asnprintf1.c
@@ -1,5 +1,5 @@
/* Test of u16_asnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u16-asnprintf1.h b/tests/unistdio/test-u16-asnprintf1.h
index 4145ae87..4ec31a43 100644
--- a/tests/unistdio/test-u16-asnprintf1.h
+++ b/tests/unistdio/test-u16-asnprintf1.h
@@ -1,5 +1,5 @@
/* Test of u16_[v]asnprintf() function.
- Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2024 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
diff --git a/tests/unistdio/test-u16-printf1.h b/tests/unistdio/test-u16-printf1.h
index 7690978d..e501c9e4 100644
--- a/tests/unistdio/test-u16-printf1.h
+++ b/tests/unistdio/test-u16-printf1.h
@@ -1,5 +1,5 @@
/* Test of u16_v[a]s[n]printf() function.
- Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2024 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
@@ -83,6 +83,24 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
ASSERT (u16_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*U %d", 10, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*U %d", -10, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint16_t *result =
my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55);
@@ -123,6 +141,24 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
ASSERT (u16_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*lU %d", 10, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*lU %d", -10, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint16_t *result =
my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55);
@@ -163,6 +199,24 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
ASSERT (u16_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*llU %d", 10, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*llU %d", -10, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint16_t *result =
my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55);
@@ -211,6 +265,32 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("Mr. %*s %d", 20, "Ronald Reagan", 33, 44, 55);
+ static const uint16_t expected[] =
+ { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
+ ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e',
+ 'a', 'g', 'a', 'n', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("Mr. %*s %d", -20, "Ronald Reagan", 33, 44, 55);
+ static const uint16_t expected[] =
+ { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd',
+ ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ',
+ ' ', ' ', ' ', ' ', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* FLAG_LEFT. */
uint16_t *result =
my_xasprintf ("Mr. %-20s %d", "Ronald Reagan", 33, 44, 55);
@@ -278,6 +358,44 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*a %d", 10, 1.75, 33, 44, 55);
+ static const uint16_t expected1[] =
+ { ' ', ' ', '0', 'x', '1', '.', 'c', 'p', '+', '0', ' ', '3', '3', 0 };
+ static const uint16_t expected2[] =
+ { ' ', ' ', '0', 'x', '3', '.', '8', 'p', '-', '1', ' ', '3', '3', 0 };
+ static const uint16_t expected3[] =
+ { ' ', ' ', ' ', ' ', '0', 'x', '7', 'p', '-', '2', ' ', '3', '3', 0 };
+ static const uint16_t expected4[] =
+ { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected1) == 0
+ || u16_strcmp (result, expected2) == 0
+ || u16_strcmp (result, expected3) == 0
+ || u16_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*a %d", -10, 1.75, 33, 44, 55);
+ static const uint16_t expected1[] =
+ { '0', 'x', '1', '.', 'c', 'p', '+', '0', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint16_t expected2[] =
+ { '0', 'x', '3', '.', '8', 'p', '-', '1', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint16_t expected3[] =
+ { '0', 'x', '7', 'p', '-', '2', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint16_t expected4[] =
+ { '0', 'x', 'e', 'p', '-', '3', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected1) == 0
+ || u16_strcmp (result, expected2) == 0
+ || u16_strcmp (result, expected3) == 0
+ || u16_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
{ /* Small precision. */
uint16_t *result =
my_xasprintf ("%.10a %d", 1.75, 33, 44, 55);
@@ -402,6 +520,44 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*La %d", 10, 1.75L, 33, 44, 55);
+ static const uint16_t expected1[] =
+ { ' ', ' ', '0', 'x', '1', '.', 'c', 'p', '+', '0', ' ', '3', '3', 0 };
+ static const uint16_t expected2[] =
+ { ' ', ' ', '0', 'x', '3', '.', '8', 'p', '-', '1', ' ', '3', '3', 0 };
+ static const uint16_t expected3[] =
+ { ' ', ' ', ' ', ' ', '0', 'x', '7', 'p', '-', '2', ' ', '3', '3', 0 };
+ static const uint16_t expected4[] =
+ { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected1) == 0
+ || u16_strcmp (result, expected2) == 0
+ || u16_strcmp (result, expected3) == 0
+ || u16_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*La %d", -10, 1.75L, 33, 44, 55);
+ static const uint16_t expected1[] =
+ { '0', 'x', '1', '.', 'c', 'p', '+', '0', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint16_t expected2[] =
+ { '0', 'x', '3', '.', '8', 'p', '-', '1', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint16_t expected3[] =
+ { '0', 'x', '7', 'p', '-', '2', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint16_t expected4[] =
+ { '0', 'x', 'e', 'p', '-', '3', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected1) == 0
+ || u16_strcmp (result, expected2) == 0
+ || u16_strcmp (result, expected3) == 0
+ || u16_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
{ /* Small precision. */
uint16_t *result =
my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55);
@@ -502,6 +658,26 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*f %d", 10, 1.75, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*f %d", -10, 1.75, 33, 44, 55);
+ static const uint16_t expected[] =
+ { '1', '.', '7', '5', '0', '0', '0', '0', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint16_t *result =
my_xasprintf ("%.f %d", 1234.0, 33, 44, 55);
@@ -532,6 +708,26 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*Lf %d", 10, 1.75L, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*Lf %d", -10, 1.75L, 33, 44, 55);
+ static const uint16_t expected[] =
+ { '1', '.', '7', '5', '0', '0', '0', '0', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint16_t *result =
my_xasprintf ("%.Lf %d", 1234.0L, 33, 44, 55);
@@ -620,6 +816,40 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*e %d", 15, 1.75, 33, 44, 55);
+ static const uint16_t expected1[] =
+ { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0',
+ '0', 'e', '+', '0', '0', ' ', '3', '3', 0
+ };
+ static const uint16_t expected2[] =
+ { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0',
+ 'e', '+', '0', '0', '0', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected1) == 0
+ || u16_strcmp (result, expected2) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*e %d", -15, 1.75, 33, 44, 55);
+ static const uint16_t expected1[] =
+ { '1', '.', '7', '5', '0', '0', '0', '0', 'e', '+',
+ '0', '0', ' ', ' ', ' ', ' ', '3', '3', 0
+ };
+ static const uint16_t expected2[] =
+ { '1', '.', '7', '5', '0', '0', '0', '0', 'e', '+',
+ '0', '0', '0', ' ', ' ', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected1) == 0
+ || u16_strcmp (result, expected2) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint16_t *result =
my_xasprintf ("%.e %d", 1234.0, 33, 44, 55);
@@ -657,6 +887,30 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*Le %d", 15, 1.75L, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0',
+ '0', 'e', '+', '0', '0', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*Le %d", -15, 1.75L, 33, 44, 55);
+ static const uint16_t expected[] =
+ { '1', '.', '7', '5', '0', '0', '0', '0', 'e', '+',
+ '0', '0', ' ', ' ', ' ', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint16_t *result =
my_xasprintf ("%.Le %d", 1234.0L, 33, 44, 55);
@@ -689,6 +943,26 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*g %d", 10, 1.75, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', ' ', ' ', ' ', ' ', '1', '.', '7', '5', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*g %d", -10, 1.75, 33, 44, 55);
+ static const uint16_t expected[] =
+ { '1', '.', '7', '5', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint16_t *result =
my_xasprintf ("%.g %d", 1234.0, 33, 44, 55);
@@ -722,6 +996,26 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*Lg %d", 10, 1.75L, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', ' ', ' ', ' ', ' ', '1', '.', '7', '5', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*Lg %d", -10, 1.75L, 33, 44, 55);
+ static const uint16_t expected[] =
+ { '1', '.', '7', '5', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint16_t *result =
my_xasprintf ("%.Lg %d", 1234.0L, 33, 44, 55);
@@ -738,12 +1032,16 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
int count = -1;
uint16_t *result =
my_xasprintf ("%d %n", 123, &count, 33, 44, 55);
+#if NEED_PRINTF_WITH_N_DIRECTIVE
static const uint16_t expected[] =
{ '1', '2', '3', ' ', 0 };
ASSERT (result != NULL);
ASSERT (u16_strcmp (result, expected) == 0);
ASSERT (count == 4);
free (result);
+#else
+ ASSERT (result == NULL);
+#endif
}
/* Test the support of the POSIX/XSI format strings with positions. */
@@ -795,6 +1093,30 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
ASSERT (u16_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*U %d", 20, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ',
+ 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*U %d", -20, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z',
+ 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint16_t *result =
my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55);
@@ -850,6 +1172,30 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
ASSERT (u16_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*lU %d", 20, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ',
+ 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*lU %d", -20, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z',
+ 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint16_t *result =
my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55);
@@ -905,6 +1251,30 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...))
ASSERT (u16_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint16_t *result =
+ my_xasprintf ("%*llU %d", 20, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ',
+ 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint16_t *result =
+ my_xasprintf ("%*llU %d", -20, unicode_string, 33, 44, 55);
+ static const uint16_t expected[] =
+ { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z',
+ 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u16_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint16_t *result =
my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55);
diff --git a/tests/unistdio/test-u16-vasnprintf1.c b/tests/unistdio/test-u16-vasnprintf1.c
index de705ae6..e39495c9 100644
--- a/tests/unistdio/test-u16-vasnprintf1.c
+++ b/tests/unistdio/test-u16-vasnprintf1.c
@@ -1,5 +1,5 @@
/* Test of u16_vasnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u16-vasnprintf2.c b/tests/unistdio/test-u16-vasnprintf2.c
index ec5d790e..aee67584 100644
--- a/tests/unistdio/test-u16-vasnprintf2.c
+++ b/tests/unistdio/test-u16-vasnprintf2.c
@@ -1,5 +1,5 @@
/* Test of u16_vasnprintf() function in an ISO-8859-1 locale.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u16-vasnprintf3.c b/tests/unistdio/test-u16-vasnprintf3.c
index 97f3c69d..0efe1984 100644
--- a/tests/unistdio/test-u16-vasnprintf3.c
+++ b/tests/unistdio/test-u16-vasnprintf3.c
@@ -1,5 +1,5 @@
/* Test of u16_vasnprintf() function in an UTF-8 locale.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u16-vasprintf1.c b/tests/unistdio/test-u16-vasprintf1.c
index 1d00ec93..203d2edf 100644
--- a/tests/unistdio/test-u16-vasprintf1.c
+++ b/tests/unistdio/test-u16-vasprintf1.c
@@ -1,5 +1,5 @@
/* Test of u16_vasprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u16-vsnprintf1.c b/tests/unistdio/test-u16-vsnprintf1.c
index 27f3871a..6859468a 100644
--- a/tests/unistdio/test-u16-vsnprintf1.c
+++ b/tests/unistdio/test-u16-vsnprintf1.c
@@ -1,5 +1,5 @@
/* Test of u16_vsnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u16-vsprintf1.c b/tests/unistdio/test-u16-vsprintf1.c
index ab4d9d57..b39a3056 100644
--- a/tests/unistdio/test-u16-vsprintf1.c
+++ b/tests/unistdio/test-u16-vsprintf1.c
@@ -1,5 +1,5 @@
/* Test of u16_vsprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u32-asnprintf1.c b/tests/unistdio/test-u32-asnprintf1.c
index aebc798e..5a16094b 100644
--- a/tests/unistdio/test-u32-asnprintf1.c
+++ b/tests/unistdio/test-u32-asnprintf1.c
@@ -1,5 +1,5 @@
/* Test of u32_asnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u32-asnprintf1.h b/tests/unistdio/test-u32-asnprintf1.h
index b654c59a..85fa2cf0 100644
--- a/tests/unistdio/test-u32-asnprintf1.h
+++ b/tests/unistdio/test-u32-asnprintf1.h
@@ -1,5 +1,5 @@
/* Test of u32_[v]asnprintf() function.
- Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2024 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
diff --git a/tests/unistdio/test-u32-printf1.h b/tests/unistdio/test-u32-printf1.h
index d3e10e92..ae0edc6a 100644
--- a/tests/unistdio/test-u32-printf1.h
+++ b/tests/unistdio/test-u32-printf1.h
@@ -1,5 +1,5 @@
/* Test of u32_v[a]s[n]printf() function.
- Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2024 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
@@ -83,6 +83,24 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
ASSERT (u32_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*U %d", 10, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*U %d", -10, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint32_t *result =
my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55);
@@ -123,6 +141,24 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
ASSERT (u32_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*lU %d", 10, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*lU %d", -10, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint32_t *result =
my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55);
@@ -163,6 +199,24 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
ASSERT (u32_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*llU %d", 10, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*llU %d", -10, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint32_t *result =
my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55);
@@ -211,6 +265,32 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("Mr. %*s %d", 20, "Ronald Reagan", 33, 44, 55);
+ static const uint32_t expected[] =
+ { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
+ ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e',
+ 'a', 'g', 'a', 'n', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("Mr. %*s %d", -20, "Ronald Reagan", 33, 44, 55);
+ static const uint32_t expected[] =
+ { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd',
+ ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ',
+ ' ', ' ', ' ', ' ', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* FLAG_LEFT. */
uint32_t *result =
my_xasprintf ("Mr. %-20s %d", "Ronald Reagan", 33, 44, 55);
@@ -278,6 +358,44 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*a %d", 10, 1.75, 33, 44, 55);
+ static const uint32_t expected1[] =
+ { ' ', ' ', '0', 'x', '1', '.', 'c', 'p', '+', '0', ' ', '3', '3', 0 };
+ static const uint32_t expected2[] =
+ { ' ', ' ', '0', 'x', '3', '.', '8', 'p', '-', '1', ' ', '3', '3', 0 };
+ static const uint32_t expected3[] =
+ { ' ', ' ', ' ', ' ', '0', 'x', '7', 'p', '-', '2', ' ', '3', '3', 0 };
+ static const uint32_t expected4[] =
+ { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected1) == 0
+ || u32_strcmp (result, expected2) == 0
+ || u32_strcmp (result, expected3) == 0
+ || u32_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*a %d", -10, 1.75, 33, 44, 55);
+ static const uint32_t expected1[] =
+ { '0', 'x', '1', '.', 'c', 'p', '+', '0', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint32_t expected2[] =
+ { '0', 'x', '3', '.', '8', 'p', '-', '1', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint32_t expected3[] =
+ { '0', 'x', '7', 'p', '-', '2', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint32_t expected4[] =
+ { '0', 'x', 'e', 'p', '-', '3', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected1) == 0
+ || u32_strcmp (result, expected2) == 0
+ || u32_strcmp (result, expected3) == 0
+ || u32_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
{ /* Small precision. */
uint32_t *result =
my_xasprintf ("%.10a %d", 1.75, 33, 44, 55);
@@ -402,6 +520,44 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*La %d", 10, 1.75L, 33, 44, 55);
+ static const uint32_t expected1[] =
+ { ' ', ' ', '0', 'x', '1', '.', 'c', 'p', '+', '0', ' ', '3', '3', 0 };
+ static const uint32_t expected2[] =
+ { ' ', ' ', '0', 'x', '3', '.', '8', 'p', '-', '1', ' ', '3', '3', 0 };
+ static const uint32_t expected3[] =
+ { ' ', ' ', ' ', ' ', '0', 'x', '7', 'p', '-', '2', ' ', '3', '3', 0 };
+ static const uint32_t expected4[] =
+ { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected1) == 0
+ || u32_strcmp (result, expected2) == 0
+ || u32_strcmp (result, expected3) == 0
+ || u32_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*La %d", -10, 1.75L, 33, 44, 55);
+ static const uint32_t expected1[] =
+ { '0', 'x', '1', '.', 'c', 'p', '+', '0', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint32_t expected2[] =
+ { '0', 'x', '3', '.', '8', 'p', '-', '1', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint32_t expected3[] =
+ { '0', 'x', '7', 'p', '-', '2', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ static const uint32_t expected4[] =
+ { '0', 'x', 'e', 'p', '-', '3', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected1) == 0
+ || u32_strcmp (result, expected2) == 0
+ || u32_strcmp (result, expected3) == 0
+ || u32_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
{ /* Small precision. */
uint32_t *result =
my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55);
@@ -502,6 +658,26 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*f %d", 10, 1.75, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*f %d", -10, 1.75, 33, 44, 55);
+ static const uint32_t expected[] =
+ { '1', '.', '7', '5', '0', '0', '0', '0', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint32_t *result =
my_xasprintf ("%.f %d", 1234.0, 33, 44, 55);
@@ -532,6 +708,26 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*Lf %d", 10, 1.75L, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*Lf %d", -10, 1.75L, 33, 44, 55);
+ static const uint32_t expected[] =
+ { '1', '.', '7', '5', '0', '0', '0', '0', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint32_t *result =
my_xasprintf ("%.Lf %d", 1234.0L, 33, 44, 55);
@@ -620,6 +816,40 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*e %d", 15, 1.75, 33, 44, 55);
+ static const uint32_t expected1[] =
+ { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0',
+ '0', 'e', '+', '0', '0', ' ', '3', '3', 0
+ };
+ static const uint32_t expected2[] =
+ { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0',
+ 'e', '+', '0', '0', '0', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected1) == 0
+ || u32_strcmp (result, expected2) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*e %d", -15, 1.75, 33, 44, 55);
+ static const uint32_t expected1[] =
+ { '1', '.', '7', '5', '0', '0', '0', '0', 'e', '+',
+ '0', '0', ' ', ' ', ' ', ' ', '3', '3', 0
+ };
+ static const uint32_t expected2[] =
+ { '1', '.', '7', '5', '0', '0', '0', '0', 'e', '+',
+ '0', '0', '0', ' ', ' ', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected1) == 0
+ || u32_strcmp (result, expected2) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint32_t *result =
my_xasprintf ("%.e %d", 1234.0, 33, 44, 55);
@@ -657,6 +887,30 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*Le %d", 15, 1.75L, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0',
+ '0', 'e', '+', '0', '0', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*Le %d", -15, 1.75L, 33, 44, 55);
+ static const uint32_t expected[] =
+ { '1', '.', '7', '5', '0', '0', '0', '0', 'e', '+',
+ '0', '0', ' ', ' ', ' ', ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint32_t *result =
my_xasprintf ("%.Le %d", 1234.0L, 33, 44, 55);
@@ -689,6 +943,26 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*g %d", 10, 1.75, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', ' ', ' ', ' ', ' ', '1', '.', '7', '5', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*g %d", -10, 1.75, 33, 44, 55);
+ static const uint32_t expected[] =
+ { '1', '.', '7', '5', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint32_t *result =
my_xasprintf ("%.g %d", 1234.0, 33, 44, 55);
@@ -722,6 +996,26 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*Lg %d", 10, 1.75L, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', ' ', ' ', ' ', ' ', '1', '.', '7', '5', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*Lg %d", -10, 1.75L, 33, 44, 55);
+ static const uint32_t expected[] =
+ { '1', '.', '7', '5', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint32_t *result =
my_xasprintf ("%.Lg %d", 1234.0L, 33, 44, 55);
@@ -738,12 +1032,16 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
int count = -1;
uint32_t *result =
my_xasprintf ("%d %n", 123, &count, 33, 44, 55);
+#if NEED_PRINTF_WITH_N_DIRECTIVE
static const uint32_t expected[] =
{ '1', '2', '3', ' ', 0 };
ASSERT (result != NULL);
ASSERT (u32_strcmp (result, expected) == 0);
ASSERT (count == 4);
free (result);
+#else
+ ASSERT (result == NULL);
+#endif
}
/* Test the support of the POSIX/XSI format strings with positions. */
@@ -795,6 +1093,30 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
ASSERT (u32_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*U %d", 20, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ',
+ 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*U %d", -20, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z',
+ 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint32_t *result =
my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55);
@@ -850,6 +1172,30 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
ASSERT (u32_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*lU %d", 20, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ',
+ 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*lU %d", -20, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z',
+ 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint32_t *result =
my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55);
@@ -905,6 +1251,30 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...))
ASSERT (u32_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint32_t *result =
+ my_xasprintf ("%*llU %d", 20, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ',
+ 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint32_t *result =
+ my_xasprintf ("%*llU %d", -20, unicode_string, 33, 44, 55);
+ static const uint32_t expected[] =
+ { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z',
+ 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ',
+ ' ', '3', '3', 0
+ };
+ ASSERT (result != NULL);
+ ASSERT (u32_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint32_t *result =
my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55);
diff --git a/tests/unistdio/test-u32-vasnprintf1.c b/tests/unistdio/test-u32-vasnprintf1.c
index 553ee2d5..43c115cf 100644
--- a/tests/unistdio/test-u32-vasnprintf1.c
+++ b/tests/unistdio/test-u32-vasnprintf1.c
@@ -1,5 +1,5 @@
/* Test of u32_vasnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u32-vasnprintf2.c b/tests/unistdio/test-u32-vasnprintf2.c
index 7d82cfc6..1ddab53f 100644
--- a/tests/unistdio/test-u32-vasnprintf2.c
+++ b/tests/unistdio/test-u32-vasnprintf2.c
@@ -1,5 +1,5 @@
/* Test of u32_vasnprintf() function in an ISO-8859-1 locale.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u32-vasnprintf3.c b/tests/unistdio/test-u32-vasnprintf3.c
index 3509f6ff..cfc4674c 100644
--- a/tests/unistdio/test-u32-vasnprintf3.c
+++ b/tests/unistdio/test-u32-vasnprintf3.c
@@ -1,5 +1,5 @@
/* Test of u32_vasnprintf() function in an UTF-8 locale.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u32-vasprintf1.c b/tests/unistdio/test-u32-vasprintf1.c
index 41084b6d..3ab5e89c 100644
--- a/tests/unistdio/test-u32-vasprintf1.c
+++ b/tests/unistdio/test-u32-vasprintf1.c
@@ -1,5 +1,5 @@
/* Test of u32_vasprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u32-vsnprintf1.c b/tests/unistdio/test-u32-vsnprintf1.c
index bae3adca..fa38f8db 100644
--- a/tests/unistdio/test-u32-vsnprintf1.c
+++ b/tests/unistdio/test-u32-vsnprintf1.c
@@ -1,5 +1,5 @@
/* Test of u32_vsnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u32-vsprintf1.c b/tests/unistdio/test-u32-vsprintf1.c
index 27b0065c..c857ca71 100644
--- a/tests/unistdio/test-u32-vsprintf1.c
+++ b/tests/unistdio/test-u32-vsprintf1.c
@@ -1,5 +1,5 @@
/* Test of u32_vsprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u8-asnprintf1.c b/tests/unistdio/test-u8-asnprintf1.c
index 058b7714..d5d256aa 100644
--- a/tests/unistdio/test-u8-asnprintf1.c
+++ b/tests/unistdio/test-u8-asnprintf1.c
@@ -1,5 +1,5 @@
/* Test of u8_asnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u8-asnprintf1.h b/tests/unistdio/test-u8-asnprintf1.h
index 6aeeae31..f48e2365 100644
--- a/tests/unistdio/test-u8-asnprintf1.h
+++ b/tests/unistdio/test-u8-asnprintf1.h
@@ -1,5 +1,5 @@
/* Test of u8_[v]asnprintf() function.
- Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2024 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
diff --git a/tests/unistdio/test-u8-printf1.h b/tests/unistdio/test-u8-printf1.h
index 5a820148..3e8999b6 100644
--- a/tests/unistdio/test-u8-printf1.h
+++ b/tests/unistdio/test-u8-printf1.h
@@ -1,5 +1,5 @@
/* Test of u8_v[a]s[n]printf() function.
- Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2024 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
@@ -77,6 +77,22 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
ASSERT (u8_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*U %d", 10, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = " Hello 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*U %d", -10, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = "Hello 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint8_t *result =
my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55);
@@ -113,6 +129,22 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
ASSERT (u8_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*lU %d", 10, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = " Hello 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*lU %d", -10, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = "Hello 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint8_t *result =
my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55);
@@ -149,6 +181,22 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
ASSERT (u8_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*llU %d", 10, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = " Hello 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*llU %d", -10, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = "Hello 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint8_t *result =
my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55);
@@ -187,6 +235,24 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("Mr. %*s %d", 20, "Ronald Reagan", 33, 44, 55);
+ static const uint8_t expected[] = "Mr. Ronald Reagan 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("Mr. %*s %d", -20, "Ronald Reagan", 33, 44, 55);
+ static const uint8_t expected[] = "Mr. Ronald Reagan 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* FLAG_LEFT. */
uint8_t *result =
my_xasprintf ("Mr. %-20s %d", "Ronald Reagan", 33, 44, 55);
@@ -238,6 +304,36 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*a %d", 10, 1.75, 33, 44, 55);
+ static const uint8_t expected1[] = " 0x1.cp+0 33";
+ static const uint8_t expected2[] = " 0x3.8p-1 33";
+ static const uint8_t expected3[] = " 0x7p-2 33";
+ static const uint8_t expected4[] = " 0xep-3 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected1) == 0
+ || u8_strcmp (result, expected2) == 0
+ || u8_strcmp (result, expected3) == 0
+ || u8_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*a %d", -10, 1.75, 33, 44, 55);
+ static const uint8_t expected1[] = "0x1.cp+0 33";
+ static const uint8_t expected2[] = "0x3.8p-1 33";
+ static const uint8_t expected3[] = "0x7p-2 33";
+ static const uint8_t expected4[] = "0xep-3 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected1) == 0
+ || u8_strcmp (result, expected2) == 0
+ || u8_strcmp (result, expected3) == 0
+ || u8_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
{ /* Small precision. */
uint8_t *result =
my_xasprintf ("%.10a %d", 1.75, 33, 44, 55);
@@ -298,6 +394,36 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*La %d", 10, 1.75L, 33, 44, 55);
+ static const uint8_t expected1[] = " 0x1.cp+0 33";
+ static const uint8_t expected2[] = " 0x3.8p-1 33";
+ static const uint8_t expected3[] = " 0x7p-2 33";
+ static const uint8_t expected4[] = " 0xep-3 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected1) == 0
+ || u8_strcmp (result, expected2) == 0
+ || u8_strcmp (result, expected3) == 0
+ || u8_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*La %d", -10, 1.75L, 33, 44, 55);
+ static const uint8_t expected1[] = "0x1.cp+0 33";
+ static const uint8_t expected2[] = "0x3.8p-1 33";
+ static const uint8_t expected3[] = "0x7p-2 33";
+ static const uint8_t expected4[] = "0xep-3 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected1) == 0
+ || u8_strcmp (result, expected2) == 0
+ || u8_strcmp (result, expected3) == 0
+ || u8_strcmp (result, expected4) == 0);
+ free (result);
+ }
+
{ /* Small precision. */
uint8_t *result =
my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55);
@@ -348,6 +474,24 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*f %d", 10, 1.75, 33, 44, 55);
+ static const uint8_t expected[] = " 1.750000 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*f %d", -10, 1.75, 33, 44, 55);
+ static const uint8_t expected[] = "1.750000 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint8_t *result =
my_xasprintf ("%.f %d", 1234.0, 33, 44, 55);
@@ -375,6 +519,24 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*Lf %d", 10, 1.75L, 33, 44, 55);
+ static const uint8_t expected[] = " 1.750000 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*Lf %d", -10, 1.75L, 33, 44, 55);
+ static const uint8_t expected[] = "1.750000 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint8_t *result =
my_xasprintf ("%.Lf %d", 1234.0L, 33, 44, 55);
@@ -446,6 +608,28 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*e %d", 15, 1.75, 33, 44, 55);
+ static const uint8_t expected1[] = " 1.750000e+00 33";
+ static const uint8_t expected2[] = " 1.750000e+000 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected1) == 0
+ || u8_strcmp (result, expected2) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*e %d", -15, 1.75, 33, 44, 55);
+ static const uint8_t expected1[] = "1.750000e+00 33";
+ static const uint8_t expected2[] = "1.750000e+000 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected1) == 0
+ || u8_strcmp (result, expected2) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint8_t *result =
my_xasprintf ("%.e %d", 1234.0, 33, 44, 55);
@@ -475,6 +659,24 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*Le %d", 15, 1.75L, 33, 44, 55);
+ static const uint8_t expected[] = " 1.750000e+00 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*Le %d", -15, 1.75L, 33, 44, 55);
+ static const uint8_t expected[] = "1.750000e+00 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint8_t *result =
my_xasprintf ("%.Le %d", 1234.0L, 33, 44, 55);
@@ -504,6 +706,24 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*g %d", 10, 1.75, 33, 44, 55);
+ static const uint8_t expected[] = " 1.75 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*g %d", -10, 1.75, 33, 44, 55);
+ static const uint8_t expected[] = "1.75 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint8_t *result =
my_xasprintf ("%.g %d", 1234.0, 33, 44, 55);
@@ -533,6 +753,24 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*Lg %d", 10, 1.75L, 33, 44, 55);
+ static const uint8_t expected[] = " 1.75 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*Lg %d", -10, 1.75L, 33, 44, 55);
+ static const uint8_t expected[] = "1.75 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+
{ /* Precision. */
uint8_t *result =
my_xasprintf ("%.Lg %d", 1234.0L, 33, 44, 55);
@@ -548,11 +786,15 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
int count = -1;
uint8_t *result =
my_xasprintf ("%d %n", 123, &count, 33, 44, 55);
+#if NEED_PRINTF_WITH_N_DIRECTIVE
static const uint8_t expected[] = "123 ";
ASSERT (result != NULL);
ASSERT (u8_strcmp (result, expected) == 0);
ASSERT (count == 4);
free (result);
+#else
+ ASSERT (result == NULL);
+#endif
}
/* Test the support of the POSIX/XSI format strings with positions. */
@@ -596,6 +838,22 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
ASSERT (u8_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*U %d", 20, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*U %d", -20, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint8_t *result =
my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55);
@@ -636,6 +894,22 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
ASSERT (u8_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*lU %d", 20, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*lU %d", -20, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint8_t *result =
my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55);
@@ -676,6 +950,22 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...))
ASSERT (u8_strcmp (result, expected) == 0);
free (result);
}
+ { /* Width given as argument. */
+ uint8_t *result =
+ my_xasprintf ("%*llU %d", 20, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ uint8_t *result =
+ my_xasprintf ("%*llU %d", -20, unicode_string, 33, 44, 55);
+ static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33";
+ ASSERT (result != NULL);
+ ASSERT (u8_strcmp (result, expected) == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
uint8_t *result =
my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55);
diff --git a/tests/unistdio/test-u8-vasnprintf1.c b/tests/unistdio/test-u8-vasnprintf1.c
index 94b9c8d7..895faa93 100644
--- a/tests/unistdio/test-u8-vasnprintf1.c
+++ b/tests/unistdio/test-u8-vasnprintf1.c
@@ -1,5 +1,5 @@
/* Test of u8_vasnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u8-vasnprintf2.c b/tests/unistdio/test-u8-vasnprintf2.c
index 745550b1..30289688 100644
--- a/tests/unistdio/test-u8-vasnprintf2.c
+++ b/tests/unistdio/test-u8-vasnprintf2.c
@@ -1,5 +1,5 @@
/* Test of u8_vasnprintf() function in an ISO-8859-1 locale.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u8-vasnprintf3.c b/tests/unistdio/test-u8-vasnprintf3.c
index 5f601abd..b5dc9ab6 100644
--- a/tests/unistdio/test-u8-vasnprintf3.c
+++ b/tests/unistdio/test-u8-vasnprintf3.c
@@ -1,5 +1,5 @@
/* Test of u8_vasnprintf() function in an UTF-8 locale.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u8-vasprintf1.c b/tests/unistdio/test-u8-vasprintf1.c
index ec7e773f..611f1395 100644
--- a/tests/unistdio/test-u8-vasprintf1.c
+++ b/tests/unistdio/test-u8-vasprintf1.c
@@ -1,5 +1,5 @@
/* Test of u8_vasprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u8-vsnprintf1.c b/tests/unistdio/test-u8-vsnprintf1.c
index 89274aa0..5de57fb1 100644
--- a/tests/unistdio/test-u8-vsnprintf1.c
+++ b/tests/unistdio/test-u8-vsnprintf1.c
@@ -1,5 +1,5 @@
/* Test of u8_vsnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-u8-vsprintf1.c b/tests/unistdio/test-u8-vsprintf1.c
index 821880be..542cce32 100644
--- a/tests/unistdio/test-u8-vsprintf1.c
+++ b/tests/unistdio/test-u8-vsprintf1.c
@@ -1,5 +1,5 @@
/* Test of u8_vsprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-ulc-asnprintf1.c b/tests/unistdio/test-ulc-asnprintf1.c
index 4cad53d5..236cd3b2 100644
--- a/tests/unistdio/test-ulc-asnprintf1.c
+++ b/tests/unistdio/test-ulc-asnprintf1.c
@@ -1,5 +1,5 @@
/* Test of ulc_asnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-ulc-asnprintf1.h b/tests/unistdio/test-ulc-asnprintf1.h
index 3631c26e..9e11f314 100644
--- a/tests/unistdio/test-ulc-asnprintf1.h
+++ b/tests/unistdio/test-ulc-asnprintf1.h
@@ -1,5 +1,5 @@
/* Test of ulc_[v]asnprintf() functions.
- Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2024 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
diff --git a/tests/unistdio/test-ulc-printf1.h b/tests/unistdio/test-ulc-printf1.h
index a15effbb..49089c1b 100644
--- a/tests/unistdio/test-ulc-printf1.h
+++ b/tests/unistdio/test-ulc-printf1.h
@@ -1,5 +1,5 @@
/* Test of ulc_v[a]s[n]printf() functions.
- Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2024 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
@@ -71,6 +71,20 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
ASSERT (strcmp (result, " Hello 33") == 0);
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*U %d", 10, unicode_string, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " Hello 33") == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*U %d", -10, unicode_string, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "Hello 33") == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
char *result =
my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55);
@@ -103,6 +117,20 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
ASSERT (strcmp (result, " Hello 33") == 0);
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*lU %d", 10, unicode_string, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " Hello 33") == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*lU %d", -10, unicode_string, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "Hello 33") == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
char *result =
my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55);
@@ -135,6 +163,20 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
ASSERT (strcmp (result, " Hello 33") == 0);
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*llU %d", 10, unicode_string, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " Hello 33") == 0);
+ free (result);
+ }
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*llU %d", -10, unicode_string, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "Hello 33") == 0);
+ free (result);
+ }
{ /* FLAG_LEFT. */
char *result =
my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55);
@@ -169,6 +211,22 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("Mr. %*s %d", 20, "Ronald Reagan", 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "Mr. Ronald Reagan 33") == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("Mr. %*s %d", -20, "Ronald Reagan", 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "Mr. Ronald Reagan 33") == 0);
+ free (result);
+ }
+
{ /* FLAG_LEFT. */
char *result =
my_xasprintf ("Mr. %-20s %d", "Ronald Reagan", 33, 44, 55);
@@ -210,6 +268,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*a %d", 10, 1.75, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 0x1.cp+0 33") == 0
+ || strcmp (result, " 0x3.8p-1 33") == 0
+ || strcmp (result, " 0x7p-2 33") == 0
+ || strcmp (result, " 0xep-3 33") == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*a %d", -10, 1.75, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "0x1.cp+0 33") == 0
+ || strcmp (result, "0x3.8p-1 33") == 0
+ || strcmp (result, "0x7p-2 33") == 0
+ || strcmp (result, "0xep-3 33") == 0);
+ free (result);
+ }
+
{ /* Small precision. */
char *result =
my_xasprintf ("%.10a %d", 1.75, 33, 44, 55);
@@ -254,6 +334,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*La %d", 10, 1.75L, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 0x1.cp+0 33") == 0
+ || strcmp (result, " 0x3.8p-1 33") == 0
+ || strcmp (result, " 0x7p-2 33") == 0
+ || strcmp (result, " 0xep-3 33") == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*La %d", -10, 1.75L, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "0x1.cp+0 33") == 0
+ || strcmp (result, "0x3.8p-1 33") == 0
+ || strcmp (result, "0x7p-2 33") == 0
+ || strcmp (result, "0xep-3 33") == 0);
+ free (result);
+ }
+
{ /* Small precision. */
char *result =
my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55);
@@ -294,6 +396,22 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*f %d", 10, 1.75, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 1.750000 33") == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*f %d", -10, 1.75, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "1.750000 33") == 0);
+ free (result);
+ }
+
{ /* Precision. */
char *result =
my_xasprintf ("%.f %d", 1234.0, 33, 44, 55);
@@ -318,6 +436,22 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*Lf %d", 10, 1.75L, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 1.750000 33") == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*Lf %d", -10, 1.75L, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "1.750000 33") == 0);
+ free (result);
+ }
+
{ /* Precision. */
char *result =
my_xasprintf ("%.Lf %d", 1234.0L, 33, 44, 55);
@@ -380,6 +514,24 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*e %d", 15, 1.75, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 1.750000e+00 33") == 0
+ || strcmp (result, " 1.750000e+000 33") == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*e %d", -15, 1.75, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "1.750000e+00 33") == 0
+ || strcmp (result, "1.750000e+000 33") == 0);
+ free (result);
+ }
+
{ /* Precision. */
char *result =
my_xasprintf ("%.e %d", 1234.0, 33, 44, 55);
@@ -405,6 +557,22 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*Le %d", 15, 1.75L, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 1.750000e+00 33") == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*Le %d", -15, 1.75L, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "1.750000e+00 33") == 0);
+ free (result);
+ }
+
{ /* Precision. */
char *result =
my_xasprintf ("%.Le %d", 1234.0L, 33, 44, 55);
@@ -431,6 +599,22 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*g %d", 10, 1.75, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 1.75 33") == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*g %d", -10, 1.75, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "1.75 33") == 0);
+ free (result);
+ }
+
{ /* Precision. */
char *result =
my_xasprintf ("%.g %d", 1234.0, 33, 44, 55);
@@ -456,6 +640,22 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
free (result);
}
+ { /* Width given as argument. */
+ char *result =
+ my_xasprintf ("%*Lg %d", 10, 1.75L, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 1.75 33") == 0);
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result =
+ my_xasprintf ("%*Lg %d", -10, 1.75L, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "1.75 33") == 0);
+ free (result);
+ }
+
{ /* Precision. */
char *result =
my_xasprintf ("%.Lg %d", 1234.0L, 33, 44, 55);
@@ -470,10 +670,14 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...))
int count = -1;
char *result =
my_xasprintf ("%d %n", 123, &count, 33, 44, 55);
+#if NEED_PRINTF_WITH_N_DIRECTIVE
ASSERT (result != NULL);
ASSERT (strcmp (result, "123 ") == 0);
ASSERT (count == 4);
free (result);
+#else
+ ASSERT (result == NULL);
+#endif
}
/* Test the support of the POSIX/XSI format strings with positions. */
diff --git a/tests/unistdio/test-ulc-vasnprintf1.c b/tests/unistdio/test-ulc-vasnprintf1.c
index d6ea67dd..d0d6f858 100644
--- a/tests/unistdio/test-ulc-vasnprintf1.c
+++ b/tests/unistdio/test-ulc-vasnprintf1.c
@@ -1,5 +1,5 @@
/* Test of ulc_vasnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-ulc-vasnprintf2.c b/tests/unistdio/test-ulc-vasnprintf2.c
index f53ff50f..458ce4aa 100644
--- a/tests/unistdio/test-ulc-vasnprintf2.c
+++ b/tests/unistdio/test-ulc-vasnprintf2.c
@@ -1,5 +1,5 @@
/* Test of ulc_vasnprintf() function in an ISO-8859-1 locale.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-ulc-vasnprintf3.c b/tests/unistdio/test-ulc-vasnprintf3.c
index 6bc2c9b5..717e9850 100644
--- a/tests/unistdio/test-ulc-vasnprintf3.c
+++ b/tests/unistdio/test-ulc-vasnprintf3.c
@@ -1,5 +1,5 @@
/* Test of ulc_vasnprintf() function in an UTF-8 locale.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-ulc-vasprintf1.c b/tests/unistdio/test-ulc-vasprintf1.c
index ec523ff4..c97909cc 100644
--- a/tests/unistdio/test-ulc-vasprintf1.c
+++ b/tests/unistdio/test-ulc-vasprintf1.c
@@ -1,5 +1,5 @@
/* Test of ulc_vasprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-ulc-vsnprintf1.c b/tests/unistdio/test-ulc-vsnprintf1.c
index c282ff99..899ad10b 100644
--- a/tests/unistdio/test-ulc-vsnprintf1.c
+++ b/tests/unistdio/test-ulc-vsnprintf1.c
@@ -1,5 +1,5 @@
/* Test of ulc_vsnprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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
diff --git a/tests/unistdio/test-ulc-vsprintf1.c b/tests/unistdio/test-ulc-vsprintf1.c
index 9e9af160..123397d7 100644
--- a/tests/unistdio/test-ulc-vsprintf1.c
+++ b/tests/unistdio/test-ulc-vsprintf1.c
@@ -1,5 +1,5 @@
/* Test of ulc_vsprintf() function.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+ Copyright (C) 2007-2024 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