[set] include null pool sets in the permutations tested by inverted_operations.
This commit is contained in:
parent
c90678cbc5
commit
f84daccb4f
|
@ -949,9 +949,13 @@ typedef enum {
|
||||||
|
|
||||||
static hb_set_t* prepare_set(hb_bool_t has_x,
|
static hb_set_t* prepare_set(hb_bool_t has_x,
|
||||||
hb_bool_t inverted,
|
hb_bool_t inverted,
|
||||||
hb_bool_t has_page)
|
hb_bool_t has_page,
|
||||||
|
hb_bool_t is_null)
|
||||||
{
|
{
|
||||||
static const hb_codepoint_t x = 13;
|
static const hb_codepoint_t x = 13;
|
||||||
|
if (is_null)
|
||||||
|
return hb_set_get_empty ();
|
||||||
|
|
||||||
hb_set_t* s = hb_set_create ();
|
hb_set_t* s = hb_set_create ();
|
||||||
if (inverted) hb_set_invert (s);
|
if (inverted) hb_set_invert (s);
|
||||||
if (has_page)
|
if (has_page)
|
||||||
|
@ -971,14 +975,16 @@ static hb_bool_t
|
||||||
check_set_operations(hb_bool_t a_has_x,
|
check_set_operations(hb_bool_t a_has_x,
|
||||||
hb_bool_t a_inverted,
|
hb_bool_t a_inverted,
|
||||||
hb_bool_t a_has_page,
|
hb_bool_t a_has_page,
|
||||||
|
hb_bool_t a_is_null,
|
||||||
hb_bool_t b_has_x,
|
hb_bool_t b_has_x,
|
||||||
hb_bool_t b_inverted,
|
hb_bool_t b_inverted,
|
||||||
hb_bool_t b_has_page,
|
hb_bool_t b_has_page,
|
||||||
|
hb_bool_t b_is_null,
|
||||||
set_operation op)
|
set_operation op)
|
||||||
{
|
{
|
||||||
hb_codepoint_t x = 13;
|
hb_codepoint_t x = 13;
|
||||||
hb_set_t* a = prepare_set (a_has_x, a_inverted, a_has_page);
|
hb_set_t* a = prepare_set (a_has_x, a_inverted, a_has_page, a_is_null);
|
||||||
hb_set_t* b = prepare_set (b_has_x, b_inverted, b_has_page);
|
hb_set_t* b = prepare_set (b_has_x, b_inverted, b_has_page, b_is_null);
|
||||||
|
|
||||||
char* op_name;
|
char* op_name;
|
||||||
hb_bool_t has_expected;
|
hb_bool_t has_expected;
|
||||||
|
@ -987,37 +993,39 @@ check_set_operations(hb_bool_t a_has_x,
|
||||||
case UNION:
|
case UNION:
|
||||||
default:
|
default:
|
||||||
op_name = "union";
|
op_name = "union";
|
||||||
should_have_x = (a_has_x || b_has_x);
|
should_have_x = (a_has_x || b_has_x) && !a_is_null;
|
||||||
hb_set_union (a, b);
|
hb_set_union (a, b);
|
||||||
has_expected = (hb_set_has (a, x) == should_have_x);
|
has_expected = (hb_set_has (a, x) == should_have_x);
|
||||||
break;
|
break;
|
||||||
case INTERSECT:
|
case INTERSECT:
|
||||||
op_name = "intersect";
|
op_name = "intersect";
|
||||||
should_have_x = (a_has_x && b_has_x);
|
should_have_x = (a_has_x && b_has_x) && !a_is_null;
|
||||||
hb_set_intersect (a, b);
|
hb_set_intersect (a, b);
|
||||||
has_expected = (hb_set_has (a, x) == should_have_x);
|
has_expected = (hb_set_has (a, x) == should_have_x);
|
||||||
break;
|
break;
|
||||||
case SUBTRACT:
|
case SUBTRACT:
|
||||||
op_name = "subtract";
|
op_name = "subtract";
|
||||||
should_have_x = (a_has_x && !b_has_x);
|
should_have_x = (a_has_x && !b_has_x) && !a_is_null;
|
||||||
hb_set_subtract (a, b);
|
hb_set_subtract (a, b);
|
||||||
has_expected = (hb_set_has (a, x) == should_have_x);
|
has_expected = (hb_set_has (a, x) == should_have_x);
|
||||||
break;
|
break;
|
||||||
case SYM_DIFF:
|
case SYM_DIFF:
|
||||||
op_name = "sym_diff";
|
op_name = "sym_diff";
|
||||||
should_have_x = (a_has_x ^ b_has_x);
|
should_have_x = (a_has_x ^ b_has_x) && !a_is_null;
|
||||||
hb_set_symmetric_difference (a, b);
|
hb_set_symmetric_difference (a, b);
|
||||||
has_expected = (hb_set_has (a, x) == should_have_x);
|
has_expected = (hb_set_has (a, x) == should_have_x);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("%s%s%s %-9s %s%s%s == %s [%s]\n",
|
printf ("%s%s%s%s %-9s %s%s%s%s == %s [%s]\n",
|
||||||
a_inverted ? "i" : " ",
|
a_inverted ? "i" : " ",
|
||||||
a_has_page ? "p" : " ",
|
a_has_page ? "p" : " ",
|
||||||
|
a_is_null ? "n" : " ",
|
||||||
a_has_x ? "{13}" : "{} ",
|
a_has_x ? "{13}" : "{} ",
|
||||||
op_name,
|
op_name,
|
||||||
b_inverted ? "i" : " ",
|
b_inverted ? "i" : " ",
|
||||||
b_has_page ? "p" : " ",
|
b_has_page ? "p" : " ",
|
||||||
|
b_is_null ? "n" : " ",
|
||||||
b_has_x ? "{13}" : "{} ",
|
b_has_x ? "{13}" : "{} ",
|
||||||
should_have_x ? "{13}" : "{} ",
|
should_have_x ? "{13}" : "{} ",
|
||||||
has_expected ? "succeeded" : "failed");
|
has_expected ? "succeeded" : "failed");
|
||||||
|
@ -1038,11 +1046,15 @@ test_set_inverted_operations (void)
|
||||||
for (hb_bool_t b_inverted = 0; b_inverted <= 1; b_inverted++) {
|
for (hb_bool_t b_inverted = 0; b_inverted <= 1; b_inverted++) {
|
||||||
for (hb_bool_t a_has_page = 0; a_has_page <= !(a_has_x ^ a_inverted); a_has_page++) {
|
for (hb_bool_t a_has_page = 0; a_has_page <= !(a_has_x ^ a_inverted); a_has_page++) {
|
||||||
for (hb_bool_t b_has_page = 0; b_has_page <= !(b_has_x ^ b_inverted); b_has_page++) {
|
for (hb_bool_t b_has_page = 0; b_has_page <= !(b_has_x ^ b_inverted); b_has_page++) {
|
||||||
for (set_operation op = UNION; op < LAST; op++) {
|
for (hb_bool_t a_is_null = 0; a_is_null <= (!a_has_x && !a_has_page && !a_inverted); a_is_null++) {
|
||||||
all_succeeded = check_set_operations (a_has_x, a_inverted, a_has_page,
|
for (hb_bool_t b_is_null = 0; b_is_null <= (!b_has_x && !b_has_page && !b_inverted); b_is_null++) {
|
||||||
b_has_x, b_inverted, b_has_page,
|
for (set_operation op = UNION; op < LAST; op++) {
|
||||||
op)
|
all_succeeded = check_set_operations (a_has_x, a_inverted, a_has_page, a_is_null,
|
||||||
&& all_succeeded;
|
b_has_x, b_inverted, b_has_page, b_is_null,
|
||||||
|
op)
|
||||||
|
&& all_succeeded;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue