[set] Add tests for inverted set range iteration
This commit is contained in:
parent
381ac2fd78
commit
14ff747024
|
@ -107,5 +107,34 @@ main (int argc, char **argv)
|
|||
assert (v2.get_population () == 3);
|
||||
}
|
||||
|
||||
/* Test inverted sets. */
|
||||
{
|
||||
hb_set_t s;
|
||||
s.invert();
|
||||
s.del (5);
|
||||
|
||||
hb_codepoint_t start = HB_SET_VALUE_INVALID, last = HB_SET_VALUE_INVALID;
|
||||
assert (s.next_range (&start, &last));
|
||||
assert (start == 0);
|
||||
assert (last == 4);
|
||||
assert (s.next_range (&start, &last));
|
||||
assert (start == 6);
|
||||
assert (last == HB_SET_VALUE_INVALID - 1);
|
||||
assert (!s.next_range (&start, &last));
|
||||
|
||||
start = HB_SET_VALUE_INVALID;
|
||||
last = HB_SET_VALUE_INVALID;
|
||||
assert (s.previous_range (&start, &last));
|
||||
assert (start == 6);
|
||||
assert (last == HB_SET_VALUE_INVALID - 1);
|
||||
assert (s.previous_range (&start, &last));
|
||||
assert (start == 0);
|
||||
assert (last == 4);
|
||||
assert (!s.previous_range (&start, &last));
|
||||
|
||||
/* Inverted set returns true for invalid value. */
|
||||
assert (s.has (HB_SET_VALUE_INVALID));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue