Check trivial multop equality at build time. The makes the

equal visitor useless, since two equals formulae will now
share the same address.

* src/ltlast/multop.hh (add_sorted): New function.
(paircmp): New comparison functor.
(map): Use paircmp, we want to compare the vectors' contents,
not their addresses.
* src/ltlast/multop.cc (add_sorted): New function.
(add): Use it.
* src/ltltest/equals.cc, src/ltltest/tostring.cc: Compare
pointers instead of calling equal.
* src/ltlvisit/equals.cc, src/ltlvisit/equals.hh: Delete.
* src/ltlvisit/Makefile.am (libltlvisit_la_SOURCES): Remove
equals.cc and equals.hh.
* wrap/spot.i: Do not include equals.hh.
This commit is contained in:
Alexandre Duret-Lutz 2003-05-16 07:39:41 +00:00
parent 9123e56ff9
commit 1cdfea31b0
10 changed files with 65 additions and 197 deletions

View file

@ -1,6 +1,5 @@
#include <iostream>
#include "ltlparse/public.hh"
#include "ltlvisit/equals.hh"
#include "ltlvisit/lunabbrev.hh"
#include "ltlvisit/tunabbrev.hh"
#include "ltlvisit/dump.hh"
@ -62,12 +61,10 @@ main(int argc, char** argv)
std::cout << std::endl;
#endif
int exit_code = !equals(f1, f2);
int exit_code = f1 != f2;
spot::ltl::destroy(f1);
std::cout << spot::ltl::atomic_prop::instance_count() << std::endl;
spot::ltl::destroy(f2);
std::cout << spot::ltl::atomic_prop::instance_count() << std::endl;
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);

View file

@ -41,6 +41,7 @@ for f in \
'()b' \
'long_atomic_proposition_1 U long_atomic_proposition_2' \
' ab & ac | ad ^ af' \
'((b * a) + a) & d' \
'(ab & ac | ad ) <=> af ' \
'a U b U c U d U e U f U g U h U i U j U k U l U m' \
'(ab * !Xad + ad U ab) & FG p12 & GF p13' \
@ -55,7 +56,7 @@ do
fi
if test -n "$DOT"; then
./ltl2dot "$f" > parse.dot
./ltl2dot "$f" > parse.dot
if $DOT -o /dev/null parse.dot; then
rm -f parse.dot
else

View file

@ -1,7 +1,6 @@
#include <iostream>
#include "ltlparse/public.hh"
#include "ltlvisit/tostring.hh"
#include "ltlvisit/equals.hh"
#include "ltlvisit/destroy.hh"
#include "ltlast/allnodes.hh"
@ -37,7 +36,7 @@ main(int argc, char **argv)
// This second abstract tree should be equal to the first.
if (! equals(f1, f2))
if (f1 != f2)
return 1;
// It should also map to the same string.