hoa: do not output empty highlighting maps

* spot/twaalgos/hoa.cc: Here.
* tests/python/parsetgba.py: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2023-11-23 20:37:25 +01:00
parent 55575a11e3
commit 738d62e0b9
2 changed files with 27 additions and 2 deletions

View file

@ -762,7 +762,8 @@ namespace spot
if (v1_1)
{
if (auto hstates = aut->get_named_prop
<std::map<unsigned, unsigned>>("highlight-states"))
<std::map<unsigned, unsigned>>("highlight-states");
hstates && !hstates->empty())
{
os << "spot.highlight.states:";
for (auto& p: *hstates)
@ -770,7 +771,8 @@ namespace spot
os << nl;
}
if (auto hedges = aut->get_named_prop
<std::map<unsigned, unsigned>>("highlight-edges"))
<std::map<unsigned, unsigned>>("highlight-edges");
hedges && !hedges->empty())
{
// Numbering edges is a delicate process. The
// "highlight-edges" property uses edges numbers that are

View file

@ -123,3 +123,26 @@ State: 4 {0}
[1] 4
[2] 4
--END--""")
a3.highlight_edges([5, 6], None)
tc.assertEqual(a3.to_str("hoa", "1.1"), """HOA: v1.1
States: 5
Start: 0
AP: 3 "a" "b" "c"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc !complete
properties: !deterministic exist-branch
--BODY--
State: 0
[0] 1
[0] 2
State: 1
[0] 3
State: 2
[0] 4
State: 3 {0}
[0] 3
State: 4 {0}
[1] 4
[2] 4
--END--""")