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,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2009, 2010, 2011, 2012, 2014, 2015 Laboratoire de Recherche et
|
||||
# Copyright (C) 2009-2012, 2014-2015, 2021 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -142,6 +142,7 @@ G({1}<>->1), 1
|
|||
{z;a*;b*;*;c;d;*;b*;e;a*;*;b*}, {z;[*];c;d;[*];e;[*]}
|
||||
{((a;b)|[*0]);[*];c}!, {[*];c}!
|
||||
{a;a;a*;a;b;b[*];c[*2:3];c[*4:5]}, {a[*3..];b[+];c[*6..8]}
|
||||
{a;a[*200];a[*..60];a;b[*..100][*..2]}, {a[*201];a[*1..61];b[*..200]}
|
||||
|
||||
{a[*0]}, {[*0]}
|
||||
{a[*..]}, {a[*]}
|
||||
|
|
|
|||
|
|
@ -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