diff --git a/ChangeLog b/ChangeLog index 65b9ce47f..6ea0b8fd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-07-24 Alexandre Duret-Lutz + + * configure.ac: Output iface/gspn/defs. + * iface/gspn/Makefile.am (EXTRA_DIST): Add $(TESTS). + (TESTS, check_SCRIPTS, distclean-local): New. + * iface/gspn/dcswave.test, iface/gspn/simple.test, + iface/gspn/defs.in: New files. + * iface/gspn/dottygspn.cc (main): Take the list of properties + of interest in argument. + 2003-07-23 Alexandre Duret-Lutz * iface/gspn/examples/DCSwave/DCSWave.def, @@ -5,7 +15,7 @@ iface/gspn/examples/DCSwave/DCSWave.tobs, iface/gspn/examples/simple/simple.def, iface/gspn/examples/simple/simple.net, - iface/gspn/examples/simple/simple.tobs: New files, from + iface/gspn/examples/simple/simple.tobs: New files, from Yann Thierry-Mieg. * iface/gspn/Makefile.am (EXTRA_DIST): New variables. diff --git a/configure.ac b/configure.ac index 763ff71a7..3804391af 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ AC_CONFIG_FILES([ doc/Doxyfile iface/Makefile iface/gspn/Makefile + iface/gspn/defs src/Makefile src/ltlenv/Makefile src/ltlast/Makefile diff --git a/iface/gspn/Makefile.am b/iface/gspn/Makefile.am index 80e82e4f1..633eb9d01 100644 --- a/iface/gspn/Makefile.am +++ b/iface/gspn/Makefile.am @@ -22,4 +22,15 @@ EXTRA_DIST = \ examples/DCSwave/DCSWave.tobs \ examples/simple/simple.def \ examples/simple/simple.net \ - examples/simple/simple.tobs \ No newline at end of file + examples/simple/simple.tobs \ + $(TESTS) + +TESTS = \ + simple.test \ + dcswave.test + +# Each test case depends on defs. +check_SCRIPTS = defs + +distclean-local: + -rm -rf testSubDir diff --git a/iface/gspn/dcswave.test b/iface/gspn/dcswave.test new file mode 100755 index 000000000..753b98a13 --- /dev/null +++ b/iface/gspn/dcswave.test @@ -0,0 +1,10 @@ +#! /bin/sh + +. ./defs || exit 1 + +set -e + +cp -R $srcdir/examples/DCSwave . + +# ../dottygspn-rg DCSwave/DCSWave ATTiIDLj SCi SCj >output +../dottygspn-srg DCSwave/DCSWave ATTiIDLj SCi SCj >output diff --git a/iface/gspn/defs.in b/iface/gspn/defs.in new file mode 100644 index 000000000..dc430a71c --- /dev/null +++ b/iface/gspn/defs.in @@ -0,0 +1,54 @@ +# -*- shell-script -*- + +# 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 + +# Always use an absolute srcdir. Otherwise symlinks made in subdirs +# of the test dir just won't work. +case "$srcdir" in + [\\/]* | ?:[\\/]*) + ;; + + *) + srcdir=`CDPATH=: && cd "$srcdir" && pwd` + ;; +esac + +# 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 + +DOT='@DOT@' + + +# Create a test subdirectory. + +chmod -R a+rwx testSubDir > /dev/null 2>&1 +rm -rf testSubDir > /dev/null 2>&1 +mkdir testSubDir +cd testSubDir + +echo "== Running test $0" + +# Turn on shell traces when VERBOSE=x. +if test "x$VERBOSE" = xx; then + set -x +else + : +fi diff --git a/iface/gspn/dottygspn.cc b/iface/gspn/dottygspn.cc index f64077209..f210c42ae 100644 --- a/iface/gspn/dottygspn.cc +++ b/iface/gspn/dottygspn.cc @@ -5,10 +5,21 @@ int main(int argc, char **argv) try { - spot::gspn_interface gspn(argc, argv); - spot::gspn_environment env; - env.declare("obs"); + + if (argc <= 2) + { + std::cerr << "usage: " << argv[0] << " model props..." << std::endl; + exit(1); + } + + while (argc > 2) + { + env.declare(argv[argc - 1]); + --argc; + } + + spot::gspn_interface gspn(2, argv); spot::bdd_dict* dict = new spot::bdd_dict(); diff --git a/iface/gspn/simple.test b/iface/gspn/simple.test new file mode 100755 index 000000000..9514c5cdd --- /dev/null +++ b/iface/gspn/simple.test @@ -0,0 +1,23 @@ +#! /bin/sh + +. ./defs || exit 1 + +set -e + +cp -R $srcdir/examples/simple . + +# Unknown properties should be flagged. +../dottygspn-rg simple/simple unknown && exit 1 + + +../dottygspn-rg simple/simple obs >output +# We expect exactly 1024 states. +grep ' 1024 ' output +grep ' 1025 ' output && exit 1 + + +../dottygspn-srg simple/simple obs >output +# We expect exactly 11 states. +grep ' 11 ' output +grep ' 12 ' output && exit 1 +: