Skip Menu |

This queue is for tickets about the Regex-PreSuf CPAN distribution.

Report information
The Basics
Id: 17820
Status: resolved
Priority: 0/
Queue: Regex-PreSuf

People
Owner: Nobody in particular
Requestors: RURBAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: MSWin32 test fix
Enable the words test when no dict/words is found.
Subject: Regex-PreSuf-1.16-MSWin32.patch
--- Regex-PreSuf-1.16/t/words.t.orig 2004-05-12 21:07:22.000000000 +0100 +++ Regex-PreSuf-1.16/t/words.t 2006-02-23 10:38:30.588125000 +0100 @@ -7,8 +7,33 @@ print STDERR "# Hang on, collecting words for the next test...\n"; my %words; +my $MAXWORDS = 30000; -foreach my $dict (qw(/usr/dict/words /usr/share/dict/words)) { +sub allwords { + local $/; + return if scalar(keys %words) > $MAXWORDS; + if (open(WORDS, "< $File::Find::name")) { + print STDERR "# ",scalar(keys %words)," ...\r"; + my @s = <WORDS>; + for my $l (@s) { + for my $w (split /\W+/, $l) { + $words{$w}++ if $w =~ /^\w+$/; + return if scalar(keys %words) > $MAXWORDS; + } + } + print STDERR "# ",scalar(keys %words)," ...\r"; + close(WORDS); + } +} +if ($^O eq 'MSWin32') { + print STDERR "\n"; + use File::Find; + find({wanted => \&allwords, no_chdir => 1}, "."); + if (scalar keys %words < 2000) { + find({wanted => \&allwords, no_chdir => 1}, ".."); + } +} else { + foreach my $dict (qw(/usr/dict/words /usr/share/dict/words)) { if (open(WORDS, $dict)) { while (<WORDS>) { chomp; @@ -16,14 +41,13 @@ } close(WORDS); } + } } my @words = keys %words; use Benchmark; -my $MAXWORDS = 20000; - if (@words) { print STDERR "# NOTE THAT THIS TEST WILL TAKE SEVERAL MINUTES.\n"; print STDERR "# And I do mean *SEVERAL* minutes.\n"; @@ -33,7 +57,7 @@ my @az = ("a".."z"); # Throw away some of the words. - @words = grep { /^[a-z]+$/ } @words; + @words = grep { /^[a-z]+$/ } @words unless $^O eq 'MSWin32'; while (@words > $MAXWORDS) { splice @words, rand(@words), rand(100); @@ -66,8 +90,8 @@ $t1 = new Benchmark; my $tb = timediff($t1, $t0); $naiveCreationTotal=Benchmark::timesum($tb,$naiveCreationTotal); - print STDERR "# Naïve/create: ", timestr($tb), "\n"; - print STDERR "# Naïve/execute: "; + print STDERR "# Naive/create: ", timestr($tb), "\n"; + print STDERR "# Naive/execute: "; $t0 = new Benchmark; my @b = grep { /^(?:$b)$/ } @words; $t1 = new Benchmark; @@ -89,8 +113,8 @@ print STDERR timestr($tc), "\n"; print STDERR "# Aggregate times so far:\n"; - print STDERR "# Naïve/create: ",timestr($naiveCreationTotal),"\n"; - print STDERR "# Naïve/execute: ",timestr($naiveExecutionTotal),"\n"; + print STDERR "# Naive/create: ",timestr($naiveCreationTotal),"\n"; + print STDERR "# Naive/execute: ",timestr($naiveExecutionTotal),"\n"; print STDERR "# Presuf/create: ",timestr($presufCreationTotal),"\n"; print STDERR "# PreSuf/execute: ",timestr($presufExecutionTotal),"\n"; } @@ -153,8 +177,8 @@ } print STDERR "# Aggregate times total:\n"; - print STDERR "# Naïve/create: ",timestr($naiveCreationTotal),"\n"; - print STDERR "# Naïve/execute: ",timestr($naiveExecutionTotal),"\n"; + print STDERR "# Naive/create: ",timestr($naiveCreationTotal),"\n"; + print STDERR "# Naive/execute: ",timestr($naiveExecutionTotal),"\n"; print STDERR "# Presuf/create: ",timestr($presufCreationTotal),"\n"; print STDERR "# PreSuf/execute: ",timestr($presufExecutionTotal),"\n";
Subject: Re: [rt.cpan.org #17820] MSWin32 test fix
Date: Sun, 26 Feb 2006 21:34:26 +0200
To: bug-Regex-PreSuf [...] rt.cpan.org
From: Jarkko Hietaniemi <jhietaniemi [...] gmail.com>
Guest via RT wrote: Show quoted text
> Thu Feb 23 04:37:15 2006: Request 17820 was acted upon. > Transaction: Ticket created by guest > Queue: Regex-PreSuf > Subject: MSWin32 test fix > Owner: Nobody > Requestors: RURBAN@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=17820 > > > > Enable the words test when no dict/words is found.
Please try 1.17, I made a slightly different change.
Closing as resolved.