parity: add spot::cleanup_parity_acceptance()

Merge the acceptance sets of a parity acceptance with the same priority
level to simplify this acceptance.

* spot/twaalgos/parity.cc, spot/twaalgos/parity.hh: Here
* tests/core/parity.cc: Add tests for spot::cleanup_parity_acceptance()
This commit is contained in:
Laurent XU 2017-02-15 00:16:35 +01:00
parent 0bf0a99d6d
commit 3e650f18d9
3 changed files with 123 additions and 1 deletions

View file

@ -365,6 +365,21 @@ int main()
is_max, is_odd, acc_num_sets)
&& "change_parity: wrong acceptance.");
}
// Check cleanup_parity
for (auto keep_style: { true, false })
{
auto output = spot::cleanup_parity(aut, keep_style);
assert(is_almost_colored(output)
&& "cleanup_parity: too many acc on a transition.");
assert(are_equiv(aut, output)
&& "cleanup_parity: not equivalent.");
auto target_kind = to_parity_kind(is_max);
auto target_style = keep_style ? to_parity_style(is_odd)
: spot::parity_style_any;
assert(is_right_parity(output, target_kind, target_style,
is_max, is_odd, acc_num_sets)
&& "cleanup_parity: wrong acceptance.");
}
}
}
return 0;