Preliminary support for Event-based GBA.

* src/evtgba/Makefile.am, src/evtgba/evtgba.cc,
src/evtgba/evtgba.hh, src/evtgba/evtgbaiter.hh,
src/evtgba/explicit.cc, src/evtgba/explicit.hh,
src/evtgba/product.cc, src/evtgba/product.hh,
src/evtgba/symbol.cc, src/evtgba/symbol.hh,
src/evtgbaalgos/Makefile.am, src/evtgbaalgos/dotty.cc,
src/evtgbaalgos/dotty.hh, src/evtgbaalgos/reachiter.cc,
src/evtgbaalgos/reachiter.hh, src/evtgbaalgos/save.cc,
src/evtgbaalgos/save.hh, src/evtgbaparse/Makefile.am,
src/evtgbaparse/evtgbaparse.yy, src/evtgbaparse/evtgbascan.ll,
src/evtgbaparse/fmterror.cc, src/evtgbaparse/parsedecl.hh,
src/evtgbaparse/public.hh, src/evtgbatest/Makefile.am,
src/evtgbatest/defs.in, src/evtgbatest/explicit.cc,
src/evtgbatest/explicit.test, src/evtgbatest/product.cc,
src/evtgbatest/product.test, src/evtgbatest/readsave.cc,
src/evtgbatest/readsave.test: New files.
* configure.ac: Create the Makefiles in these new subdirectories.
* src/Makefile.am: Recurse them.
This commit is contained in:
Alexandre Duret-Lutz 2004-10-22 16:22:31 +00:00
parent d9b29a0590
commit 73ff928b6f
38 changed files with 3067 additions and 3 deletions

10
src/evtgbatest/.cvsignore Normal file
View file

@ -0,0 +1,10 @@
.deps
Makefile
Makefile.in
defs
explicit
.libs
readsave
product
*.ps
*.dot

View file

@ -0,0 +1,45 @@
## Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
## département Systèmes Répartis Coopératifs (SRC), Université Pierre
## et Marie Curie.
##
## This file is part of Spot, a model checking library.
##
## Spot is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## Spot is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
## License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Spot; see the file COPYING. If not, write to the Free
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
AM_CPPFLAGS = -I$(srcdir)/.. $(BUDDY_CPPFLAGS)
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
LDADD = ../libspot.la
check_SCRIPTS = defs
# Keep this sorted alphabetically.
check_PROGRAMS = \
explicit \
product \
readsave
# Keep this sorted alphabetically.
explicit_SOURCES = explicit.cc
product_SOURCES = product.cc
readsave_SOURCES = readsave.cc
# Keep this sorted by STRENGTH. Test basic things first,
# because such failures will be easier to diagnose and fix.
TESTS = \
explicit.test \
readsave.test \
product.test
EXTRA_DIST = $(TESTS)

79
src/evtgbatest/defs.in Normal file
View file

@ -0,0 +1,79 @@
# -*- shell-script -*-
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Spot is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Spot; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# Ensure we are running from the right directory.
test -f ./defs || {
echo "defs: not found in current directory" 1>&2
exit 1
}
# If srcdir is not set, then we are not running from `make check', be verbose.
if test -z "$srcdir"; then
test -z "$VERBOSE" && VERBOSE=x
# compute $srcdir.
srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
test $srcdir = $0 && srcdir=.
fi
# Ensure $srcdir is set correctly.
test -f $srcdir/defs.in || {
echo "$srcdir/defs.in not found, check \$srcdir" 1>&2
exit 1
}
# User can set VERBOSE to see all output.
test -z "$VERBOSE" && exec >/dev/null 2>&1
echo "== Running test $0"
DOT='@DOT@'
top_builddir='@top_builddir@'
LBTT="@LBTT@"
LBTT_TRANSLATE="@LBTT_TRANSLATE@"
VALGRIND='@VALGRIND@'
run()
{
expected_exitcode=$1
shift
exitcode=0
if test -n "$VALGRIND"; then
exec 6>valgrind.err
GLIBCPP_FORCE_NEW=1 \
../../libtool --mode=execute \
$VALGRIND --tool=memcheck --leak-check=yes --logfile-fd=6 -q "$@" ||
exitcode=$?
cat valgrind.err 1>&2
test -z "`sed 1q valgrind.err`" || exit 50
rm -f valgrind.err
else
"$@" || exitcode=$?
fi
test $exitcode = $expected_exitcode || exit 1
}
# Turn on shell traces when VERBOSE=x.
if test "x$VERBOSE" = xx; then
set -x
else
:
fi

View file

@ -0,0 +1,58 @@
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#include <iostream>
#include <cassert>
#include "evtgba/explicit.hh"
#include "evtgbaalgos/dotty.hh"
int
main()
{
{
const spot::rsymbol a1("a1");
const spot::rsymbol a2("a2");
const spot::rsymbol a3("a3");
{
spot::rsymbol_set s1;
spot::rsymbol_set s2;
s2.insert(a1);
spot::rsymbol_set s3;
s3.insert(a3);
s3.insert(a2);
spot::evtgba_explicit* a = new spot::evtgba_explicit();
a->add_transition("state 0", "e1", s1, "state 1");
a->add_transition("state 1", "e2", s2, "state 2");
a->add_transition("state 2", "e3", s3, "state 1");
a->set_init_state("state 0");
a->set_init_state("state 2");
spot::dotty_reachable(std::cout, a);
delete a;
}
}
spot::symbol::dump_instances(std::cout);
}

49
src/evtgbatest/explicit.test Executable file
View file

