forq: make it easier to select contains's version

* spot/twaalgos/contains.hh, spot/twaalgos/contains.cc
(containment_select_version): New function.
(contains): Use it.
* spot/twa/twa.cc (exclusive_word): Likewise.
* bin/autfilt.cc (--included-in): Adjust to use forq depending
on containement_select_version.
* bin/man/spot-x.x: Adjust documentation of
CONTAINMENT_SELECT_VERSION.
* tests/core/included.test, tests/python/forq_contains.py: Add more
tests.
* NEWS: Mention the new feature.
This commit is contained in:
Alexandre Duret-Lutz 2023-09-07 17:36:09 +02:00
parent ca4e6c4b48
commit 05d7622f8f
8 changed files with 178 additions and 83 deletions

View file

@ -324,3 +324,28 @@ State: 11 {0}
--END--""")
do_symmetric_test(subset, superset)
tba = spot.translate('GFa')
tgba = spot.translate('GFa & GFb')
tc.assertTrue(spot.contains(tba, tgba))
try:
spot.containment_select_version("fork")
except RuntimeError as e:
tc.assertIn("forq", str(e))
else:
raise RuntimeError("missing exception")
spot.containment_select_version("forq")
tc.assertTrue(spot.contains(tba, tgba)) # does not call contains_forq
try:
spot.contains_forq(tba, tgba) # because contains_forq wants Büchi
except RuntimeError as e:
tc.assertIn("Büchi", str(e))
else:
raise RuntimeError("missing exception")
# This shows that exclusive word also depend on
# containment_select_version()
tc.assertEqual(str(one.exclusive_word(both)), "!a & !b; cycle{a}")
spot.containment_select_version("default")
tc.assertEqual(str(one.exclusive_word(both)), "cycle{a}")