[gnumeric] tests: allow setting a seed.



commit ce5f57c39dbc46cff553b60ba945246162eca46c
Author: Morten Welinder <terra gnome org>
Date:   Tue Aug 3 20:57:08 2010 -0400

    tests: allow setting a seed.

 test/fuzzxml |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/test/fuzzxml b/test/fuzzxml
index c73b4ea..1ec2cdc 100755
--- a/test/fuzzxml
+++ b/test/fuzzxml
@@ -4,16 +4,25 @@ use strict;
 use XML::Parser;
 use XML::Writer;
 use IO::File;
+use Getopt::Long;
+
+# -----------------------------------------------------------------------------
+
+my $base_prob = 1 / 1000;
+my $seed = undef;
+
+&GetOptions ("seed=i" => \$seed,
+	     "rate=f" => \$base_prob,
+    );
+srand ($seed) if defined $seed;
 
 my $infile = shift @ARGV;
 my $outfile = shift @ARGV;
 
-# -----------------------------------------------------------------------------
-
-my $remove_tag_prob = 1 / 1000;
-my $remove_attr_prob = 1 / 1000;
-my $change_int_prob = 1 / 1000;
-my $copy_attr_value_prob = 1 / 1000;
+my $remove_tag_prob = 0.1 * $base_prob;
+my $remove_attr_prob = 0.1 * $base_prob;
+my $change_int_prob = $base_prob;
+my $copy_attr_value_prob = $base_prob;
 
 my %attr_range;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]