summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--tests/uniname/test-uninames.c18
2 files changed, 24 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 2cf42d263d..bca02d7196 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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
diff --git a/tests/uniname/test-uninames.c b/tests/uniname/test-uninames.c
index eccf2f4ec0..e4435e61f0 100644
--- a/tests/uniname/test-uninames.c
+++ b/tests/uniname/test-uninames.c
@@ -181,6 +181,16 @@ fill_aliases (const char *namealiases_filename)
}
}
+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 @@ test_inverse_lookup ()
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 @@ main (int argc, char *argv[])
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;
}