fix and check shifting issue

The exception raised by << and >> when shifting mark_t by too many
bits are only enabled in SPOT_DEBUG, as those operations are quite
low-level.  However we were always testing them, and although we
wanted them to be active in Python, it was not always the case.

* spot/twa/acc.hh: introduce max_accsets() as
a static constexpr method, so we can see it in Python.
* spot/misc/bitset.hh: Fix preprocessing directive
so the check is actually enabled when compiling the Python
bindings.
* bin/autcross.cc, bin/autfilt.cc, bin/ltlcross.cc: Use max_accsets().
* tests/core/acc.cc: Comment out the shifting exception when
SPOT_DEBUG is unset.
* tests/python/except.py: Make sure the exception is always raised in
Python.
This commit is contained in:
Alexandre Duret-Lutz 2018-05-25 11:29:59 +02:00
parent 23e0d718fd
commit b12eb0508f
7 changed files with 75 additions and 38 deletions

View file

@ -129,3 +129,13 @@ except RuntimeError as e:
assert "safety" in str(e)
else:
report_missing_exception()
n = spot.mark_t.max_accsets()
m = spot.mark_t([n - 1])
try:
m = spot.mark_t([0]) << n
except RuntimeError as e:
assert "Too many acceptance sets" in str(e)
else:
print(n, m)
report_missing_exception()