Browse Source

Add tests for the remaining is* APIs.

master
Reece H. Dunn 8 years ago
parent
commit
ac082c9400
4 changed files with 42 additions and 6 deletions
  1. 2
    1
      tests/printcdata.c
  2. 2
    1
      tests/printucddata.c
  3. 2
    1
      tests/printucddata_cpp.cpp
  4. 36
    3
      tools/printdata.py

+ 2
- 1
tests/printcdata.c View File

@@ -248,7 +248,8 @@ int main(int argc, char **argv)
else
{
for (codepoint_t c = 0; c <= 0x10FFFF; ++c)
uprintf(stdout, c, format ? format : "%pH %s %C %c %UH %LH %TH %id %ix %is %ib %iu %il\n");
uprintf(stdout, c, format ? format :
"%pH %s %C %c %UH %LH %TH %id %ix %ic %is %ib %ip %iP %ig %iA %ia %iu %il\n");
}
return 0;
}

+ 2
- 1
tests/printucddata.c View File

@@ -243,7 +243,8 @@ int main(int argc, char **argv)
else
{
for (codepoint_t c = 0; c <= 0x10FFFF; ++c)
uprintf(stdout, c, format ? format : "%pH %s %C %c %UH %LH %TH %id %ix %is %ib %iu %il\n");
uprintf(stdout, c, format ? format :
"%pH %s %C %c %UH %LH %TH %id %ix %ic %is %ib %ip %iP %ig %iA %ia %iu %il\n");
}
return 0;
}

+ 2
- 1
tests/printucddata_cpp.cpp View File

@@ -243,7 +243,8 @@ int main(int argc, char **argv)
else
{
for (ucd::codepoint_t c = 0; c <= 0x10FFFF; ++c)
uprintf(stdout, c, format ? format : "%pH %s %C %c %UH %LH %TH %id %ix %is %ib %iu %il\n");
uprintf(stdout, c, format ? format :
"%pH %s %C %c %UH %LH %TH %id %ix %ic %is %ib %ip %iP %ig %iA %ia %iu %il\n");
}
return 0;
}

+ 36
- 3
tools/printdata.py View File

@@ -43,6 +43,9 @@ if '--with-csur' in sys.argv:
for codepoint in data['CodePoint']:
unicode_chars[codepoint] = data

def iscntrl(data):
return 1 if data.get('Name', '') == '<control>' else 0

def isdigit(data):
return 1 if data['CodePoint'].char() in '0123456789' else 0

@@ -63,6 +66,36 @@ def isblank(data): # word separator
else:
return 0

def ispunct(data):
if data.get('GeneralCategory', 'Cn')[0] in 'P':
return 1
else:
return 0

def isprint(data):
if data.get('GeneralCategory', 'Cn')[0] in 'LMNPSZ': # not in 'CI'
return 1
else:
return 0

def isgraph(data):
if data.get('GeneralCategory', 'Cn')[0] in 'LMNPS': # not in 'CZI'
return 1
else:
return 0

def isalnum(data):
if data.get('GeneralCategory', 'Cn')[0] in 'LN':
return 1
else:
return 0

def isalpha(data):
if data.get('GeneralCategory', 'Cn')[0] in 'L':
return 1
else:
return 0

def isupper(data):
if data.get('LowerCase', null) != null:
return 1
@@ -92,10 +125,10 @@ 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 %s %s %s %s %s %s %s' % (
print('%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s' % (
codepoint, script,
data.get('GeneralCategory', 'Cn')[0], data.get('GeneralCategory', 'Cn'),
upper, lower, title,
isdigit(data), isxdigit(data),
isspace(data), isblank(data),
isupper(data), islower(data)))
iscntrl(data), isspace(data), isblank(data), ispunct(data),
isprint(data), isgraph(data), isalnum(data), isalpha(data), isupper(data), islower(data)))

Loading…
Cancel
Save