Add a new length_boolone() function to fix an assert in randpsl.
* src/ltlvisit/length.hh (length_boolone): New function.
* src/ltlvisit/length.cc (length_boolone): Implement it using...
(length_boolone_visitor): ... this new visitor.
* src/ltltest/randltl.cc: Use length_boolone() to check the result
of the random generator, and ignore any formula larger (in
length()) than opt_f. This fix a bug where the random formula
generator would sometime produce formula larger than requested,
because of the trivial rewriting of {f}[]->e as e|!f.
* src/ltltest/length.cc: Add option -b to call length_boolone().
* src/ltltest/length.test: Test length_boolone().
This commit is contained in:
parent
c2ab4e781b
commit
ed0dd0b48d
5 changed files with 90 additions and 10 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include "ltlparse/public.hh"
|
||||
#include "ltlvisit/length.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
|
@ -35,16 +36,26 @@ syntax(char *prog)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
if (argc < 2 || argc > 3)
|
||||
syntax(argv[0]);
|
||||
|
||||
bool boolone = false;
|
||||
if (!strcmp(argv[1], "-b"))
|
||||
{
|
||||
boolone = true;
|
||||
++argv;
|
||||
}
|
||||
|
||||
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))
|
||||
return 2;
|
||||
|
||||
std::cout << spot::ltl::length(f1) << std::endl;
|
||||
if (boolone)
|
||||
std::cout << spot::ltl::length_boolone(f1) << std::endl;
|
||||
else
|
||||
std::cout << spot::ltl::length(f1) << std::endl;
|
||||
|
||||
f1->destroy();
|
||||
assert(spot::ltl::atomic_prop::instance_count() == 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue