From cbb981ffd500a8779c0c147bd6a3a264b72c29c7 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 8 Sep 2023 12:02:42 +0200 Subject: [PATCH] python: add bindings for set of unsigned int Requested by Marek Jankola. * python/spot/impl.i: Add bindings for std::set. * tests/python/powerset.py: New file. * tests/Makefile.am: Add it. * THANKS: Add Marek. --- THANKS | 1 + python/spot/impl.i | 1 + tests/Makefile.am | 1 + tests/python/powerset.py | 31 +++++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 tests/python/powerset.py diff --git a/THANKS b/THANKS index 25fac900b..ae3a37f8c 100644 --- a/THANKS +++ b/THANKS @@ -38,6 +38,7 @@ Juan Tzintzun Juraj Major Kristin Y. Rozier Marc Espie +Marek Jankola Martin Dieguez Lodeiro Matthias Heizmann Maxime Bouton diff --git a/python/spot/impl.i b/python/spot/impl.i index f95270e21..cb9318a1e 100644 --- a/python/spot/impl.i +++ b/python/spot/impl.i @@ -523,6 +523,7 @@ namespace std { %template(vectorint) vector; %template(pair_formula_vectorstring) pair>; %template(atomic_prop_set) set; + %template(setunsigned) set; %template(relabeling_map) map; } diff --git a/tests/Makefile.am b/tests/Makefile.am index 7e8a42347..db70e8810 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -441,6 +441,7 @@ TESTS_python = \ python/_partitioned_relabel.ipynb \ python/parity.py \ python/pdegen.py \ + python/powerset.py \ python/prodexpt.py \ python/_product_weak.ipynb \ python/_product_susp.ipynb \ diff --git a/tests/python/powerset.py b/tests/python/powerset.py new file mode 100644 index 000000000..91575c263 --- /dev/null +++ b/tests/python/powerset.py @@ -0,0 +1,31 @@ +# -*- mode: python; coding: utf-8 -*- +# Copyright (C) 2023 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 +import spot.gen as gen +from unittest import TestCase +tc = TestCase() + +# Make sure we can iterate on the states of a power_map. +a = gen.aut_pattern(gen.AUT_CYCLIST_TRACE_NBA, 1) +p = spot.power_map() +d = spot.tgba_powerset(a, p) +tc.assertEqual(p.states_of(0), (0,)) +tc.assertEqual(p.states_of(1), (0,1)) +tc.assertEqual(p.states_of(2), (0,2))