Imported Upstream version 0.9.35
[platform/upstream/harfbuzz.git] / test / api / test-set.c
index b9e7ef8..9634951 100644 (file)
 static void
 test_empty (hb_set_t *s)
 {
-  hb_codepoint_t next = (hb_codepoint_t) -1;
+  hb_codepoint_t next = HB_SET_VALUE_INVALID;
   g_assert_cmpint (hb_set_get_population (s), ==, 0);
-  g_assert_cmpint (hb_set_get_min (s), ==, (hb_codepoint_t) -1);
-  g_assert_cmpint (hb_set_get_max (s), ==, (hb_codepoint_t) -1);
+  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));
   g_assert (!hb_set_next (s, &next));
-  g_assert_cmpint (next, ==, (hb_codepoint_t) -1);
+  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_codepoint_t) -1;
+  hb_codepoint_t next = HB_SET_VALUE_INVALID;
   g_assert_cmpint (hb_set_get_population (s), !=, 0);
-  g_assert_cmpint (hb_set_get_min (s), !=, (hb_codepoint_t) -1);
-  g_assert_cmpint (hb_set_get_max (s), !=, (hb_codepoint_t) -1);
+  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_next (s, &next));
-  g_assert_cmpint (next, !=, (hb_codepoint_t) -1);
+  g_assert_cmpint (next, !=, HB_SET_VALUE_INVALID);
 }
 
 static void
@@ -64,6 +65,10 @@ test_set_basic (void)
   hb_set_clear (s);
   test_empty (s);
 
+  hb_set_add (s, 33000);
+  test_not_empty (s);
+  hb_set_clear (s);
+
   hb_set_add_range (s, 10, 29);
   test_not_empty (s);
   g_assert (hb_set_has (s, 13));
@@ -86,6 +91,8 @@ test_set_basic (void)
   hb_set_del_range (s, 10, 18);
   test_not_empty (s);
   g_assert (!hb_set_has (s, 13));
+
+  hb_set_destroy (s);
 }
 
 static void
@@ -147,6 +154,8 @@ test_set_algebra (void)
   g_assert (hb_set_has (s, 12));
   g_assert (!hb_set_has (s, 13));
   g_assert (hb_set_has (s, 19));
+
+  hb_set_destroy (s);
 }
 
 static void
@@ -162,7 +171,7 @@ test_set_iter (void)
 
   test_not_empty (s);
 
-  next = (hb_codepoint_t) -1;
+  next = HB_SET_VALUE_INVALID;
   g_assert (hb_set_next (s, &next));
   g_assert_cmpint (next, ==, 6);
   g_assert (hb_set_next (s, &next));
@@ -177,9 +186,9 @@ test_set_iter (void)
   g_assert (hb_set_next (s, &next));
   g_assert_cmpint (next, ==, 20005);
   g_assert (!hb_set_next (s, &next));
-  g_assert_cmpint (next, ==, 20005);
+  g_assert_cmpint (next, ==, HB_SET_VALUE_INVALID);
 
-  first = last = (hb_codepoint_t) -1;
+  first = last = HB_SET_VALUE_INVALID;
   g_assert (hb_set_next_range (s, &first, &last));
   g_assert_cmpint (first, ==, 6);
   g_assert_cmpint (last,  ==, 6);
@@ -190,8 +199,10 @@ test_set_iter (void)
   g_assert_cmpint (first, ==, 20005);
   g_assert_cmpint (last,  ==, 20005);
   g_assert (!hb_set_next_range (s, &first, &last));
-  g_assert_cmpint (first, ==, 20005);
-  g_assert_cmpint (last,  ==, 20005);
+  g_assert_cmpint (first, ==, HB_SET_VALUE_INVALID);
+  g_assert_cmpint (last,  ==, HB_SET_VALUE_INVALID);
+
+  hb_set_destroy (s);
 }
 
 static void
@@ -221,6 +232,8 @@ test_set_empty (void)
   test_empty (b);
 
   g_assert (!hb_set_allocation_successful (b));
+
+  hb_set_destroy (b);
 }
 
 int