summaryrefslogtreecommitdiff
path: root/tests/unigbrk
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unigbrk')
-rw-r--r--tests/unigbrk/test-u16-grapheme-breaks.c15
-rw-r--r--tests/unigbrk/test-u16-grapheme-next.c6
-rw-r--r--tests/unigbrk/test-u16-grapheme-prev.c6
-rw-r--r--tests/unigbrk/test-u32-grapheme-breaks.c15
-rw-r--r--tests/unigbrk/test-u32-grapheme-next.c6
-rw-r--r--tests/unigbrk/test-u32-grapheme-prev.c6
-rw-r--r--tests/unigbrk/test-u8-grapheme-breaks.c13
-rw-r--r--tests/unigbrk/test-u8-grapheme-next.c6
-rw-r--r--tests/unigbrk/test-u8-grapheme-prev.c6
-rw-r--r--tests/unigbrk/test-uc-gbrk-prop.c5
-rw-r--r--tests/unigbrk/test-uc-grapheme-breaks.c13
-rw-r--r--tests/unigbrk/test-uc-is-grapheme-break.c2
-rw-r--r--tests/unigbrk/test-ulc-grapheme-breaks.c13
-rw-r--r--tests/unigbrk/test-unigbrk-h.c2
14 files changed, 43 insertions, 71 deletions
diff --git a/tests/unigbrk/test-u16-grapheme-breaks.c b/tests/unigbrk/test-u16-grapheme-breaks.c
index f4af9984..634ec4dc 100644
--- a/tests/unigbrk/test-u16-grapheme-breaks.c
+++ b/tests/unigbrk/test-u16-grapheme-breaks.c
@@ -1,5 +1,5 @@
/* Grapheme cluster breaks test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -35,14 +35,13 @@ test_u16_grapheme_breaks (const char *expected, ...)
uint16_t s[16];
va_list args;
char breaks[16];
- size_t i;
ASSERT (n <= 16);
memset (breaks, 0xcc, n);
va_start (args, expected);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
{
int unit = va_arg (args, int);
ASSERT (unit >= 0);
@@ -52,25 +51,23 @@ test_u16_grapheme_breaks (const char *expected, ...)
va_end (args);
u16_grapheme_breaks (s, n, breaks);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
if (breaks[i] != (expected[i] == '#'))
{
- size_t j;
-
fprintf (stderr, "wrong grapheme breaks:\n");
fprintf (stderr, " input:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %04X", s[j]);
putc ('\n', stderr);
fprintf (stderr, "expected:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %d", expected[j] == '#');
putc ('\n', stderr);
fprintf (stderr, " actual:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %d", breaks[j]);
putc ('\n', stderr);
diff --git a/tests/unigbrk/test-u16-grapheme-next.c b/tests/unigbrk/test-u16-grapheme-next.c
index eb68b7bd..542b4ba9 100644
--- a/tests/unigbrk/test-u16-grapheme-next.c
+++ b/tests/unigbrk/test-u16-grapheme-next.c
@@ -1,5 +1,5 @@
/* Next grapheme cluster length test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -52,14 +52,12 @@ test_u16_grapheme_next (size_t len, ...)
next = u16_grapheme_next (s, s + n);
if (next != s + len)
{
- size_t i;
-
if (next == NULL)
fputs ("u16_grapheme_next returned NULL", stderr);
else
fprintf (stderr, "u16_grapheme_next skipped %tu units", next - s);
fprintf (stderr, ", expected %zu:\n", len);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
fprintf (stderr, " %04x", s[i]);
putc ('\n', stderr);
fflush (stderr);
diff --git a/tests/unigbrk/test-u16-grapheme-prev.c b/tests/unigbrk/test-u16-grapheme-prev.c
index 8c17bdac..a0f4f1ae 100644
--- a/tests/unigbrk/test-u16-grapheme-prev.c
+++ b/tests/unigbrk/test-u16-grapheme-prev.c
@@ -1,5 +1,5 @@
/* Previous grapheme cluster test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -54,14 +54,12 @@ test_u16_grapheme_prev (size_t len, ...)
prev = u16_grapheme_prev (end, s);
if (prev != end - len)
{
- size_t i;
-
if (prev == NULL)
fputs ("u16_grapheme_prev returned NULL", stderr);
else
fprintf (stderr, "u16_grapheme_prev skipped %tu units", end - prev);
fprintf (stderr, ", expected %zu:\n", len);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
fprintf (stderr, " %04x", s[i]);
putc ('\n', stderr);
fflush (stderr);
diff --git a/tests/unigbrk/test-u32-grapheme-breaks.c b/tests/unigbrk/test-u32-grapheme-breaks.c
index 9f4267eb..7094da05 100644
--- a/tests/unigbrk/test-u32-grapheme-breaks.c
+++ b/tests/unigbrk/test-u32-grapheme-breaks.c
@@ -1,5 +1,5 @@
/* Grapheme cluster breaks test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -35,14 +35,13 @@ test_u32_grapheme_breaks (const char *expected, ...)
uint32_t s[16];
va_list args;
char breaks[16];
- size_t i;
ASSERT (n <= 16);
memset (breaks, 0xcc, n);
va_start (args, expected);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
{
int unit = va_arg (args, int);
ASSERT (unit >= 0);
@@ -52,25 +51,23 @@ test_u32_grapheme_breaks (const char *expected, ...)
va_end (args);
u32_grapheme_breaks (s, n, breaks);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
if (breaks[i] != (expected[i] == '#'))
{
- size_t j;
-
fprintf (stderr, "wrong grapheme breaks:\n");
fprintf (stderr, " input:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %04X", s[j]);
putc ('\n', stderr);
fprintf (stderr, "expected:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %d", expected[j] == '#');
putc ('\n', stderr);
fprintf (stderr, " actual:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %d", breaks[j]);
putc ('\n', stderr);
diff --git a/tests/unigbrk/test-u32-grapheme-next.c b/tests/unigbrk/test-u32-grapheme-next.c
index eee9bafd..c5ba5a54 100644
--- a/tests/unigbrk/test-u32-grapheme-next.c
+++ b/tests/unigbrk/test-u32-grapheme-next.c
@@ -1,5 +1,5 @@
/* Next grapheme cluster length test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -52,14 +52,12 @@ test_u32_grapheme_next (size_t len, ...)
next = u32_grapheme_next (s, s + n);
if (next != s + len)
{
- size_t i;
-
if (next == NULL)
fputs ("u32_grapheme_next returned NULL", stderr);
else
fprintf (stderr, "u32_grapheme_next skipped %tu units", next - s);
fprintf (stderr, ", expected %zu:\n", len);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
fprintf (stderr, " %04x", s[i]);
putc ('\n', stderr);
fflush (stderr);
diff --git a/tests/unigbrk/test-u32-grapheme-prev.c b/tests/unigbrk/test-u32-grapheme-prev.c
index ab50a630..9543f939 100644
--- a/tests/unigbrk/test-u32-grapheme-prev.c
+++ b/tests/unigbrk/test-u32-grapheme-prev.c
@@ -1,5 +1,5 @@
/* Previous grapheme cluster test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -54,14 +54,12 @@ test_u32_grapheme_prev (size_t len, ...)
prev = u32_grapheme_prev (end, s);
if (prev != end - len)
{
- size_t i;
-
if (prev == NULL)
fputs ("u32_grapheme_prev returned NULL", stderr);
else
fprintf (stderr, "u32_grapheme_prev skipped %tu units", end - prev);
fprintf (stderr, ", expected %zu:\n", len);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
fprintf (stderr, " %04x", s[i]);
putc ('\n', stderr);
fflush (stderr);
diff --git a/tests/unigbrk/test-u8-grapheme-breaks.c b/tests/unigbrk/test-u8-grapheme-breaks.c
index 3549186c..9966a9e7 100644
--- a/tests/unigbrk/test-u8-grapheme-breaks.c
+++ b/tests/unigbrk/test-u8-grapheme-breaks.c
@@ -1,5 +1,5 @@
/* Grapheme cluster breaks test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -33,7 +33,6 @@ test_u8_grapheme_breaks (const char *input, const char *expected)
const uint8_t *s = (const uint8_t *) input;
size_t n = strlen (expected);
char *breaks;
- size_t i;
breaks = malloc (n);
if (!breaks)
@@ -41,25 +40,23 @@ test_u8_grapheme_breaks (const char *input, const char *expected)
memset (breaks, 0xcc, n);
u8_grapheme_breaks (s, n, breaks);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
if (breaks[i] != (expected[i] == '#'))
{
- size_t j;
-
fprintf (stderr, "wrong grapheme breaks:\n");
fprintf (stderr, " input:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %02X", s[j]);
putc ('\n', stderr);
fprintf (stderr, "expected:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %d", expected[j] == '#');
putc ('\n', stderr);
fprintf (stderr, " actual:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %d", breaks[j]);
putc ('\n', stderr);
diff --git a/tests/unigbrk/test-u8-grapheme-next.c b/tests/unigbrk/test-u8-grapheme-next.c
index 8929814f..da0fc807 100644
--- a/tests/unigbrk/test-u8-grapheme-next.c
+++ b/tests/unigbrk/test-u8-grapheme-next.c
@@ -1,5 +1,5 @@
/* Next grapheme cluster length test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -33,14 +33,12 @@ test_u8_grapheme_next (const char *input, size_t n, size_t len)
const uint8_t *next = u8_grapheme_next (s, s + n);
if (next != s + len)
{
- size_t i;
-
if (next == NULL)
fputs ("u8_grapheme_next returned NULL", stderr);
else
fprintf (stderr, "u8_grapheme_next skipped %tu bytes", next - s);
fprintf (stderr, ", expected %zu:\n", len);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
fprintf (stderr, " %02x", s[i]);
putc ('\n', stderr);
fflush (stderr);
diff --git a/tests/unigbrk/test-u8-grapheme-prev.c b/tests/unigbrk/test-u8-grapheme-prev.c
index 9d635100..0612836d 100644
--- a/tests/unigbrk/test-u8-grapheme-prev.c
+++ b/tests/unigbrk/test-u8-grapheme-prev.c
@@ -1,5 +1,5 @@
/* Previous grapheme cluster test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -34,14 +34,12 @@ test_u8_grapheme_prev (const char *input, size_t n, size_t len)
const uint8_t *prev = u8_grapheme_prev (end, s);
if (prev != end - len)
{
- size_t i;
-
if (prev == NULL)
fputs ("u8_grapheme_prev returned NULL", stderr);
else
fprintf (stderr, "u8_grapheme_prev skipped %tu bytes", end - prev);
fprintf (stderr, ", expected %zu:\n", len);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
fprintf (stderr, " %02x", s[i]);
putc ('\n', stderr);
fflush (stderr);
diff --git a/tests/unigbrk/test-uc-gbrk-prop.c b/tests/unigbrk/test-uc-gbrk-prop.c
index 23dc7c89..18d982b9 100644
--- a/tests/unigbrk/test-uc-gbrk-prop.c
+++ b/tests/unigbrk/test-uc-gbrk-prop.c
@@ -1,5 +1,5 @@
/* Test the Unicode grapheme break property function.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 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
@@ -63,11 +63,10 @@ graphemebreakproperty_to_string (int gbp)
int
main (void)
{
- const struct uc_gbrk_prop_range *r;
ucs4_t uc;
uc = 0;
- for (r = set; r < set + SIZEOF (set); r++)
+ for (const struct uc_gbrk_prop_range *r = set; r < set + SIZEOF (set); r++)
{
for (; uc < r->end; uc++)
{
diff --git a/tests/unigbrk/test-uc-grapheme-breaks.c b/tests/unigbrk/test-uc-grapheme-breaks.c
index 860751c4..3de349e7 100644
--- a/tests/unigbrk/test-uc-grapheme-breaks.c
+++ b/tests/unigbrk/test-uc-grapheme-breaks.c
@@ -1,5 +1,5 @@
/* Grapheme cluster break function test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -61,30 +61,27 @@ test_uc_grapheme_breaks (const char *expected, ucs4_t *s, size_t n,
const char *filename, int lineno)
{
char breaks[16];
- size_t i;
ASSERT (n <= 16);
uc_grapheme_breaks (s, n, breaks);
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
if (breaks[i] != (expected[i] == '#'))
{
- size_t j;
-
fprintf (stderr, "wrong grapheme breaks:\n");
fprintf (stderr, " input:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %04X", s[j]);
putc ('\n', stderr);
fprintf (stderr, "expected:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %d", expected[j] == '#');
putc ('\n', stderr);
fprintf (stderr, " actual:");
- for (j = 0; j < n; j++)
+ for (size_t j = 0; j < n; j++)
fprintf (stderr, " %d", breaks[j]);
putc ('\n', stderr);
diff --git a/tests/unigbrk/test-uc-is-grapheme-break.c b/tests/unigbrk/test-uc-is-grapheme-break.c
index 04614891..61b3a2bd 100644
--- a/tests/unigbrk/test-uc-is-grapheme-break.c
+++ b/tests/unigbrk/test-uc-is-grapheme-break.c
@@ -1,5 +1,5 @@
/* Grapheme cluster break function test.
- Copyright (C) 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
diff --git a/tests/unigbrk/test-ulc-grapheme-breaks.c b/tests/unigbrk/test-ulc-grapheme-breaks.c
index b66222e8..acd0e757 100644
--- a/tests/unigbrk/test-ulc-grapheme-breaks.c
+++ b/tests/unigbrk/test-ulc-grapheme-breaks.c
@@ -1,5 +1,5 @@
/* Grapheme cluster breaks test.
- Copyright (C) 2009-2025 Free Software Foundation, Inc.
+ Copyright (C) 2009-2026 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
@@ -52,28 +52,25 @@ main ()
static const char s[] = "ZYX\352\353W\360\361V\362";
enum { LENGTH = sizeof s - 1 };
char p[LENGTH];
- size_t i;
ulc_grapheme_breaks (s, LENGTH, p);
- for (i = 0; i < LENGTH; i++)
+ for (size_t i = 0; i < LENGTH; i++)
if (p[i] != is_8859_6_break (s[i]))
{
- size_t j;
-
fprintf (stderr, "wrong grapheme breaks:\n");
fprintf (stderr, " input:");
- for (j = 0; j < LENGTH; j++)
+ for (size_t j = 0; j < LENGTH; j++)
fprintf (stderr, " %02X", (unsigned char) s[j]);
putc ('\n', stderr);
fprintf (stderr, "expected:");
- for (j = 0; j < LENGTH; j++)
+ for (size_t j = 0; j < LENGTH; j++)
fprintf (stderr, " %d", is_8859_6_break (s[j]));
putc ('\n', stderr);
fprintf (stderr, " actual:");
- for (j = 0; j < LENGTH; j++)
+ for (size_t j = 0; j < LENGTH; j++)
fprintf (stderr, " %d", p[j]);
putc ('\n', stderr);
diff --git a/tests/unigbrk/test-unigbrk-h.c b/tests/unigbrk/test-unigbrk-h.c
index 4058f252..b7d3032d 100644
--- a/tests/unigbrk/test-unigbrk-h.c
+++ b/tests/unigbrk/test-unigbrk-h.c
@@ -1,5 +1,5 @@
/* Test of <unigbrk.h>.
- Copyright (C) 2025 Free Software Foundation, Inc.
+ Copyright (C) 2025-2026 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