gen: rename genltl() to ltl_pattern() and introduce ltl_patterns()

* spot/gen/formulas.hh, spot/gen/formulas.cc (genltl): Rename as...
(ltl_pattern): This.
(ltl_pattern_max): New function.
* bin/genltl.cc: Adjust names, and simplify using ltl_pattern_max().
* python/spot/gen.i (ltl_patterns): New function.
* tests/python/gen.py: Test it.
* tests/python/gen.ipynb: New file to document the spot.gen package.
* tests/Makefile.am, doc/org/tut.org: Add gen.ipynb.
This commit is contained in:
Alexandre Duret-Lutz 2017-04-26 14:32:01 +02:00
parent 2dc115fe2c
commit 540b971355
8 changed files with 640 additions and 55 deletions

View file

@ -38,21 +38,25 @@ except RuntimeError as e:
else:
exit(2)
f = gen.genltl(gen.AND_F, 3)
f = gen.ltl_pattern(gen.AND_F, 3)
assert f.size() == 3
assert gen.ltl_pattern_name(gen.AND_F) == "and-f"
try:
gen.genltl(1000, 3)
gen.ltl_pattern(1000, 3)
except RuntimeError as e:
assert 'unsupported pattern' in str(e)
else:
exit(2)
try:
gen.genltl(gen.OR_G, -10)
gen.ltl_pattern(gen.OR_G, -10)
except RuntimeError as e:
assert 'or-g' in str(e)
assert 'positive' in str(e)
else:
exit(2)
assert 40 == sum(p.size() for p in gen.ltl_patterns((gen.OR_G, 1, 5),
(gen.GH_Q, 3),
gen.EH_PATTERNS))