[tests] Start adding tests for hb-set.h
Fails now. Fixing.
diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index c736b69..8e03d68 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -137,6 +137,7 @@
{
hb_object_header_t header;
ASSERT_POD ();
+ bool in_error;
inline void init (void) {
header.init ();
@@ -224,6 +225,11 @@
for (unsigned int i = 0; i < ELTS; i++)
elts[i] ^= other->elts[i];
}
+ inline void invert (void)
+ {
+ for (unsigned int i = 0; i < ELTS; i++)
+ elts[i] = ~elts[i];
+ }
inline bool next (hb_codepoint_t *codepoint) const
{
if (unlikely (*codepoint == SENTINEL)) {
diff --git a/src/hb-set.cc b/src/hb-set.cc
index 93f983a..5f427a5 100644
--- a/src/hb-set.cc
+++ b/src/hb-set.cc
@@ -49,6 +49,7 @@
{
static const hb_set_t _hb_set_nil = {
HB_OBJECT_HEADER_STATIC,
+ true, /* in_error */
{0} /* elts */
};
@@ -93,7 +94,7 @@
hb_bool_t
hb_set_allocation_successful (const hb_set_t *set HB_UNUSED)
{
- return true;
+ return !set->in_error;
}
void
@@ -187,6 +188,12 @@
set->symmetric_difference (other);
}
+void
+hb_set_invert (hb_set_t *set)
+{
+ set->invert ();
+}
+
unsigned int
hb_set_get_population (const hb_set_t *set)
{
diff --git a/src/hb-set.h b/src/hb-set.h
index ec3d119..291e249 100644
--- a/src/hb-set.h
+++ b/src/hb-set.h
@@ -121,6 +121,9 @@
hb_set_symmetric_difference (hb_set_t *set,
const hb_set_t *other);
+void
+hb_set_invert (hb_set_t *set);
+
unsigned int
hb_set_get_population (const hb_set_t *set);