summaryrefslogtreecommitdiff
path: root/tests/unigbrk/test-uc-is-grapheme-break.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unigbrk/test-uc-is-grapheme-break.c')
-rw-r--r--tests/unigbrk/test-uc-is-grapheme-break.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/tests/unigbrk/test-uc-is-grapheme-break.c b/tests/unigbrk/test-uc-is-grapheme-break.c
index 3f8535c..3bf92ee 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-2016 Free Software Foundation, Inc.
+ Copyright (C) 2010-2017 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
@@ -12,7 +12,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Ben Pfaff <blp@cs.stanford.edu>, 2010. */
@@ -45,6 +45,11 @@ graphemebreakproperty_to_string (int gbp)
CASE(LV)
CASE(LVT)
CASE(RI)
+ CASE(ZWJ)
+ CASE(EB)
+ CASE(EM)
+ CASE(GAZ)
+ CASE(EBG)
}
abort ();
}
@@ -81,6 +86,8 @@ main (int argc, char *argv[])
char *comment;
const char *p;
ucs4_t prev;
+ int last_compchar_prop;
+ size_t ri_count;
lineno++;
@@ -90,6 +97,8 @@ main (int argc, char *argv[])
if (line[strspn (line, " \t\r\n")] == '\0')
continue;
+ last_compchar_prop = -1;
+ ri_count = 0;
prev = 0;
p = line;
do
@@ -135,7 +144,30 @@ main (int argc, char *argv[])
next = next_int;
}
- if (uc_is_grapheme_break (prev, next) != should_break)
+ if ((last_compchar_prop == GBP_EB
+ || last_compchar_prop == GBP_EBG)
+ && uc_graphemeclusterbreak_property (next) == GBP_EM)
+ {
+ int prev_gbp = uc_graphemeclusterbreak_property (prev);
+ int next_gbp = uc_graphemeclusterbreak_property (next);
+ fprintf (stderr, "%s:%d: skipping GB10: should join U+%04X (%s) "
+ "and U+%04X (%s)\n",
+ filename, lineno,
+ prev, graphemebreakproperty_to_string (prev_gbp),
+ next, graphemebreakproperty_to_string (next_gbp));
+ }
+ else if (uc_graphemeclusterbreak_property (next) == GBP_RI
+ && ri_count % 2 != 0)
+ {
+ int prev_gbp = uc_graphemeclusterbreak_property (prev);
+ int next_gbp = uc_graphemeclusterbreak_property (next);
+ fprintf (stderr, "%s:%d: skipping GB12: should join U+%04X (%s) "
+ "and U+%04X (%s)\n",
+ filename, lineno,
+ prev, graphemebreakproperty_to_string (prev_gbp),
+ next, graphemebreakproperty_to_string (next_gbp));
+ }
+ else if (uc_is_grapheme_break (prev, next) != should_break)
{
int prev_gbp = uc_graphemeclusterbreak_property (prev);
int next_gbp = uc_graphemeclusterbreak_property (next);
@@ -150,6 +182,16 @@ main (int argc, char *argv[])
p += strspn (p, " \t\r\n");
prev = next;
+
+ if (!(uc_graphemeclusterbreak_property (next) == GBP_EXTEND
+ && (last_compchar_prop == GBP_EB
+ || last_compchar_prop == GBP_EBG)))
+ last_compchar_prop = uc_graphemeclusterbreak_property (next);
+
+ if (uc_graphemeclusterbreak_property (next) == GBP_RI)
+ ri_count++;
+ else
+ ri_count = 0;
}
while (*p != '\0');
}