@ -0,0 +1,49 @@
#!/bin/sh
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Spot is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Spot; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./defs
set -e
run 0 ./explicit > stdout
perl -pi -e 's/a3, a2/a2, a3/;' stdout
cat >expected <<\EOF
digraph G {
"*1" [label="", style=invis, height=0]
"*1" -> 1
"*2" [label="", style=invis, height=0]
"*2" -> 2
1 [label="state 0"]
1 -> 3 [label="e1\n"]
2 [label="state 2"]
2 -> 3 [label="e3\n{a2, a3}"]
3 [label="state 1"]
3 -> 2 [label="e2\n{a1}"]
}
EOF
diff stdout expected
rm stdout expected

99
src/evtgbatest/product.cc Normal file
View file

@ -0,0 +1,99 @@
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#include <iostream>
#include <cassert>
#include "evtgbaparse/public.hh"
#include "evtgbaalgos/save.hh"
#include "evtgbaalgos/dotty.hh"
#include "evtgba/product.hh"
void
syntax(char* prog)
{
std::cerr << prog << " [-d] [-D] filenames..." << std::endl;
exit(2);
}
int
main(int argc, char** argv)
{
int exit_code = 0;
if (argc < 2)
syntax(argv[0]);
bool debug = false;
bool dotty = false;
int filename_index = 1;
while (argv[filename_index][0] == '-' && filename_index < argc)
{
if (!strcmp(argv[filename_index], "-d"))
debug = true;
else if (!strcmp(argv[filename_index], "-D"))
dotty = true;
else
syntax(argv[0]);
++filename_index;
}
if (filename_index == argc)
syntax(argv[0]);
spot::evtgba_product::evtgba_product_operands op;
while (filename_index < argc)
{
spot::evtgba_parse_error_list pel;
spot::evtgba_explicit* a = spot::evtgba_parse(argv[filename_index],
pel, debug);
exit_code = spot::format_evtgba_parse_errors(std::cerr, pel);
if (a)
{
op.push_back(a);
}
else
{
exit_code = 1;
}
++filename_index;
}
if (op.empty())
return exit_code;
spot::evtgba_product p(op);
if (dotty)
spot::dotty_reachable(std::cout, &p);
else
spot::evtgba_save_reachable(std::cout, &p);
for (spot::evtgba_product::evtgba_product_operands::iterator i = op.begin();
i != op.end(); ++i)
delete *i;
return exit_code;
}

69
src/evtgbatest/product.test Executable file
View file

@ -0,0 +1,69 @@
#!/bin/sh
# Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Spot is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Spot; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./defs
set -e
cat >input1 <<\EOF
acc = ;
init = s1;
s1, s2, a, ;
s2, s1, d, ;
EOF
cat >input2 <<\EOF
acc = Acc3 ;
init = t1;
t1, t2, a, ;
t2, t3, b, ;
t3, t1, c, Acc2;
EOF
cat >input3 <<\EOF
acc = Acc1 Acc2 ;
init = u1 u2;
u1, u2, c, Acc1;
u2, u1, b, Acc2;
EOF
run 0 ./product input1 input2 input3 >stdout
perl -pi -e 's/Acc2 Acc1/Acc1 Acc2/g;' stdout
cat >expected <<\EOF
acc = Acc3 Acc1 Acc2;
init = "<s1, t1, u1>" "<s1, t1, u2>";
"<s1, t1, u1>", "<s2, t2, u1>", a,;
"<s1, t1, u2>", "<s2, t2, u2>", a,;
"<s2, t2, u1>", "<s1, t2, u1>", d,;
"<s2, t2, u2>", "<s2, t3, u1>", b, Acc2;
"<s2, t2, u2>", "<s1, t2, u2>", d,;
"<s2, t3, u1>", "<s2, t1, u2>", c, Acc1 Acc2;
"<s2, t3, u1>", "<s1, t3, u1>", d,;
"<s1, t2, u2>", "<s1, t3, u1>", b, Acc2;
"<s2, t1, u2>", "<s1, t1, u2>", d,;
"<s1, t3, u1>", "<s1, t1, u2>", c, Acc1 Acc2;
EOF
diff stdout expected

View file

@ -0,0 +1,70 @@
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#include <iostream>
#include <cassert>
#include "evtgbaparse/public.hh"
#include "evtgbaalgos/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::evtgba_parse_error_list pel;
spot::evtgba_explicit* a = spot::evtgba_parse(argv[filename_index],
pel, debug);
exit_code = spot::format_evtgba_parse_errors(std::cerr, pel);
if (a)
{
spot::evtgba_save_reachable(std::cout, a);
delete a;
}
else
{
exit_code = 1;
}
return exit_code;
}

59
src/evtgbatest/readsave.test Executable file
View file

@ -0,0 +1,59 @@
#!/bin/sh
# Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Spot is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Spot; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./defs
set -e
cat >input <<\EOF
acc = d;
init = s1;
s1, "s2", e1, c;
"s2", "state 3", "\"he\\llo\"", c;
"state 3", "s1",e4,;
EOF
./readsave input > stdout
cat >expected <<\EOF
acc = c d;
init = s1;
s1, s2, e1, c;
s2, "state 3", "\"he\\llo\"", c;
"state 3", s1, e4,;
EOF
# Sort out some possible inversions in the output.
# (The order is not guaranteed by SPOT.)
sed 's/d c/c d/g' stdout > tmp_ && mv tmp_ stdout
diff stdout expected
mv stdout input
run 0 ./readsave input > stdout
sed 's/d c/c d/g' stdout > tmp_ && mv tmp_ stdout
diff input stdout
rm input stdout expected