Skip to content

Commit

Permalink
[test] Add more hb-set tests
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed Oct 25, 2017
1 parent 33ca3b6 commit 49a41dc
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/api/test-set.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ test_set_basic (void)
hb_set_destroy (s);
}

static void
print_set (hb_set_t *s)
{
printf ("{");

This comment has been minimized.

Copy link
@ebraminio

ebraminio Oct 26, 2017

Collaborator
test-set.c: In function ‘print_set’:

test-set.c:96:3: error: ‘for’ loop initial declarations are only allowed in C99 mode

   for (hb_codepoint_t next = HB_SET_VALUE_INVALID; hb_set_next (s, &next); )

   ^

test-set.c:96:3: note: use option -std=c99 or -std=gnu99 to compile your code
for (hb_codepoint_t next = HB_SET_VALUE_INVALID; hb_set_next (s, &next); )
printf ("%d, ", next);
printf ("}\n");
}

static void
test_set_algebra (void)
{
Expand Down Expand Up @@ -149,7 +158,38 @@ test_set_algebra (void)
g_assert (!hb_set_has (s, 13));
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 (o);
}

static void
Expand Down

0 comments on commit 49a41dc

Please sign in to comment.