Permalink
Browse files

better test.

  • Loading branch information...
bradfitz committed Apr 20, 2007
1 parent f67a7a1 commit c081c1c0c086df4a81c1d850be9abb1d87b94b24
Showing with 3 additions and 5 deletions.
  1. +3 −5 t/10-all.t
View
@@ -21,25 +21,23 @@ $set2->modify_targets(
);
-
-
print Dumper($set->t_bucket_counts);
print Dumper($set2->t_bucket_counts);
-if (0) {
+if (1) {
my %matched;
my $total_trials = 100_000;
for my $n (1..$total_trials) {
- my $rand = crc32("trial$n");
+ my $rand = unpack("N", sha1("trial$n"));
my $server = $set->target_of_point($rand);
#print "matched $rand = $server\n";
$matched{$server}++;
}
foreach my $s ($set->targets) {
printf("$s: expected=%0.02f%% actual=%0.02f%%\n", # space=%0.02f%%\n",
- $set->weight_percentage($s),
+ $set->percent_weight($s),
100 * $matched{$s} / $total_trials,
#($space{$s} / 2**32) * 100,
);

0 comments on commit c081c1c

Please sign in to comment.