3 # This is a home for regular expression tests that don't fit into
4 # the format supported by re/regexp.t. If you want to add a test
5 # that does fit that format, add it to re/re_tests, not here.
19 @INC = ('../lib','.');
24 plan tests => 11; # Update this when adding/deleting tests.
26 run_tests() unless caller;
35 print "# Set PERL_SKIP_PSYCHO_TEST to skip this test\n";
36 my @normal = qw [the are some normal words];
38 skip "Skipped Psycho", 2 * @normal if $ENV {PERL_SKIP_PSYCHO_TEST};
42 my @psycho = (@normal, map chr $_, 255 .. 20000);
43 my $psycho1 = "@psycho";
44 for (my $i = @psycho; -- $i;) {
45 my $j = int rand (1 + $i);
46 @psycho [$i, $j] = @psycho [$j, $i];
48 my $psycho2 = "@psycho";
50 foreach my $word (@normal) {
51 ok $word =~ /($psycho1)/ && $1 eq $word, 'Psycho';
52 ok $word =~ /($psycho2)/ && $1 eq $word, 'Psycho';
59 # stress test CURLYX/WHILEM.
61 # This test includes varying levels of nesting, and according to
62 # profiling done against build 28905, exercises every code line in the
63 # CURLYX and WHILEM blocks, except those related to LONGJMP, the
64 # super-linear cache and warnings. It executes about 0.5M regexes
66 skip "No psycho tests" if $ENV {PERL_SKIP_PSYCHO_TEST};
67 print "# Set PERL_SKIP_PSYCHO_TEST to skip this test\n";
102 my $msg = "CURLYX stress test";
104 for my $a ("x","a","aa") {
105 for my $b ("x","bbb","bbbb") {
107 for my $c ("x","c","cc") {
109 for my $d ("x","d","dd") {
111 for my $e ("x","e","ee") {
113 for my $f ("x","f","ff") {
115 for my $g ("x","g","gg") {
117 for my $h ("x","h","hh") {
119 for my $i ("x","i","ii") {
121 for my $j ("x","j","jj") {
123 for my $k ("x","k","kk") {
125 for my $l ("x","l","ll") {
129 $msg .= ": unexpected match for [$ls]";
133 my $cap = "$1$2$3$4$5$6$7$8$9$10$11$12";
134 unless ($ls eq $cap) {
135 $msg .= ": capture: [$ls], got [$cap]";
141 unless ($ls =~ /x/) {
142 $msg = ": failed for [$ls]";
161 } # End of sub run_tests