improve coverage of LaTeX/utf8 printers for SERE
* bin/common_output.cc, bin/common_output.hh, bin/randltl.cc: Adjust so that running "randltl -S" use the SERE flavor of the spot/latex/utf8 formula printers. * tests/core/latex.test, tests/core/utf8.test, tests/python/ltlparse.py: Add more test cases.
This commit is contained in:
parent
95e3bb815c
commit
7358a26492
7 changed files with 54 additions and 8 deletions
2
NEWS
2
NEWS
|
|
@ -38,6 +38,8 @@ New in spot 2.11.5.dev (not yet released)
|
||||||
- Using --format=... on a tool that output formulas would force
|
- Using --format=... on a tool that output formulas would force
|
||||||
the output on standard output, even when --output was given.
|
the output on standard output, even when --output was given.
|
||||||
|
|
||||||
|
- Using "randltl -S" did not correctly go through the SERE printer
|
||||||
|
functions.
|
||||||
|
|
||||||
New in spot 2.11.5 (2023-04-20)
|
New in spot 2.11.5 (2023-04-20)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ output_format_t output_format = spot_output;
|
||||||
bool full_parenth = false;
|
bool full_parenth = false;
|
||||||
bool escape_csv = false;
|
bool escape_csv = false;
|
||||||
char output_terminator = '\n';
|
char output_terminator = '\n';
|
||||||
|
bool output_ratexp = false;
|
||||||
|
|
||||||
static const argp_option options[] =
|
static const argp_option options[] =
|
||||||
{
|
{
|
||||||
|
|
@ -105,7 +106,10 @@ stream_formula(std::ostream& out,
|
||||||
report_not_ltl(f, filename, linenum, "LBT");
|
report_not_ltl(f, filename, linenum, "LBT");
|
||||||
break;
|
break;
|
||||||
case spot_output:
|
case spot_output:
|
||||||
spot::print_psl(out, f, full_parenth);
|
if (output_ratexp)
|
||||||
|
spot::print_sere(out, f, full_parenth);
|
||||||
|
else
|
||||||
|
spot::print_psl(out, f, full_parenth);
|
||||||
break;
|
break;
|
||||||
case spin_output:
|
case spin_output:
|
||||||
if (f.is_ltl_formula())
|
if (f.is_ltl_formula())
|
||||||
|
|
@ -120,10 +124,16 @@ stream_formula(std::ostream& out,
|
||||||
report_not_ltl(f, filename, linenum, "Wring");
|
report_not_ltl(f, filename, linenum, "Wring");
|
||||||
break;
|
break;
|
||||||
case utf8_output:
|
case utf8_output:
|
||||||
spot::print_utf8_psl(out, f, full_parenth);
|
if (output_ratexp)
|
||||||
|
spot::print_utf8_sere(out, f, full_parenth);
|
||||||
|
else
|
||||||
|
spot::print_utf8_psl(out, f, full_parenth);
|
||||||
break;
|
break;
|
||||||
case latex_output:
|
case latex_output:
|
||||||
spot::print_latex_psl(out, f, full_parenth);
|
if (output_ratexp)
|
||||||
|
spot::print_latex_sere(out, f, full_parenth);
|
||||||
|
else
|
||||||
|
spot::print_latex_psl(out, f, full_parenth);
|
||||||
break;
|
break;
|
||||||
case count_output:
|
case count_output:
|
||||||
case quiet_output:
|
case quiet_output:
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ enum output_format_t { spot_output, spin_output, utf8_output,
|
||||||
extern output_format_t output_format;
|
extern output_format_t output_format;
|
||||||
extern bool full_parenth;
|
extern bool full_parenth;
|
||||||
extern bool escape_csv;
|
extern bool escape_csv;
|
||||||
|
extern bool output_ratexp;
|
||||||
|
|
||||||
#define COMMON_X_OUTPUT_SPECS(where) \
|
#define COMMON_X_OUTPUT_SPECS(where) \
|
||||||
"number of atomic propositions " #where "; " \
|
"number of atomic propositions " #where "; " \
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,7 @@ parse_opt(int key, char* arg, struct argp_state* as)
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
output = spot::randltlgenerator::SERE;
|
output = spot::randltlgenerator::SERE;
|
||||||
|
output_ratexp = true;
|
||||||
break;
|
break;
|
||||||
case OPT_BOOLEAN_PRIORITIES:
|
case OPT_BOOLEAN_PRIORITIES:
|
||||||
opt_pB = arg;
|
opt_pB = arg;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2013, 2015 Laboratoire de Recherche et Développement
|
# Copyright (C) 2013, 2015, 2023 Laboratoire de Recherche et
|
||||||
# de l'Epita (LRDE).
|
# Développement de l'Epita (LRDE).
|
||||||
#
|
#
|
||||||
# This file is part of Spot, a model checking library.
|
# This file is part of Spot, a model checking library.
|
||||||
#
|
#
|
||||||
|
|
@ -50,7 +50,8 @@ cat <<\EOF
|
||||||
EOF
|
EOF
|
||||||
( ltlfilt --latex input --format='\texttt{%F:%L} & $%f$ \\';
|
( ltlfilt --latex input --format='\texttt{%F:%L} & $%f$ \\';
|
||||||
genltl --go-theta=1..3 --latex \
|
genltl --go-theta=1..3 --latex \
|
||||||
--format='\texttt{--%F:%L} & $%f$ \\')
|
--format='\texttt{--%F:%L} & $%f$ \\';
|
||||||
|
randltl -S -n10 --latex 2 --format='\texttt{random %l} & $%f$ \\')
|
||||||
cat <<\EOF
|
cat <<\EOF
|
||||||
\end{tabular}
|
\end{tabular}
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2012, 2013, 2015, 2016, 2019 Laboratoire de Recherche et
|
# Copyright (C) 2012, 2013, 2015, 2016, 2019, 2023 Laboratoire de Recherche et
|
||||||
# Développement de l'Epita (LRDE).
|
# Développement de l'Epita (LRDE).
|
||||||
#
|
#
|
||||||
# This file is part of Spot, a model checking library.
|
# This file is part of Spot, a model checking library.
|
||||||
|
|
@ -70,3 +70,18 @@ ltlfilt -8 -f 'X[!]a' >out
|
||||||
diff in out
|
diff in out
|
||||||
ltlfilt -8 -F in >out
|
ltlfilt -8 -F in >out
|
||||||
diff in out
|
diff in out
|
||||||
|
|
||||||
|
randltl --sere -8 --seed 0 --tree-size 8 a b c -n 10 > formulae
|
||||||
|
cat >expected <<EOF
|
||||||
|
0
|
||||||
|
b:{1 | [*0]}[:*1..3]
|
||||||
|
c̅
|
||||||
|
a | [*0]
|
||||||
|
b[*2..3]
|
||||||
|
1
|
||||||
|
{a∨b}[*][:*]
|
||||||
|
b
|
||||||
|
a
|
||||||
|
[*0]
|
||||||
|
EOF
|
||||||
|
diff formulae expected
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- mode: python; coding: utf-8 -*-
|
# -*- mode: python; coding: utf-8 -*-
|
||||||
# Copyright (C) 2009-2012, 2014-2017, 2019, 2021-2022 Laboratoire de
|
# Copyright (C) 2009-2012, 2014-2017, 2019, 2021-2023 Laboratoire de
|
||||||
# Recherche et Développement de l'Epita (LRDE).
|
# Recherche et Développement de l'Epita (LRDE).
|
||||||
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||||
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
|
|
@ -219,3 +219,19 @@ f = spot.formula_G(2, spot.formula_unbounded(), spot.formula_ap("a"))
|
||||||
tc.assertEqual(f, spot.formula("XXG(a)"))
|
tc.assertEqual(f, spot.formula("XXG(a)"))
|
||||||
f = spot.formula_F(2, spot.formula_unbounded(), spot.formula_ap("a"))
|
f = spot.formula_F(2, spot.formula_unbounded(), spot.formula_ap("a"))
|
||||||
tc.assertEqual(f, spot.formula("XXF(a)"))
|
tc.assertEqual(f, spot.formula("XXF(a)"))
|
||||||
|
|
||||||
|
|
||||||
|
pf = spot.parse_infix_sere('a[->3]')
|
||||||
|
tc.assertEqual(spot.str_sere(pf.f), 'a[->3]')
|
||||||
|
tc.assertEqual(spot.str_latex_sere(pf.f), 'a\\SereGoto{3}')
|
||||||
|
pf = spot.parse_infix_sere('(!b)[*];b;(!b)[*]')
|
||||||
|
tc.assertEqual(spot.str_sere(pf.f), 'b[=1]')
|
||||||
|
pf = spot.parse_infix_sere('b[=1]')
|
||||||
|
tc.assertEqual(spot.str_sere(pf.f), 'b[=1]')
|
||||||
|
tc.assertEqual(spot.str_latex_sere(pf.f), 'b\\SereEqual{1}')
|
||||||
|
tc.assertEqual(spot.str_sclatex_sere(pf.f), 'b^{=1}')
|
||||||
|
pf = spot.parse_infix_sere('(!b)[*];b')
|
||||||
|
tc.assertEqual(spot.str_sere(pf.f), 'b[->]')
|
||||||
|
pf = spot.parse_infix_sere('b[->1]')
|
||||||
|
tc.assertEqual(spot.str_latex_sere(pf.f), 'b\\SereGoto{}')
|
||||||
|
tc.assertEqual(spot.str_sclatex_sere(pf.f), 'b^{\\to}')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue