diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
| commit | 5f59a34ab747dde8ede7357f3431bf06bd6002fe (patch) | |
| tree | 056a4477fd870d454d5be5868cddab829a47f4d2 /tests/uninorm | |
| parent | 27dae84ed92f1ef0300263091972338d12e78348 (diff) | |
New upstream version 1.4.2upstream/1.4.2upstream
Diffstat (limited to 'tests/uninorm')
38 files changed, 842 insertions, 902 deletions
diff --git a/tests/uninorm/test-canonical-decomposition.c b/tests/uninorm/test-canonical-decomposition.c index 2502f56c..7298a61e 100644 --- a/tests/uninorm/test-canonical-decomposition.c +++ b/tests/uninorm/test-canonical-decomposition.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of Unicode characters. - 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 diff --git a/tests/uninorm/test-compat-decomposition.c b/tests/uninorm/test-compat-decomposition.c index b4266fd7..be4dc9fc 100644 --- a/tests/uninorm/test-compat-decomposition.c +++ b/tests/uninorm/test-compat-decomposition.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of Unicode characters. - 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 diff --git a/tests/uninorm/test-composition.c b/tests/uninorm/test-composition.c index 1aa885d1..3b24410f 100644 --- a/tests/uninorm/test-composition.c +++ b/tests/uninorm/test-composition.c @@ -1,5 +1,5 @@ /* Test of canonical composition of Unicode characters. - 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 diff --git a/tests/uninorm/test-decomposing-form.c b/tests/uninorm/test-decomposing-form.c index 2d46f3d4..1a3efd8e 100644 --- a/tests/uninorm/test-decomposing-form.c +++ b/tests/uninorm/test-decomposing-form.c @@ -1,5 +1,5 @@ /* Test of decomposing variant of a normalization form. - 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 diff --git a/tests/uninorm/test-decomposition.c b/tests/uninorm/test-decomposition.c index 5b02ab7e..a50d781d 100644 --- a/tests/uninorm/test-decomposition.c +++ b/tests/uninorm/test-decomposition.c @@ -1,5 +1,5 @@ /* Test of decomposition of Unicode characters. - 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 diff --git a/tests/uninorm/test-nfc.c b/tests/uninorm/test-nfc.c index 654892fd..3f9b3c24 100644 --- a/tests/uninorm/test-nfc.c +++ b/tests/uninorm/test-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of Unicode strings. - 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 diff --git a/tests/uninorm/test-nfd.c b/tests/uninorm/test-nfd.c index 1a84946c..57afb977 100644 --- a/tests/uninorm/test-nfd.c +++ b/tests/uninorm/test-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of Unicode strings. - 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 diff --git a/tests/uninorm/test-nfkc.c b/tests/uninorm/test-nfkc.c index 0a8102fe..035c60b8 100644 --- a/tests/uninorm/test-nfkc.c +++ b/tests/uninorm/test-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of Unicode strings. - 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 diff --git a/tests/uninorm/test-nfkd.c b/tests/uninorm/test-nfkd.c index 1bb889d6..3a9e1273 100644 --- a/tests/uninorm/test-nfkd.c +++ b/tests/uninorm/test-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of Unicode strings. - 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 diff --git a/tests/uninorm/test-u16-nfc.c b/tests/uninorm/test-u16-nfc.c index de65b308..0cfd0c1f 100644 --- a/tests/uninorm/test-u16-nfc.c +++ b/tests/uninorm/test-u16-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-16 strings. - 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 @@ -256,71 +256,67 @@ test_u16_nfc (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } - } - } + } + for (size_t i = m2; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u16-nfd.c b/tests/uninorm/test-u16-nfd.c index f83fc8e2..bdeca562 100644 --- a/tests/uninorm/test-u16-nfd.c +++ b/tests/uninorm/test-u16-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-16 strings. - 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 @@ -243,68 +243,64 @@ test_u16_nfd (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } - } - } + } + for (size_t i = m2; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u16-nfkc.c b/tests/uninorm/test-u16-nfkc.c index 63215ce0..ef25acef 100644 --- a/tests/uninorm/test-u16-nfkc.c +++ b/tests/uninorm/test-u16-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-16 strings. - 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 @@ -304,71 +304,67 @@ test_u16_nfkc (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } - } - } + } + for (size_t i = m2; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u16-nfkd.c b/tests/uninorm/test-u16-nfkd.c index d560bb1b..30f39ea3 100644 --- a/tests/uninorm/test-u16-nfkd.c +++ b/tests/uninorm/test-u16-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-16 strings. - 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 @@ -263,68 +263,64 @@ test_u16_nfkd (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } - } - } + } + for (size_t i = m2; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u16-normcmp.c b/tests/uninorm/test-u16-normcmp.c index 117279c7..7a1a7d9b 100644 --- a/tests/uninorm/test-u16-normcmp.c +++ b/tests/uninorm/test-u16-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-16 strings. - 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 diff --git a/tests/uninorm/test-u16-normcmp.h b/tests/uninorm/test-u16-normcmp.h index ba9784b3..10bdfd06 100644 --- a/tests/uninorm/test-u16-normcmp.h +++ b/tests/uninorm/test-u16-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-16 strings. - 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 diff --git a/tests/uninorm/test-u16-normcoll.c b/tests/uninorm/test-u16-normcoll.c index 25d6b0e4..cb65a813 100644 --- a/tests/uninorm/test-u16-normcoll.c +++ b/tests/uninorm/test-u16-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-16 strings. - 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 diff --git a/tests/uninorm/test-u32-nfc-big.c b/tests/uninorm/test-u32-nfc-big.c index 6282d512..a5aac2c5 100644 --- a/tests/uninorm/test-u32-nfc-big.c +++ b/tests/uninorm/test-u32-nfc-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of canonical normalization of UTF-32 strings. - 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 diff --git a/tests/uninorm/test-u32-nfc.c b/tests/uninorm/test-u32-nfc.c index 119af6b2..89f0d652 100644 --- a/tests/uninorm/test-u32-nfc.c +++ b/tests/uninorm/test-u32-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-32 strings. - 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 @@ -256,71 +256,67 @@ test_u32_nfc (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } - } - } + } + for (size_t i = m2; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u32-nfd-big.c b/tests/uninorm/test-u32-nfd-big.c index 94d5d511..a471a035 100644 --- a/tests/uninorm/test-u32-nfd-big.c +++ b/tests/uninorm/test-u32-nfd-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of canonical decomposition of UTF-32 strings. - 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 diff --git a/tests/uninorm/test-u32-nfd.c b/tests/uninorm/test-u32-nfd.c index 248e0eca..49a12359 100644 --- a/tests/uninorm/test-u32-nfd.c +++ b/tests/uninorm/test-u32-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-32 strings. - 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 @@ -243,68 +243,64 @@ test_u32_nfd (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } - } - } + } + for (size_t i = m2; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u32-nfkc-big.c b/tests/uninorm/test-u32-nfkc-big.c index 380f674c..63aa1acc 100644 --- a/tests/uninorm/test-u32-nfkc-big.c +++ b/tests/uninorm/test-u32-nfkc-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of compatibility normalization of UTF-32 strings. - 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 diff --git a/tests/uninorm/test-u32-nfkc.c b/tests/uninorm/test-u32-nfkc.c index 454b7afd..6dfc745e 100644 --- a/tests/uninorm/test-u32-nfkc.c +++ b/tests/uninorm/test-u32-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-32 strings. - 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 @@ -304,71 +304,67 @@ test_u32_nfkc (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } - } - } + } + for (size_t i = m2; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u32-nfkd-big.c b/tests/uninorm/test-u32-nfkd-big.c index 8aafb7d7..ee176342 100644 --- a/tests/uninorm/test-u32-nfkd-big.c +++ b/tests/uninorm/test-u32-nfkd-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of compatibility decomposition of UTF-32 strings. - 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 diff --git a/tests/uninorm/test-u32-nfkd.c b/tests/uninorm/test-u32-nfkd.c index 4120d7bc..50fc7960 100644 --- a/tests/uninorm/test-u32-nfkd.c +++ b/tests/uninorm/test-u32-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-32 strings. - 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 @@ -263,68 +263,64 @@ test_u32_nfkd (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } - } - } + } + for (size_t i = m2; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (size_t i = 0; i < m1; i++) + *p++ = 0x0319; + for (size_t i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u32-normalize-big.c b/tests/uninorm/test-u32-normalize-big.c index ae197991..863c7181 100644 --- a/tests/uninorm/test-u32-normalize-big.c +++ b/tests/uninorm/test-u32-normalize-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of normalization of UTF-32 strings. - 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 @@ -58,7 +58,6 @@ read_normalization_test_file (const char *filename, { FILE *stream; unsigned int lineno; - int part_index; struct normalization_test_line *lines; size_t lines_length; size_t lines_allocated; @@ -70,7 +69,7 @@ read_normalization_test_file (const char *filename, exit (1); } - for (part_index = 0; part_index < 6; part_index++) + for (int part_index = 0; part_index < 6; part_index++) { file->parts[part_index].lines = NULL; file->parts[part_index].lines_length = 0; @@ -78,7 +77,7 @@ read_normalization_test_file (const char *filename, lineno = 0; - part_index = -1; + int part_index = -1; lines = NULL; lines_length = 0; lines_allocated = 0; @@ -89,7 +88,6 @@ read_normalization_test_file (const char *filename, char *ptr; int c; struct normalization_test_line line; - size_t sequence_index; lineno++; @@ -139,9 +137,9 @@ read_normalization_test_file (const char *filename, } ptr = buf; line.lineno = lineno; - for (sequence_index = 0; sequence_index < 5; sequence_index++) + for (size_t sequence_index = 0; sequence_index < 5; sequence_index++) line.sequences[sequence_index] = NULL; - for (sequence_index = 0; sequence_index < 5; sequence_index++) + for (size_t sequence_index = 0; sequence_index < 5; sequence_index++) { uint32_t *sequence = XNMALLOC (1, uint32_t); size_t sequence_length = 0; @@ -210,9 +208,8 @@ read_normalization_test_file (const char *filename, /* Collect all c1 values from the part 1 in an array. */ const struct normalization_test_part *p = &file->parts[1]; ucs4_t *c1_array = XNMALLOC (p->lines_length + 1, ucs4_t); - size_t line_index; - for (line_index = 0; line_index < p->lines_length; line_index++) + for (size_t line_index = 0; line_index < p->lines_length; line_index++) { const uint32_t *sequence = p->lines[line_index].sequences[0]; /* In part 1, every sequences[0] consists of a single character. */ @@ -247,14 +244,11 @@ test_specific (const struct normalization_test_file *file, const uint32_t *c4, size_t c4_length, const uint32_t *c5, size_t c5_length)) { - size_t part_index; - - for (part_index = 0; part_index < 6; part_index++) + for (size_t part_index = 0; part_index < 6; part_index++) { const struct normalization_test_part *p = &file->parts[part_index]; - size_t line_index; - for (line_index = 0; line_index < p->lines_length; line_index++) + for (size_t line_index = 0; line_index < p->lines_length; line_index++) { const struct normalization_test_line *l = &p->lines[line_index]; @@ -276,9 +270,8 @@ test_other (const struct normalization_test_file *file, uninorm_t nf) NormalizationTest.txt file, the character maps to itself in each of the four normalization forms. */ const ucs4_t *p = file->part1_c1_sorted; - ucs4_t uc; - for (uc = 0; uc < 0x110000; uc++) + for (ucs4_t uc = 0; uc < 0x110000; uc++) { if (uc >= 0xD800 && uc < 0xE000) { @@ -307,19 +300,15 @@ test_other (const struct normalization_test_file *file, uninorm_t nf) void free_normalization_test_file (struct normalization_test_file *file) { - size_t part_index; - - for (part_index = 0; part_index < 6; part_index++) + for (size_t part_index = 0; part_index < 6; part_index++) { const struct normalization_test_part *p = &file->parts[part_index]; - size_t line_index; - for (line_index = 0; line_index < p->lines_length; line_index++) + for (size_t line_index = 0; line_index < p->lines_length; line_index++) { const struct normalization_test_line *l = &p->lines[line_index]; - size_t sequence_index; - for (sequence_index = 0; sequence_index < 5; sequence_index++) + for (size_t sequence_index = 0; sequence_index < 5; sequence_index++) free (l->sequences[sequence_index]); } free (p->lines); diff --git a/tests/uninorm/test-u32-normalize-big.h b/tests/uninorm/test-u32-normalize-big.h index f691ea05..5402d7b0 100644 --- a/tests/uninorm/test-u32-normalize-big.h +++ b/tests/uninorm/test-u32-normalize-big.h @@ -1,5 +1,5 @@ /* Test of Unicode compliance of normalization of UTF-32 strings. - 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 diff --git a/tests/uninorm/test-u32-normcmp.c b/tests/uninorm/test-u32-normcmp.c index 6ec6384a..e18de216 100644 --- a/tests/uninorm/test-u32-normcmp.c +++ b/tests/uninorm/test-u32-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-32 strings. - 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 diff --git a/tests/uninorm/test-u32-normcmp.h b/tests/uninorm/test-u32-normcmp.h index b184c762..b1a97bd7 100644 --- a/tests/uninorm/test-u32-normcmp.h +++ b/tests/uninorm/test-u32-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-32 strings. - 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 diff --git a/tests/uninorm/test-u32-normcoll.c b/tests/uninorm/test-u32-normcoll.c index 1087233a..bc9c68c8 100644 --- a/tests/uninorm/test-u32-normcoll.c +++ b/tests/uninorm/test-u32-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-32 strings. - 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 diff --git a/tests/uninorm/test-u8-nfc.c b/tests/uninorm/test-u8-nfc.c index 6d98721c..96993cf7 100644 --- a/tests/uninorm/test-u8-nfc.c +++ b/tests/uninorm/test-u8-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-8 strings. - 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 @@ -262,95 +262,91 @@ test_u8_nfc (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0xC3; - expected[1] = 0x80; - p = expected + 2; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2 - 1; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); - ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); - } - - free (input); - } - } - } + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (size_t i = m2; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0xC3; + expected[1] = 0x80; + p = expected + 2; + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (size_t i = 0; i < m2 - 1; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); + ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); + } + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u8-nfd.c b/tests/uninorm/test-u8-nfd.c index 78b9fa77..d7602f1e 100644 --- a/tests/uninorm/test-u8-nfd.c +++ b/tests/uninorm/test-u8-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-8 strings. - 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 @@ -249,91 +249,87 @@ test_u8_nfd (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0x41; - p = expected + 1; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); - - free (input); - } - } - } + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (size_t i = m2; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0x41; + p = expected + 1; + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u8-nfkc.c b/tests/uninorm/test-u8-nfkc.c index a8379908..551d112f 100644 --- a/tests/uninorm/test-u8-nfkc.c +++ b/tests/uninorm/test-u8-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-8 strings. - 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 @@ -314,95 +314,91 @@ test_u8_nfkc (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0xC3; - expected[1] = 0x80; - p = expected + 2; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2 - 1; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); - ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); - } - - free (input); - } - } - } + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (size_t i = m2; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0xC3; + expected[1] = 0x80; + p = expected + 2; + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (size_t i = 0; i < m2 - 1; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); + ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); + } + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u8-nfkd.c b/tests/uninorm/test-u8-nfkd.c index ddc1ddde..b18dd531 100644 --- a/tests/uninorm/test-u8-nfkd.c +++ b/tests/uninorm/test-u8-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-8 strings. - 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 @@ -270,91 +270,87 @@ test_u8_nfkd (void) #endif /* Check that the sorting is not O(n²) but O(n log n). */ - { - int pass; - for (pass = 0; pass < 3; pass++) - { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0x41; - p = expected + 1; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); - - free (input); - } - } - } + for (int pass = 0; pass < 3; pass++) + { + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (size_t i = m2; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0x41; + p = expected + 1; + for (size_t i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (size_t i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); + + free (input); + } + } } #else diff --git a/tests/uninorm/test-u8-normcmp.c b/tests/uninorm/test-u8-normcmp.c index 772da7fc..5c6b6c8d 100644 --- a/tests/uninorm/test-u8-normcmp.c +++ b/tests/uninorm/test-u8-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-8 strings. - 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 diff --git a/tests/uninorm/test-u8-normcmp.h b/tests/uninorm/test-u8-normcmp.h index 843a5233..e033ae76 100644 --- a/tests/uninorm/test-u8-normcmp.h +++ b/tests/uninorm/test-u8-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-8 strings. - 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 diff --git a/tests/uninorm/test-u8-normcoll.c b/tests/uninorm/test-u8-normcoll.c index 6ab628c0..5026b731 100644 --- a/tests/uninorm/test-u8-normcoll.c +++ b/tests/uninorm/test-u8-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-8 strings. - 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 diff --git a/tests/uninorm/test-uninorm-filter-nfc.c b/tests/uninorm/test-uninorm-filter-nfc.c index 98904182..8ff16205 100644 --- a/tests/uninorm/test-uninorm-filter-nfc.c +++ b/tests/uninorm/test-uninorm-filter-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of streams. - 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 @@ -55,7 +55,6 @@ check (const uint32_t *input, size_t input_length, { struct accumulator accu; struct uninorm_filter *filter; - size_t i; accu.result = NULL; accu.length = 0; @@ -64,7 +63,7 @@ check (const uint32_t *input, size_t input_length, filter = uninorm_filter_create (UNINORM_NFC, write_to_accumulator, &accu); ASSERT (filter != NULL); - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ASSERT (uninorm_filter_write (filter, input[i]) == 0); ASSERT (uninorm_filter_free (filter) == 0); diff --git a/tests/uninorm/test-uninorm-h.c b/tests/uninorm/test-uninorm-h.c index 0398d24e..16d8688b 100644 --- a/tests/uninorm/test-uninorm-h.c +++ b/tests/uninorm/test-uninorm-h.c @@ -1,5 +1,5 @@ /* Test of <uninorm.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 |
