print_dot: add xlabel to colored states if too many colors in use

Based on a report from Andreas Tollkötter.

* spot/twaalgos/dot.cc (highlight_states_show_num_): New option,
turned on implicitly when more than 8 colors are used.
* tests/core/highlightstate.test: Test it.
* NEWS: Mention it.
* THANKS: Add Andreas.
This commit is contained in:
Alexandre Duret-Lutz 2018-09-25 13:41:28 +02:00
parent 9490179e27
commit 250e121a60
4 changed files with 102 additions and 1 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2016, 2017 Laboratoire de Recherche et Développement
# Copyright (C) 2016, 2017, 2018 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
#
# This file is part of Spot, a model checking library.
@ -113,3 +113,81 @@ EOF
autfilt aut.hoa --highlight-languages -H1.1 | grep spot.highlight.states >res
diff expected res
cat >input.hoa <<EOF
HOA: v1
name: "Fb & GF((a & Xb) | (!a & X!b))"
States: 5
Start: 0
AP: 2 "b" "a"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
spot.highlight.states: 0 0 1 1 2 0 3 1 4 1
--BODY--
State: 0
[!0&!1] 0
[0] 1
[!0&1] 2
State: 1
[!1] 3
[1] 4
State: 2
[!0&!1] 0 {0}
[!0&1] 2 {0}
[0&!1] 3
[0&1] 4
State: 3
[!0] 1 {1}
[0&!1] 3
[0&1] 4
State: 4
[0] 1 {1}
[!0&!1] 3
[!0&1] 4
--END--
EOF
cat >input2.hoa <<EOF
HOA: v1
name: "Fb & GF((a & Xb) | (!a & X!b))"
States: 5
Start: 0
AP: 2 "b" "a"
acc-name: Rabin 1
Acceptance: 2 Fin(0) & Inf(1)
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
spot.highlight.states: 0 0 1 8 2 0 3 8 4 8 /* 8 instead of 1 */
--BODY--
State: 0
[!0&!1] 0
[0] 1
[!0&1] 2
State: 1
[!1] 3
[1] 4
State: 2
[!0&!1] 0 {0}
[!0&1] 2 {0}
[0&!1] 3
[0&1] 4
State: 3
[!0] 1 {1}
[0&!1] 3
[0&1] 4
State: 4
[0] 1 {1}
[!0&!1] 3
[!0&1] 4
--END--
EOF
autfilt --dot input.hoa > output.dot
grep xlabel output.dot && exit 1
grep forcelabels output.dot && exit 1
autfilt --dot input2.hoa > output2.dot
grep xlabel output2.dot
grep forcelabels output2.dot