|
|
|
@ -32,25 +32,33 @@ |
|
|
|
|
static void |
|
|
|
|
test_empty (hb_set_t *s) |
|
|
|
|
{ |
|
|
|
|
hb_codepoint_t next = HB_SET_VALUE_INVALID; |
|
|
|
|
hb_codepoint_t next; |
|
|
|
|
g_assert_cmpint (hb_set_get_population (s), ==, 0); |
|
|
|
|
g_assert_cmpint (hb_set_get_min (s), ==, HB_SET_VALUE_INVALID); |
|
|
|
|
g_assert_cmpint (hb_set_get_max (s), ==, HB_SET_VALUE_INVALID); |
|
|
|
|
g_assert (!hb_set_has (s, 13)); |
|
|
|
|
next = 53043; |
|
|
|
|
g_assert (!hb_set_next (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, HB_SET_VALUE_INVALID); |
|
|
|
|
next = 07734; |
|
|
|
|
g_assert (!hb_set_previous (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, HB_SET_VALUE_INVALID); |
|
|
|
|
g_assert (hb_set_is_empty (s)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
test_not_empty (hb_set_t *s) |
|
|
|
|
{ |
|
|
|
|
hb_codepoint_t next = HB_SET_VALUE_INVALID; |
|
|
|
|
hb_codepoint_t next; |
|
|
|
|
g_assert_cmpint (hb_set_get_population (s), !=, 0); |
|
|
|
|
g_assert_cmpint (hb_set_get_min (s), !=, HB_SET_VALUE_INVALID); |
|
|
|
|
g_assert_cmpint (hb_set_get_max (s), !=, HB_SET_VALUE_INVALID); |
|
|
|
|
next = HB_SET_VALUE_INVALID; |
|
|
|
|
g_assert (hb_set_next (s, &next)); |
|
|
|
|
g_assert_cmpint (next, !=, HB_SET_VALUE_INVALID); |
|
|
|
|
next = HB_SET_VALUE_INVALID; |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert_cmpint (next, !=, HB_SET_VALUE_INVALID); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
@ -271,6 +279,27 @@ test_set_iter (void) |
|
|
|
|
g_assert (!hb_set_next (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, HB_SET_VALUE_INVALID); |
|
|
|
|
|
|
|
|
|
next = HB_SET_VALUE_INVALID; |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, 20005); |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, 1200); |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, 1100); |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, 15); |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, 13); |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, 10); |
|
|
|
|
g_assert (hb_set_previous (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, 6); |
|
|
|
|
g_assert (!hb_set_previous (s, &next)); |
|
|
|
|
g_assert_cmpint (next, ==, HB_SET_VALUE_INVALID); |
|
|
|
|
|
|
|
|
|
first = last = HB_SET_VALUE_INVALID; |
|
|
|
|
g_assert (hb_set_next_range (s, &first, &last)); |
|
|
|
|
g_assert_cmpint (first, ==, 6); |
|
|
|
@ -291,6 +320,26 @@ test_set_iter (void) |
|
|
|
|
g_assert_cmpint (first, ==, HB_SET_VALUE_INVALID); |
|
|
|
|
g_assert_cmpint (last, ==, HB_SET_VALUE_INVALID); |
|
|
|
|
|
|
|
|
|
first = last = HB_SET_VALUE_INVALID; |
|
|
|
|
g_assert (hb_set_previous_range (s, &first, &last)); |
|
|
|
|
g_assert_cmpint (first, ==, 20005); |
|
|
|
|
g_assert_cmpint (last, ==, 20005); |
|
|
|
|
g_assert (hb_set_previous_range (s, &first, &last)); |
|
|
|
|
g_assert_cmpint (first, ==, 1200); |
|
|
|
|
g_assert_cmpint (last, ==, 1200); |
|
|
|
|
g_assert (hb_set_previous_range (s, &first, &last)); |
|
|
|
|
g_assert_cmpint (first, ==, 1100); |
|
|
|
|
g_assert_cmpint (last, ==, 1100); |
|
|
|
|
g_assert (hb_set_previous_range (s, &first, &last)); |
|
|
|
|
g_assert_cmpint (first, ==, 10); |
|
|
|
|
g_assert_cmpint (last, ==, 15); |
|
|
|
|
g_assert (hb_set_previous_range (s, &first, &last)); |
|
|
|
|
g_assert_cmpint (first, ==, 6); |
|
|
|
|
g_assert_cmpint (last, ==, 6); |
|
|
|
|
g_assert (!hb_set_previous_range (s, &first, &last)); |
|
|
|
|
g_assert_cmpint (first, ==, HB_SET_VALUE_INVALID); |
|
|
|
|
g_assert_cmpint (last, ==, HB_SET_VALUE_INVALID); |
|
|
|
|
|
|
|
|
|
hb_set_destroy (s); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|