* src/ltlvisit/tunabbrev.cc, src/ltlvisit/tunabbrev.hh: New files.

* src/ltlvisit/Makefile.am (libltlvisit_a_SOURCES): Add them.
* src/ltltest/tunabbrev.test: New file.
* src/ltltest/lunabbrev.test: Fix comment.
* src/ltltest/Makefile.am (TESTS): Add tunabbrev.test.
(check_PROGRAMS): Add tunabbrev.
(tunabbrev_SOURCES, tunabbrev_CPPFLAGS): New variables.
* src/ltltest/equals.cc (main) [TUNABBREV]: Call unabbreviate_ltl.
* src/ltlvisit/lunabbrev.hh (unabbreviate_logic_visitor::recurse):
New virtual function.
* src/ltlvisit/lunabbrev.cc (unabbreviate_logic_visitor::recurse):
Likewise.
(unabbreviate_logic_visitor::visit): Use it instead of calling
unabbreviate_logic directly.
This commit is contained in:
Alexandre Duret-Lutz 2003-04-16 16:10:58 +00:00
parent fc3ceebd4f
commit 080214ebb8
11 changed files with 160 additions and 9 deletions

View file

@ -9,3 +9,4 @@ expect
defs
equals
lunabbrev
tunabbrev

View file

@ -4,15 +4,17 @@ LDADD = ../ltlparse/libltlparse.a \
../ltlast/libltlast.a
check_SCRIPTS = defs
check_PROGRAMS = ltl2dot ltl2text equals lunabbrev
check_PROGRAMS = ltl2dot ltl2text equals lunabbrev tunabbrev
ltl2dot_SOURCES = readltl.cc
ltl2dot_CPPFLAGS = $(AM_CPPFLAGS) -DDOTTY
ltl2text_SOURCES = readltl.cc
equals_SOURCES = equals.cc
lunabbrev_SOURCES = equals.cc
lunabbrev_CPPFLAGS = $(AM_CPPFLAGS) -DLUNABBREV
tunabbrev_SOURCES = equals.cc
tunabbrev_CPPFLAGS = $(AM_CPPFLAGS) -DTUNABBREV
EXTRA_DIST = $(TESTS)
TESTS = parse.test parseerr.test equals.test lunabbrev.test
TESTS = parse.test parseerr.test equals.test lunabbrev.test tunabbrev.test
CLEANFILES = stdout expect parse.dot

View file

@ -2,6 +2,7 @@
#include "ltlparse/public.hh"
#include "ltlvisit/equals.hh"
#include "ltlvisit/lunabbrev.hh"
#include "ltlvisit/tunabbrev.hh"
#include "ltlvisit/dump.hh"
void
@ -34,6 +35,10 @@ main(int argc, char **argv)
f1 = spot::ltl::unabbreviate_logic(f1);
spot::ltl::dump(*f1, std::cout);
#endif
#ifdef TUNABBREV
f1 = spot::ltl::unabbreviate_ltl(f1);
spot::ltl::dump(*f1, std::cout);
#endif
if (equals(f1, f2))
return 0;

View file

@ -1,6 +1,6 @@
#! /bin/sh
# Check for the equals visitor
# Check for the unabbreviate_logic visitor
. ./defs || exit 1

39
src/ltltest/tunabbrev.test Executable file
View file

@ -0,0 +1,39 @@
#! /bin/sh
# Check for the unabbreviate_ltl visitor
. ./defs || exit 1
check()
{
./tunabbrev "$1" "$2" || exit 1
}
# A few things that do not change
check 'a' 'a'
check '1' '1'
check '0' '0'
check 'a U b' 'a U b'
check 'a & b' 'a & b'
check 'a & b' 'b & a'
check 'a & b & c' 'c & a & b'
check 'a & b & c' 'b & c & a'
check 'a & b & a' 'b & a & b'
check 'a & b' 'b & a & b'
check 'a & b' 'b & a & a'
check 'a & b & (c |(f U g)| e)' 'b & a & a & (c | e |(f U g)| e | c) & b'
# same as in lunabbrev.test:
check 'a ^ b' '(a & !b) | (!a & b)'
check 'a ^ Xb' '(!Xb & a) | (!a & Xb) | (Xb & !a)'
check '!a <-> Xb' '(Xb & !a) | (!!a & !Xb)'
check '(a ^ b) | (b ^ c)' '(c & !b) | (!c & b) | (a & !b) | (!a & b)'
# LTL unabbreviations:
check 'G a ' 'false R a'
check 'GF a => F G(b)' '!(false R (true U a)) | (true U (false V b))'
check 'GGGGa' 'false V (false V (false V (false V a)))'
check 'FFFfalse' 'true U ((true) U (true U (false)))'
# Success.
: