Add test to make sure ot-languages array is sorted

Currently fails.  Part of
https://bugs.freedesktop.org/show_bug.cgi?id=93275
This commit is contained in:
Behdad Esfahbod 2015-12-07 10:28:46 +01:00
parent 8c37556f73
commit 70952ddb5a
2 changed files with 31 additions and 1 deletions

View File

@ -392,7 +392,14 @@ dist_check_SCRIPTS = \
check-symbols.sh \ check-symbols.sh \
$(NULL) $(NULL)
TESTS = $(dist_check_SCRIPTS) check_PROGRAMS = \
test-ot-tag \
$(NULL)
test_ot_tag_SOURCES = hb-ot-tag.cc
test_ot_tag_CPPFLAGS = $(HBCFLAGS) -DMAIN
test_ot_tag_LDADD = libharfbuzz.la $(HBLIBS)
TESTS = $(dist_check_SCRIPTS) $(check_PROGRAMS)
TESTS_ENVIRONMENT = \ TESTS_ENVIRONMENT = \
srcdir="$(srcdir)" \ srcdir="$(srcdir)" \
MAKE="$(MAKE) $(AM_MAKEFLAGS)" \ MAKE="$(MAKE) $(AM_MAKEFLAGS)" \

View File

@ -928,4 +928,27 @@ hb_ot_tag_to_language (hb_tag_t tag)
} }
} }
static inline void
test_langs_sorted (void)
{
for (unsigned int i = 1; i < ARRAY_LENGTH (ot_languages); i++)
{
int c = lang_compare_first_component (ot_languages[i-1].language, ot_languages[i].language);
if (c >= 0)
{
fprintf (stderr, "ot_languages not sorted at index %d: %s %d %s\n",
i, ot_languages[i-1].language, c, ot_languages[i].language);
abort();
}
}
}
#ifdef MAIN
int
main (void)
{
test_langs_sorted ();
return 0;
}
#endif