Fix computation of length of LTL formulas.

* src/ltlvisit/length.cc: Fix computation for ltl::multop
operator. "a&b&c" was reported with length 3, ignoring the
"&" operators, because of a typo.
* src/ltlvisit/length.hh: Fix description to correctly
reflect this change intended since 2010-01-22.
* src/ltltest/length.test, src/ltltest/length.cc: New files.
* src/ltltest/Makefile.am: Add them.
This commit is contained in:
Alexandre Duret-Lutz 2012-01-05 18:34:23 +01:00
parent 93f1009b75
commit 984c715cc6
7 changed files with 111 additions and 8 deletions

View file

@ -53,7 +53,7 @@ namespace spot
mo->nth(i)->accept(*this);
// "a & b & c" should count for 5, even though it is
// stored as And(a,b,c).
mo += s - 1;
result_ += s - 1;
}
virtual void

View file

@ -1,3 +1,5 @@
// Copyright (C) 2012 Laboratoire de Recherche et Developement de
// l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
@ -33,10 +35,10 @@ namespace spot
///
/// The length of a formula is the number of atomic properties,
/// constants, and operators (logical and temporal) occurring in
/// the formula. spot::ltl::multops count only for 1, even if
/// they have more than two operands (e.g. <code>a | b | c</code>
/// has length 4, because <code>|</code> is represented once
/// internally).
/// the formula. spot::ltl::multop instances with n arguments
/// count only n-1; for instance <code>a | b | c</code>
/// has length 5, even if there is only as single <code>|</code> node
/// internally.
int length(const formula* f);
}
}