Change 30694 by [EMAIL PROTECTED] on 2007/03/22 19:09:14

        Integrate the tests from:
        [ 28906]
        add stress test for CURLYX/WHILEM regex ops
        
        [ 28944]
        migrate CURLYX/WHILEM branch in regmatch() to new FSM-esque paradigm

Affected files ...

... //depot/maint-5.8/perl/t/op/pat.t#44 integrate

Differences ...

==== //depot/maint-5.8/perl/t/op/pat.t#44 (xtext) ====
Index: perl/t/op/pat.t
--- perl/t/op/pat.t#43~30663~   2007-03-21 11:17:59.000000000 -0700
+++ perl/t/op/pat.t     2007-03-22 12:09:14.000000000 -0700
@@ -7,7 +7,7 @@
 $| = 1;
 
 # please update note at bottom of file when you change this
-print "1..1247\n";
+print "1..1248\n";
 
 BEGIN {
     chdir 't' if -d 't';
@@ -3660,4 +3660,108 @@
 }
 
 
-# last test 1247
+# stress test CURLYX/WHILEM.
+#
+# This test includes varying levels of nesting, and according to
+# profiling done against build 28905, exercises every code line in the
+# CURLYX and WHILEM blocks, except those related to LONGJMP, the
+# super-linear cache and warnings. It executes about 0.5M regexes
+
+{
+  my $r = qr/^
+           (?:
+               ( (?:a|z+)+ )
+               (?:
+                   ( (?:b|z+){3,}? )
+                   (
+                       (?:
+                           (?:
+                               (?:c|z+){1,1}?z
+                           )?
+                           (?:c|z+){1,1}
+                       )*
+                   )
+                   (?:z*){2,}
+                   ( (?:z+|d)+ )
+                   (?:
+                       ( (?:e|z+)+ )
+                   )*
+                   ( (?:f|z+)+ )
+               )*
+               ( (?:z+|g)+ )
+               (?:
+                   ( (?:h|z+)+ )
+               )*
+               ( (?:i|z+)+ )
+           )+
+           ( (?:j|z+)+ )
+           (?:
+               ( (?:k|z+)+ )
+           )*
+           ( (?:l|z+)+ )
+       $/x;
+  
+  
+  my $ok = 1;
+  my $msg = "CURLYX stress test";
+  OUTER:
+  for my $a ("x","a","aa") {
+    for my $b ("x","bbb","bbbb") {
+      my $bs = $a.$b;
+      for my $c ("x","c","cc") {
+        my $cs = $bs.$c;
+        for my $d ("x","d","dd") {
+          my $ds = $cs.$d;
+          for my $e ("x","e","ee") {
+            my $es = $ds.$e;
+            for my $f ("x","f","ff") {
+              my $fs = $es.$f;
+              for my $g ("x","g","gg") {
+                my $gs = $fs.$g;
+                for my $h ("x","h","hh") {
+                  my $hs = $gs.$h;
+                  for my $i ("x","i","ii") {
+                    my $is = $hs.$i;
+                    for my $j ("x","j","jj") {
+                      my $js = $is.$j;
+                      for my $k ("x","k","kk") {
+                        my $ks = $js.$k;
+                        for my $l ("x","l","ll") {
+                          my $ls = $ks.$l;
+                          if ($ls =~ $r) {
+                            if ($ls =~ /x/) {
+                              $msg .= ": unexpected match for [$ls]";
+                             $ok = 0;
+                              last OUTER;
+                            }
+                            my $cap = "$1$2$3$4$5$6$7$8$9$10$11$12";
+                            unless ($ls eq $cap) {
+                              $msg .= ": capture: [$ls], got [$cap]";
+                             $ok = 0;
+                              last OUTER;
+                            }
+                          }
+                          else {
+                            unless ($ls =~ /x/) {
+                              $msg = ": failed for [$ls]";
+                             $ok = 0;
+                              last OUTER;
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  ok($ok, $msg);
+}
+
+
+# last test 1248
End of Patch.

Reply via email to