Fix random_graph() not to generate dead states.
This is actually the third time I fix random_graph(). On 2007-02-06 I changed the function not to generated dead states, but in a way that made it non-deterministic. On 2010-01-20 I made the function deterministic again, but it started to generate dead states as a side effect. This time, I'm making sure that dead states won't come again with a test-case that we should have had from the beginning. * src/tgbaalgos/randomgraph.cc (random_graph): Add an extra indirection array, state_randomizer[], so that we can reorder states indices after a random selection without actually changing the value of the indices used by unreachable_states and nodes_to_process. * src/tgbatest/randtgba.test: New file. * src/tgbatest/Makefile.am: Add randtgba.test.
This commit is contained in:
parent
72b7deec12
commit
2183276008
4 changed files with 72 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
## Copyright (C) 2009 Laboratoire de Recherche et Développement
|
||||
## Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
|
||||
## de l'Epita (LRDE).
|
||||
## Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
|
||||
## Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
|
|
@ -91,6 +91,7 @@ TESTS = \
|
|||
reduccmp.test \
|
||||
reductgba.test \
|
||||
scc.test \
|
||||
randtgba.test \
|
||||
emptchk.test \
|
||||
emptchke.test \
|
||||
dfs.test \
|
||||
|
|
|
|||
34
src/tgbatest/randtgba.test
Executable file
34
src/tgbatest/randtgba.test
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2010 Laboratoire de Recherche et Development de l'EPITA.
|
||||
#
|
||||
# This file is part of Spot, a model checking library.
|
||||
#
|
||||
# Spot is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
# License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Spot; see the file COPYING. If not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
. ./defs
|
||||
|
||||
set -e
|
||||
|
||||
for n in 10 20 30 40 50 60 70 80 90 100 200 500 1000; do
|
||||
# Make sure graph generated by randtgba have successors for each
|
||||
# of their $n nodes.
|
||||
r=`../randtgba -n $n a b c | sed -n 's/^"S\([0-9]*\)".*/\1/p' |
|
||||
sort -u | wc -l`
|
||||
if test "$r" -eq "$n"; then :; else
|
||||
echo "test failed for n=$n"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue