* src/ltltest/equals.cc (main): Add option -E.
* src/ltltest/parseerr.test: Use `equals -E' instead of `readltl' to check the parsing of erroneous strings without being sensible to the ordering for formulae in memory.
This commit is contained in:
parent
896dc5afec
commit
13870bbaab
3 changed files with 28 additions and 18 deletions
|
|
@ -1,5 +1,10 @@
|
|||
2004-11-28 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
||||
|
||||
* src/ltltest/equals.cc (main): Add option -E.
|
||||
* src/ltltest/parseerr.test: Use `equals -E' instead of `readltl'
|
||||
to check the parsing of erroneous strings without being sensible
|
||||
to the ordering for formulae in memory.
|
||||
|
||||
* src/tgbatest/randtgba.cc (to_float): Use strtod() instead of
|
||||
strtof() to please Solaris 9.
|
||||
|
||||
|
|
|
|||
|
|
@ -34,20 +34,29 @@
|
|||
void
|
||||
syntax(char* prog)
|
||||
{
|
||||
std::cerr << prog << " formula1 formula2" << std::endl;
|
||||
std::cerr << prog << " [-E] formula1 formula2" << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
bool check_first = true;
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-E"))
|
||||
{
|
||||
check_first = false;
|
||||
argv[1] = argv[0];
|
||||
++argv;
|
||||
--argc;
|
||||
}
|
||||
if (argc != 3)
|
||||
syntax(argv[0]);
|
||||
|
||||
spot::ltl::parse_error_list p1;
|
||||
spot::ltl::formula* f1 = spot::ltl::parse(argv[1], p1);
|
||||
|
||||
if (spot::ltl::format_parse_errors(std::cerr, argv[1], p1))
|
||||
if (check_first && spot::ltl::format_parse_errors(std::cerr, argv[1], p1))
|
||||
return 2;
|
||||
|
||||
spot::ltl::parse_error_list p2;
|
||||
|
|
|
|||
|
|
@ -52,25 +52,21 @@ check '+' ''
|
|||
check '/2/3/4/5 a + b /6/7/8/' ''
|
||||
|
||||
# leading and trailing garbage are skipped
|
||||
check 'a U b c' 'binop(U, AP(a), AP(b))'
|
||||
check 'a &&& b' 'multop(And, constant(0), AP(b))'
|
||||
run 0 ./equals -E 'a U b c' 'a U b'
|
||||
run 0 ./equals -E 'a &&& b' '0 && b'
|
||||
# (check multop merging while we are at it)
|
||||
check 'a & b & c & d e' 'multop(And, AP(a), AP(b), AP(c), AP(d))'
|
||||
check 'a & (b | c) & d should work' \
|
||||
'multop(And, AP(a), multop(Or, AP(b), AP(c)), AP(d))'
|
||||
|
||||
run 0 ./equals -E 'a & b & c & d e' 'a & b & c & d'
|
||||
run 0 ./equals -E 'a & (b | c) & d should work' 'a & (b | c) & d'
|
||||
# Binop recovery
|
||||
check 'a U' 'constant(0)'
|
||||
check 'a U b V c R' 'constant(0)'
|
||||
run 0 ./equals -E 'a U' 0
|
||||
run 0 ./equals -E 'a U b V c R' 0
|
||||
|
||||
# Recovery inside parentheses
|
||||
check 'a U (b c) U e R (f g <=> h)' \
|
||||
'binop(R, binop(U, binop(U, AP(a), constant(0)), AP(e)), constant(0))'
|
||||
check 'a U ((c) U e) R (<=> f g)' \
|
||||
'binop(R, binop(U, AP(a), binop(U, AP(c), AP(e))), constant(0))'
|
||||
run 0 ./equals -E 'a U (b c) U e R (f g <=> h)' 'a U (0) U e R (0)'
|
||||
run 0 ./equals -E 'a U ((c) U e) R (<=> f g)' 'a U ((c) U e) R (0)'
|
||||
|
||||
# Missing parentheses
|
||||
check 'a & (a + b' 'multop(And, AP(a), multop(Or, AP(a), AP(b)))'
|
||||
check 'a & (a + b c' 'multop(And, constant(0), AP(a))'
|
||||
check 'a & (+' 'multop(And, constant(0), AP(a))'
|
||||
check 'a & (' 'multop(And, constant(0), AP(a))'
|
||||
run 0 ./equals -E 'a & (a + b' 'a & (a + b)'
|
||||
run 0 ./equals -E 'a & (a + b c' 'a & (0)'
|
||||
run 0 ./equals -E 'a & (+' 'a & (0)'
|
||||
run 0 ./equals -E 'a & (' 'a & (0)'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue