From be8efac78d067c138ad8dda03df4336e73f94887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Jan 2022 11:51:07 +0100 Subject: New upstream version 1.0 --- tests/uniwbrk/test-u32-wordbreaks.c | 40 ++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'tests/uniwbrk/test-u32-wordbreaks.c') diff --git a/tests/uniwbrk/test-u32-wordbreaks.c b/tests/uniwbrk/test-u32-wordbreaks.c index cbc3b45..cb2ffe1 100644 --- a/tests/uniwbrk/test-u32-wordbreaks.c +++ b/tests/uniwbrk/test-u32-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-32 strings. - Copyright (C) 2009-2018 Free Software Foundation, Inc. + Copyright (C) 2009-2022 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,7 +52,8 @@ main () || (i >= 23 && i <= 31) || (i >= 35 && i <= 39) || (i >= 42 && i <= 46) - || (i >= 48 && i <= 58) + || (i >= 48 && i <= 49) + || (i >= 51 && i <= 58) || i == 60 ? 1 : 0)); } @@ -83,12 +84,45 @@ main () || (i >= 25 && i <= 33) || (i >= 37 && i <= 41) || (i >= 44 && i <= 48) - || (i >= 50 && i <= 60) + || (i >= 50 && i <= 51) + || (i >= 53 && i <= 60) || i == 66 ? 1 : 0)); } free (p); } + /* CR LF handling. */ + { + static const uint32_t input[8] = + { 'a', '\n', 'b', '\r', 'c', '\r', '\n', 'd' }; + char *p = (char *) malloc (SIZEOF (input)); + size_t i; + + u32_wordbreaks (input, SIZEOF (input), p); + for (i = 0; i < 8; i++) + { + ASSERT (p[i] == (i == 1 || i == 2 || i == 3 || i == 4 || i == 5 + || i == 7 ? 1 : + 0)); + } + free (p); + } + + /* Test regional indicators. */ + { + static const uint32_t input[6] = + { '.', 0x1F1E9, 0x1F1EA, 0x1F1EB, 0x1F1F7, '.' }; + char *p = (char *) malloc (SIZEOF (input)); + size_t i; + + u32_wordbreaks (input, SIZEOF (input), p); + for (i = 0; i < 6; i++) + { + ASSERT (p[i] == (i == 1 || i == 3 || i == 5 ? 1 : 0)); + } + free (p); + } + return 0; } -- cgit v1.2.3