+2015-04-07 Daiki Ueno <ueno@gnu.org>
+
+ uniname/uniname-tests: fix failure due to alias
+ Reported by Jack Howarth in:
+ <https://lists.gnu.org/archive/html/bug-libunistring/2015-04/msg00000.html>.
+ * 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 <gscrivan@redhat.com>
hash: remove deprecated hash_insert0 function
}
}
+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 ()
result = unicode_name_character (buf);
if (result != UNINAME_INVALID
+ && !name_has_alias (result)
&& !(unicode_names[result] != NULL
&& strcmp (unicode_names[result], buf) == 0))
{
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;
}