# This is a home for regular expression tests that don't fit into
# the format supported by re/regexp.t. If you want to add a test
# that does fit that format, add it to re/re_tests, not here.
+#
+# this file includes test that my burn a lot of CPU or otherwise be heavy
+# on resources. Set env var $PERL_SKIP_PSYCHO_TEST to skip this file
use strict;
use warnings;
}
+skip_all('$PERL_SKIP_PSYCHO_TEST set') if $ENV{PERL_SKIP_PSYCHO_TEST};
plan tests => 11; # Update this when adding/deleting tests.
run_tests() unless caller;
# Tests start here.
#
sub run_tests {
+ print "# Set PERL_SKIP_PSYCHO_TEST to skip these tests\n";
- SKIP:
{
- print "# Set PERL_SKIP_PSYCHO_TEST to skip this test\n";
- my @normal = qw [the are some normal words];
- skip "Skipped Psycho", 2 * @normal if $ENV {PERL_SKIP_PSYCHO_TEST};
+ # stress test tries
+
+ my @normal = qw [the are some normal words];
local $" = "|";
+ note "setting up trie psycho vars ...";
my @psycho = (@normal, map chr $_, 255 .. 20000);
my $psycho1 = "@psycho";
for (my $i = @psycho; -- $i;) {
my $psycho2 = "@psycho";
foreach my $word (@normal) {
- ok $word =~ /($psycho1)/ && $1 eq $word, 'Psycho';
- ok $word =~ /($psycho2)/ && $1 eq $word, 'Psycho';
+ ok $word =~ /($psycho1)/ && $1 eq $word, qq{"$word" =~ /\$psycho1/};
+ ok $word =~ /($psycho2)/ && $1 eq $word, qq{"$word" =~ /\$psycho1/};
}
}
- SKIP:
{
# stress test CURLYX/WHILEM.
#
# CURLYX and WHILEM blocks, except those related to LONGJMP, the
# super-linear cache and warnings. It executes about 0.5M regexes
- skip "No psycho tests" if $ENV {PERL_SKIP_PSYCHO_TEST};
- print "# Set PERL_SKIP_PSYCHO_TEST to skip this test\n";
my $r = qr/^
(?:
( (?:a|z+)+ )