+2021-12-29 Bruno Haible <bruno@clisp.org>
+
+ uniwbrk: Add unit tests of CR-LF sequences.
+ * tests/uniwbrk/test-u8-wordbreaks.c (main): Add test of a string with
+ CR-LF.
+ * tests/uniwbrk/test-u16-wordbreaks.c (main): Likewise.
+ * tests/uniwbrk/test-u32-wordbreaks.c (main): Likewise.
+
2021-12-29 Bruno Haible <bruno@clisp.org>
unigbrk: Add unit tests of CR-LF sequences.
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] =
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] =
free (p);
}
+ /* CR LF handling. */
+ {
+ static const uint8_t input[8] = "a\nb\rc\r\nd";
+ char *p = (char *) malloc (SIZEOF (input));
+ size_t i;
+
+ u8_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 uint8_t input[18] =