diff options
author | Bruce Momjian <bruce@momjian.us> | 2012-07-04 21:47:48 -0400 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2012-07-04 21:47:48 -0400 |
commit | 2bc09ff4994fbeecef9601b8654f3f94b55bc81a (patch) | |
tree | 909899084593f8d689c70547dfc5d3cb9cea76f5 /contrib/intarray/bench/create_test.pl | |
parent | 9c6f8be2b14c170b589fdbd48e3db42c45efb2cc (diff) |
Run newly-configured perltidy script on Perl files.
Run on HEAD and 9.2.
Diffstat (limited to 'contrib/intarray/bench/create_test.pl')
-rwxr-xr-x | contrib/intarray/bench/create_test.pl | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/contrib/intarray/bench/create_test.pl b/contrib/intarray/bench/create_test.pl index 67394f87b70..1323b31e4d6 100755 --- a/contrib/intarray/bench/create_test.pl +++ b/contrib/intarray/bench/create_test.pl @@ -15,28 +15,38 @@ create table message_section_map ( EOT -open(MSG,">message.tmp") || die; -open(MAP,">message_section_map.tmp") || die; +open(MSG, ">message.tmp") || die; +open(MAP, ">message_section_map.tmp") || die; + +srand(1); -srand( 1 ); #foreach my $i ( 1..1778 ) { #foreach my $i ( 1..3443 ) { #foreach my $i ( 1..5000 ) { #foreach my $i ( 1..29362 ) { #foreach my $i ( 1..33331 ) { #foreach my $i ( 1..83268 ) { -foreach my $i ( 1..200000 ) { +foreach my $i (1 .. 200000) +{ my @sect; - if ( rand() < 0.7 ) { - $sect[0] = int( (rand()**4)*100 ); - } else { + if (rand() < 0.7) + { + $sect[0] = int((rand()**4) * 100); + } + else + { my %hash; - @sect = grep { $hash{$_}++; $hash{$_} <= 1 } map { int( (rand()**4)*100) } 0..( int(rand()*5) ); + @sect = + grep { $hash{$_}++; $hash{$_} <= 1 } + map { int((rand()**4) * 100) } 0 .. (int(rand() * 5)); } - if ( $#sect < 0 || rand() < 0.1 ) { + if ($#sect < 0 || rand() < 0.1) + { print MSG "$i\t\\N\n"; - } else { - print MSG "$i\t{".join(',',@sect)."}\n"; + } + else + { + print MSG "$i\t{" . join(',', @sect) . "}\n"; map { print MAP "$i\t$_\n" } @sect; } } @@ -64,12 +74,13 @@ EOT unlink 'message.tmp', 'message_section_map.tmp'; -sub copytable { +sub copytable +{ my $t = shift; print "COPY $t from stdin;\n"; - open( FFF, "$t.tmp") || die; - while(<FFF>) { print; } + open(FFF, "$t.tmp") || die; + while (<FFF>) { print; } close FFF; print "\\.\n"; } |