From 2ecd93ace886e86bb3cf83bc2d1e660ebbac87fc Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 17 Jul 2017 14:20:45 +0200 Subject: [PATCH] python: export the sbacc() algorithm Fixes #274. * python/spot/impl.i: Bind sbacc(). * tests/python/sbacc.py: New tesat. * tests/Makefile.am: Add sbacc.py. --- python/spot/impl.i | 2 ++ tests/Makefile.am | 1 + tests/python/sbacc.py | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 tests/python/sbacc.py diff --git a/python/spot/impl.i b/python/spot/impl.i index a4b0abe50..956ec8fb7 100644 --- a/python/spot/impl.i +++ b/python/spot/impl.i @@ -137,6 +137,7 @@ #include #include #include +#include #include #include #include @@ -554,6 +555,7 @@ def state_is_accepting(self, src) -> "bool": %include %include %include +%include %traits_swigtype(spot::scc_info_node); %fragment(SWIG_Traits_frag(spot::scc_info_node)); %nodefaultctor spot::internal::scc_edges; diff --git a/tests/Makefile.am b/tests/Makefile.am index 739675455..c7439289d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -360,6 +360,7 @@ TESTS_python = \ python/relabel.py \ python/remfin.py \ python/satmin.py \ + python/sbacc.py \ python/sccfilter.py \ python/sccinfo.py \ python/setacc.py \ diff --git a/tests/python/sbacc.py b/tests/python/sbacc.py new file mode 100644 index 000000000..62fdd4171 --- /dev/null +++ b/tests/python/sbacc.py @@ -0,0 +1,26 @@ +# -*- mode: python; coding: utf-8 -*- +# Copyright (C) 2017 Laboratoire de Recherche et Développement de l'Epita +# (LRDE). +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import spot +aut = spot.translate('GFa') +assert aut.num_states() == 1 +assert not aut.prop_state_acc().is_true() +aut = spot.sbacc(aut) +assert aut.num_states() == 2 +assert aut.prop_state_acc().is_true()