python: fix binding of used_inf_fin_sets()

* python/spot/impl.i: Here.
* tests/python/setacc.py: Test it.
* NEWS: Mention the bug.
This commit is contained in:
Alexandre Duret-Lutz 2018-10-31 15:48:39 +01:00
parent 234c9c298f
commit 266581b272
3 changed files with 18 additions and 1 deletions

5
NEWS
View file

@ -75,6 +75,11 @@ New in spot 2.6.3.dev (not yet released)
used to check whether a formula or an automaton represents a used to check whether a formula or an automaton represents a
liveness property. liveness property.
Bugs fixed:
- The pair of acc_cond::mark_t returned by
acc_code::used_inf_fin_sets() was not usable in Python.
New in spot 2.6.3 (2018-10-17) New in spot 2.6.3 (2018-10-17)
Bugs fixed: Bugs fixed:

View file

@ -447,6 +447,7 @@ namespace swig
namespace std { namespace std {
%template(liststr) list<std::string>; %template(liststr) list<std::string>;
%template(pairunsigned) pair<unsigned, unsigned>; %template(pairunsigned) pair<unsigned, unsigned>;
%template(pairmark_t) pair<spot::acc_cond::mark_t, spot::acc_cond::mark_t>;
%template(vectorformula) vector<spot::formula>; %template(vectorformula) vector<spot::formula>;
%template(vectorunsigned) vector<unsigned>; %template(vectorunsigned) vector<unsigned>;
%template(vectorpairunsigned) vector<pair<unsigned, unsigned>>; %template(vectorpairunsigned) vector<pair<unsigned, unsigned>>;

View file

@ -18,10 +18,21 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test case reduced from a report from Juraj Major <major@fi.muni.cz>.
import spot import spot
# Test case reduced from a report from Juraj Major <major@fi.muni.cz>.
a = spot.make_twa_graph(spot._bdd_dict) a = spot.make_twa_graph(spot._bdd_dict)
a.set_acceptance(0, spot.acc_code("t")) a.set_acceptance(0, spot.acc_code("t"))
assert(a.prop_state_acc() == True); assert(a.prop_state_acc() == True);
a.set_acceptance(1, spot.acc_code("Fin(0)")) a.set_acceptance(1, spot.acc_code("Fin(0)"))
assert(a.prop_state_acc() == spot.trival.maybe()); assert(a.prop_state_acc() == spot.trival.maybe());
# Some tests for used_inf_fin_sets(), which return a pair of mark_t.
(inf, fin) = a.get_acceptance().used_inf_fin_sets()
assert inf == []
assert fin == [0]
(inf, fin) = spot.acc_code("(Fin(0)|Inf(1))&Fin(2)&Inf(0)").used_inf_fin_sets()
assert inf == [0,1]
assert fin == [0,2]