parity: fix error handling

* spot/twaalgos/parity.cc: Do not throw a pointer to an exception,
throw the exception directly.  Factor all the throwing code in a
function.
* tests/python/parity.py: Add test case.
This commit is contained in:
Alexandre Duret-Lutz 2018-01-02 17:43:57 +01:00
parent 288ea95658
commit 0aca26e3f9
2 changed files with 19 additions and 7 deletions

View file

@ -29,3 +29,10 @@ for f in ('FGa', 'GFa & GFb & FGc', 'XXX(a U b)'):
a3 = spot.translate(f, 'det').postprocess('parity')
assert a3.acc().is_parity()
a = spot.translate('GFa & GFb')
try:
spot.change_parity_here(a, spot.parity_kind_same, spot.parity_style_even)
except RuntimeError as e:
assert 'input should have parity acceptance' in str(e)
else:
exit(2)