# HG changeset patch # User Daiki Ueno # Date 1428372563 -32400 # Node ID d1b79c99331f0e069673f606a4864cfd6ed4aaa3 # Parent 522f6f858b0c731d17e40e64f85f77e7d0127360 uniname/uniname-tests: fix failure due to alias Reported by Jack Howarth in: . * tests/uniname/test-uninames.c (name_has_alias): New function. (test_inverse_lookup): Exclude character name with valid alias, from randomly generated character names. (main): Fill unicode_aliases before calling test functions. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2015-04-07 Daiki Ueno + + uniname/uniname-tests: fix failure due to alias + Reported by Jack Howarth in: + . + * tests/uniname/test-uninames.c (name_has_alias): New function. + (test_inverse_lookup): Exclude character name with valid alias, + from randomly generated character names. + (main): Fill unicode_aliases before calling test functions. + 2015-04-03 Giuseppe Scrivano hash: remove deprecated hash_insert0 function diff --git a/tests/uniname/test-uninames.c b/tests/uniname/test-uninames.c --- a/tests/uniname/test-uninames.c +++ b/tests/uniname/test-uninames.c @@ -181,6 +181,16 @@ } } +static int +name_has_alias (unsigned int uc) +{ + int i; + for (i = 0; i < ALIASLEN; i++) + if (unicode_aliases[i].uc == uc) + return 1; + return 0; +} + /* Perform an exhaustive test of the unicode_character_name function. */ static int test_name_lookup () @@ -296,6 +306,7 @@ result = unicode_name_character (buf); if (result != UNINAME_INVALID + && !name_has_alias (result) && !(unicode_names[result] != NULL && strcmp (unicode_names[result], buf) == 0)) { @@ -354,15 +365,14 @@ set_program_name (argv[0]); fill_names (argv[1]); + if (argc > 2) + fill_aliases (argv[2]); error |= test_name_lookup (); error |= test_inverse_lookup (); if (argc > 2) - { - fill_aliases (argv[2]); - error |= test_alias_lookup (); - } + error |= test_alias_lookup (); return error; }