diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-01-08 11:53:52 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-01-08 11:53:52 +0100 |
commit | fa838e76139763f902c7d27cb9e1d393ed6a15e4 (patch) | |
tree | 7d0ae09775ea950056193eaa2ca93844299d46f1 /tests/uniwbrk/test-u8-wordbreaks.c | |
parent | c78359d9542c86b972aac373efcf7bc7a8a560e5 (diff) | |
parent | 2959e59fab3bab834368adefd90bd4b1b094366b (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'tests/uniwbrk/test-u8-wordbreaks.c')
-rw-r--r-- | tests/uniwbrk/test-u8-wordbreaks.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/tests/uniwbrk/test-u8-wordbreaks.c b/tests/uniwbrk/test-u8-wordbreaks.c index 6cdcc88..1e403d6 100644 --- a/tests/uniwbrk/test-u8-wordbreaks.c +++ b/tests/uniwbrk/test-u8-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-8 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 @@ -46,7 +46,8 @@ main () || (i >= 37 && i <= 44) || i == 46 || (i >= 50 && i <= 52) || (i >= 54 && i <= 55) - || (i >= 58 && i <= 62) || (i >= 64 && i <= 67) + || (i >= 58 && i <= 62) || (i >= 64 && i <= 65) + || i == 67 || i == 70 || i == 73 || i == 76 || i == 77 || i == 80 || i == 83 || i == 84 || i == 90 @@ -72,7 +73,8 @@ main () || (i >= 40 && i <= 47) || i == 49 || (i >= 53 && i <= 55) || (i >= 57 && i <= 58) - || (i >= 61 && i <= 65) || (i >= 67 && i <= 70) + || (i >= 61 && i <= 65) || (i >= 67 && i <= 68) + || i == 70 || i == 73 || i == 76 || i == 79 || i == 80 || i == 83 || i == 86 || i == 87 || i == 105 @@ -81,5 +83,36 @@ main () 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] = + ".\360\237\207\251\360\237\207\252\360\237\207\253\360\237\207\267."; + char *p = (char *) malloc (SIZEOF (input)); + size_t i; + + u8_wordbreaks (input, SIZEOF (input), p); + for (i = 0; i < 18; i++) + { + ASSERT (p[i] == (i == 1 || i == 9 || i == 17 ? 1 : 0)); + } + free (p); + } + return 0; } |