[test] Add more hb-set tests

https://github.com/behdad/harfbuzz/issues/579
This commit is contained in:
Behdad Esfahbod 2017-10-25 16:17:45 -06:00
parent 33ca3b67bf
commit 49a41dc759
1 changed files with 40 additions and 0 deletions

View File

@ -89,6 +89,15 @@ test_set_basic (void)
hb_set_destroy (s); hb_set_destroy (s);
} }
static void
print_set (hb_set_t *s)
{
printf ("{");
for (hb_codepoint_t next = HB_SET_VALUE_INVALID; hb_set_next (s, &next); )
printf ("%d, ", next);
printf ("}\n");
}
static void static void
test_set_algebra (void) test_set_algebra (void)
{ {
@ -149,7 +158,38 @@ test_set_algebra (void)
g_assert (!hb_set_has (s, 13)); g_assert (!hb_set_has (s, 13));
g_assert (hb_set_has (s, 19)); g_assert (hb_set_has (s, 19));
/* https://github.com/behdad/harfbuzz/issues/579 */
hb_set_clear (s);
test_empty (s);
hb_set_add_range (s, 886, 895);
hb_set_add (s, 1024);
hb_set_add (s, 1152);
hb_set_clear (o);
test_empty (o);
hb_set_add (o, 889);
hb_set_add (o, 1024);
g_assert (!hb_set_is_equal (s, o));
hb_set_intersect (o, s);
test_not_empty (o);
g_assert (!hb_set_is_equal (s, o));
g_assert_cmpint (hb_set_get_population (o), ==, 2);
g_assert (hb_set_has (o, 889));
g_assert (hb_set_has (o, 1024));
hb_set_clear (o);
test_empty (o);
hb_set_add_range (o, 887, 889);
hb_set_add (o, 1121);
g_assert (!hb_set_is_equal (s, o));
hb_set_intersect (o, s);
test_not_empty (o);
g_assert (!hb_set_is_equal (s, o));
g_assert_cmpint (hb_set_get_population (o), ==, 3);
g_assert (hb_set_has (o, 887));
g_assert (hb_set_has (o, 888));
g_assert (hb_set_has (o, 889));
hb_set_destroy (s); hb_set_destroy (s);
hb_set_destroy (o);
} }
static void static void