diff options
Diffstat (limited to 'tests/unistr/test-u8-uctomb.c')
| -rw-r--r-- | tests/unistr/test-u8-uctomb.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/tests/unistr/test-u8-uctomb.c b/tests/unistr/test-u8-uctomb.c index 0d030a7d..40f99744 100644 --- a/tests/unistr/test-u8-uctomb.c +++ b/tests/unistr/test-u8-uctomb.c @@ -1,5 +1,5 @@ /* Test of u8_uctomb() function. - Copyright (C) 2010-2024 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 @@ -28,24 +28,20 @@ int main () { /* Test ISO 646 character, in particular the NUL character. */ - { - ucs4_t uc; - - for (uc = 0; uc < 0x80; uc++) - { - uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; - int ret; + for (ucs4_t uc = 0; uc < 0x80; uc++) + { + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + int ret; - ret = u8_uctomb (buf, uc, 0); - ASSERT (ret == -2); - ASSERT (buf[0] == MAGIC); + ret = u8_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); - ret = u8_uctomb (buf, uc, 1); - ASSERT (ret == 1); - ASSERT (buf[0] == uc); - ASSERT (buf[1] == MAGIC); - } - } + ret = u8_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } /* Test 2-byte character. */ { @@ -133,14 +129,12 @@ main () { ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; - size_t i; - for (i = 0; i < SIZEOF (invalid); i++) + for (size_t i = 0; i < SIZEOF (invalid); i++) { ucs4_t uc = invalid[i]; - int n; - for (n = 0; n <= 4; n++) + for (int n = 0; n <= 4; n++) { int ret = u8_uctomb (buf, uc, n); ASSERT (ret == -1); |
