summaryrefslogtreecommitdiff
path: root/tests/uniwbrk/test-u16-wordbreaks.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-02-07 06:57:44 +0100
committerJörg Frings-Fürst <debian@jff.email>2022-02-07 06:57:44 +0100
commit6ffaa52cf732a84c0f8259dbc9b8183960ec5c33 (patch)
treed3136c22e3e805cfc0efe78412cce905a17e0c8d /tests/uniwbrk/test-u16-wordbreaks.c
parent591cbf5878b7d4105b275585b9db1324c9dfce56 (diff)
parentaf151c593704a40e10efb28d1e3dd59a23a661f3 (diff)
Merge branch 'release/debian/1.0-1'debian/1.0-1
Diffstat (limited to 'tests/uniwbrk/test-u16-wordbreaks.c')
-rw-r--r--tests/uniwbrk/test-u16-wordbreaks.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/tests/uniwbrk/test-u16-wordbreaks.c b/tests/uniwbrk/test-u16-wordbreaks.c
index c41298f..592c942 100644
--- a/tests/uniwbrk/test-u16-wordbreaks.c
+++ b/tests/uniwbrk/test-u16-wordbreaks.c
@@ -1,5 +1,5 @@
/* Test of word breaks in UTF-16 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 uint16_t input[8] =
+ { 'a', '\n', 'b', '\r', 'c', '\r', '\n', 'd' };
+ char *p = (char *) malloc (SIZEOF (input));
+ size_t i;
+
+ u16_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 uint16_t input[10] =
+ { '.', 0xD83C, 0xDDE9, 0xD83C, 0xDDEA, 0xD83C, 0xDDEB, 0xD83C, 0xDDF7, '.' };
+ char *p = (char *) malloc (SIZEOF (input));
+ size_t i;
+
+ u16_wordbreaks (input, SIZEOF (input), p);
+ for (i = 0; i < 10; i++)
+ {
+ ASSERT (p[i] == (i == 1 || i == 5 || i == 9 ? 1 : 0));
+ }
+ free (p);
+ }
+
return 0;
}