formula: catch min/max overflows at construction
For issue #485. * spot/tl/formula.cc, spot/tl/formula.hh: Catch min/max overflow when the operators are constructed. Also disable travial simplification rules that would create such overflow. For instance x[*200][*2] will not become x[*400] anymore. * python/spot/impl.i: Catch std::overflow_error. * tests/core/equals.test, tests/python/except.py: Add test cases.
This commit is contained in:
parent
59b361babd
commit
afdd38277d
5 changed files with 127 additions and 35 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# -*- mode: python; coding: utf-8 -*-
|
||||
# Copyright (C) 2018-2020 Laboratoire de Recherche et Développement de
|
||||
# Copyright (C) 2018-2021 Laboratoire de Recherche et Développement de
|
||||
# l'Epita (LRDE).
|
||||
#
|
||||
# This file is part of Spot, a model checking library.
|
||||
|
|
@ -245,3 +245,36 @@ except RuntimeError as e:
|
|||
in str(e)
|
||||
else:
|
||||
report_missing_exception()
|
||||
|
||||
|
||||
try:
|
||||
spot.formula_Star(spot.formula("a"), 10, 333)
|
||||
except OverflowError as e:
|
||||
assert "333" in str(e)
|
||||
assert "254" in str(e)
|
||||
else:
|
||||
report_missing_exception()
|
||||
|
||||
try:
|
||||
spot.formula_FStar(spot.formula("a"), 333, 400)
|
||||
except OverflowError as e:
|
||||
assert "333" in str(e)
|
||||
assert "254" in str(e)
|
||||
else:
|
||||
report_missing_exception()
|
||||
|
||||
try:
|
||||
spot.formula_nested_unop_range(spot.op_F, spot.op_Or, 333, 400,
|
||||
spot.formula("a"))
|
||||
except OverflowError as e:
|
||||
assert "333" in str(e)
|
||||
assert "254" in str(e)
|
||||
else:
|
||||
report_missing_exception()
|
||||
|
||||
try:
|
||||
spot.formula_FStar(spot.formula("a"), 50, 40)
|
||||
except OverflowError as e:
|
||||
assert "reversed" in str(e)
|
||||
else:
|
||||
report_missing_exception()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue