* src/tgba/bddprint.cc (dict): Make this variable static.
(want_prom): New global static variable. (print_handle): Honor want_prom. (print_sat_handler, bdd_print_sat, bdd_format_sat): New functions. (bdd_print_set, bdd_print_dot, bdd_print_table): Set want_prom. * src/tgba/bddprint.hh (bdd_print_sat, bdd_format_sat): New functions. * src/tgbaalgos/save.cc, src/tgbaalgos/save.hh, src/tgbatest/readsave.cc, src/tgbatest/readsave.test: New files. * src/tgbaalgos/Makefile.am (libtgbaalgos_la_SOURCES): Add save.cc and save.hh. * src/tgbatest/Makefile.am (check_PROGRAMS): Add readsave. (readsave_SOURCES): New variable. (TESTS): Add readsave.test.
This commit is contained in:
parent
6884a7f985
commit
19e47ee6e4
10 changed files with 237 additions and 8 deletions
|
|
@ -5,3 +5,4 @@ defs
|
|||
explicit
|
||||
.libs
|
||||
tgbaread
|
||||
readsave
|
||||
|
|
|
|||
|
|
@ -5,14 +5,18 @@ check_SCRIPTS = defs
|
|||
# Keep this sorted alphabetically.
|
||||
check_PROGRAMS = \
|
||||
explicit \
|
||||
readsave \
|
||||
tgbaread
|
||||
|
||||
|
||||
explicit_SOURCES = explicit.cc
|
||||
readsave_SOURCES = readsave.cc
|
||||
tgbaread_SOURCES = tgbaread.cc
|
||||
|
||||
TESTS = \
|
||||
explicit.test \
|
||||
tgbaread.test
|
||||
tgbaread.test \
|
||||
readsave.test
|
||||
|
||||
EXTRA_DIST = $(TESTS)
|
||||
|
||||
|
|
|
|||
50
src/tgbatest/readsave.cc
Normal file
50
src/tgbatest/readsave.cc
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
#include "tgbaparse/public.hh"
|
||||
#include "tgba/tgbaexplicit.hh"
|
||||
#include "tgbaalgos/save.hh"
|
||||
|
||||
void
|
||||
syntax(char* prog)
|
||||
{
|
||||
std::cerr << prog << " [-d] filename" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
int exit_code = 0;
|
||||
|
||||
if (argc < 2)
|
||||
syntax(argv[0]);
|
||||
|
||||
bool debug = false;
|
||||
int filename_index = 1;
|
||||
|
||||
if (!strcmp(argv[1], "-d"))
|
||||
{
|
||||
debug = true;
|
||||
if (argc < 3)
|
||||
syntax(argv[0]);
|
||||
filename_index = 2;
|
||||
}
|
||||
|
||||
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
||||
spot::tgba_parse_error_list pel;
|
||||
spot::tgba_explicit* a = spot::tgba_parse(argv[filename_index],
|
||||
pel, env, debug);
|
||||
|
||||
exit_code =
|
||||
spot::format_tgba_parse_errors(std::cerr, pel);
|
||||
|
||||
if (a)
|
||||
{
|
||||
spot::tgba_save_reachable(std::cout, *a);
|
||||
delete a;
|
||||
}
|
||||
else
|
||||
{
|
||||
exit_code = 1;
|
||||
}
|
||||
return exit_code;
|
||||
}
|
||||
27
src/tgbatest/readsave.test
Executable file
27
src/tgbatest/readsave.test
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
cat >input <<EOF
|
||||
s1, "s2", a!b, c d;
|
||||
"s2", "state 3", a, !c;
|
||||
"state 3", s1,,;
|
||||
EOF
|
||||
|
||||
./readsave input > stdout
|
||||
|
||||
cat >expected <<EOF
|
||||
"s1", "s2", a !b, c d;
|
||||
"s2", "state 3", a, !c;
|
||||
"state 3", "s1", , ;
|
||||
EOF
|
||||
|
||||
diff stdout expected
|
||||
|
||||
mv stdout input
|
||||
./readsave input > stdout
|
||||
diff input stdout
|
||||
|
||||
rm input stdout expected
|
||||
Loading…
Add table
Add a link
Reference in a new issue