mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-13 01:07:47 +00:00
Add tests for ucd::lookup_category_group.
This commit is contained in:
+22
-1
@@ -21,6 +21,23 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
const char *get_category_group_string(ucd::category_group c)
|
||||
{
|
||||
using namespace ucd;
|
||||
switch (c)
|
||||
{
|
||||
case C: return "C";
|
||||
case I: return "I";
|
||||
case L: return "L";
|
||||
case M: return "M";
|
||||
case N: return "N";
|
||||
case P: return "P";
|
||||
case S: return "S";
|
||||
case Z: return "Z";
|
||||
default: return "-";
|
||||
}
|
||||
}
|
||||
|
||||
const char *get_category_string(ucd::category c)
|
||||
{
|
||||
using namespace ucd;
|
||||
@@ -66,11 +83,15 @@ int main()
|
||||
for (ucd::codepoint_t c = 0; c <= 0x10FFFF; ++c)
|
||||
{
|
||||
const char *category = get_category_string(ucd::lookup_category(c));
|
||||
const char *category_group = get_category_group_string(ucd::lookup_category_group(c));
|
||||
ucd::codepoint_t upper = ucd::toupper(c);
|
||||
ucd::codepoint_t lower = ucd::tolower(c);
|
||||
ucd::codepoint_t title = ucd::totitle(c);
|
||||
const char *whitespace = ucd::isspace(c) ? "White_Space" : "";
|
||||
printf("%06X %s %06X %06X %06X %s\n", c, category, upper, lower, title, whitespace);
|
||||
printf("%06X %s %s %06X %06X %06X %s\n",
|
||||
c, category_group, category,
|
||||
upper, lower, title,
|
||||
whitespace);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+5
-2
@@ -44,6 +44,9 @@ if __name__ == '__main__':
|
||||
if title == null: title = codepoint
|
||||
if upper == null: upper = codepoint
|
||||
if lower == null: lower = codepoint
|
||||
print '%s %s %s %s %s %s' % (codepoint, data['GeneralCategory'], upper, lower, title, ' '.join(data['Properties']))
|
||||
print '%s %s %s %s %s %s %s' % (
|
||||
codepoint, data['GeneralCategory'][0], data['GeneralCategory'],
|
||||
upper, lower, title,
|
||||
' '.join(data['Properties']))
|
||||
except KeyError:
|
||||
print '%s Cn %s %s %s ' % (codepoint, codepoint, codepoint, codepoint)
|
||||
print '%s C Cn %s %s %s ' % (codepoint, codepoint, codepoint, codepoint)
|
||||
|
||||
Reference in New Issue
Block a user