[Pcre-svn] [828] code/branches/pcre16: Updata DFA matching f…

Startseite
Nachricht löschen
Autor: Subversion repository
Datum:  
To: pcre-svn
Betreff: [Pcre-svn] [828] code/branches/pcre16: Updata DFA matching for 16-bit issues; add appropriate tests.
Revision: 828
          http://vcs.pcre.org/viewvc?view=rev&revision=828
Author:   ph10
Date:     2011-12-27 11:25:32 +0000 (Tue, 27 Dec 2011)


Log Message:
-----------
Updata DFA matching for 16-bit issues; add appropriate tests.

Modified Paths:
--------------
    code/branches/pcre16/RunTest
    code/branches/pcre16/pcre_dfa_exec.c


Added Paths:
-----------
    code/branches/pcre16/testdata/testinput20
    code/branches/pcre16/testdata/testoutput20


Modified: code/branches/pcre16/RunTest
===================================================================
--- code/branches/pcre16/RunTest    2011-12-27 10:51:09 UTC (rev 827)
+++ code/branches/pcre16/RunTest    2011-12-27 11:25:32 UTC (rev 828)
@@ -54,6 +54,7 @@
 do17=no
 do18=no
 do19=no
+do20=no


 while [ $# -gt 0 ] ; do
   case $1 in
@@ -76,6 +77,7 @@
    17) do17=yes;;
    18) do18=yes;;
    19) do19=yes;;
+   20) do20=yes;; 
    -8) arg8=yes;;
   -16) arg16=yes;;
    valgrind) valgrind="valgrind -q --smc-check=all";;
@@ -240,7 +242,7 @@
      $do5  = no -a $do6  = no -a $do7  = no -a $do8  = no -a \
      $do9  = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
      $do13 = no -a $do14 = no -a $do15 = no -a $do16 = no -a \
-     $do17 = no -a $do18 = no -a $do19 = no ] ; then
+     $do17 = no -a $do18 = no -a $do19 = no -a $do20 = no ] ; then
   do1=yes
   do2=yes
   do3=yes
@@ -260,6 +262,7 @@
   do17=yes
   do18=yes
   do19=yes
+  do20=yes 
 fi


# Show which release and which test data
@@ -714,6 +717,27 @@
fi
fi

+# Tests for 16-bit-specific features in DFA non-UTF-16 mode
+
+if [ $do20 = yes ] ; then
+  echo "Test 20: DFA specials for the basic 16-bit library"
+  if [ "$bits" = "8" ] ; then
+    echo "  Skipped when running 8-bit tests"
+  else   
+    for opt in "" "-s"; do
+      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput20 testtry
+      if [ $? = 0 ] ; then
+        $cf $testdata/testoutput20 testtry
+        if [ $? != 0 ] ; then exit 1; fi
+      else exit 1
+      fi
+      if [ "$opt" = "-s" ] ; then echo "  OK with study"
+      else echo "  OK"
+      fi
+    done
+  fi
+fi
+
 # End of loop for 8-bit/16-bit tests
 done



Modified: code/branches/pcre16/pcre_dfa_exec.c
===================================================================
--- code/branches/pcre16/pcre_dfa_exec.c    2011-12-27 10:51:09 UTC (rev 827)
+++ code/branches/pcre16/pcre_dfa_exec.c    2011-12-27 11:25:32 UTC (rev 828)
@@ -2269,7 +2269,7 @@
             }
           else
 #endif  /* SUPPORT_UTF */
-          otherd = fcc[d];
+          otherd = TABLE_GET(d, fcc, d);
           }
         if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
           {
@@ -2314,7 +2314,7 @@
             }
           else
 #endif  /* SUPPORT_UTF */
-          otherd = fcc[d];
+          otherd = TABLE_GET(d, fcc, d);
           }
         if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
           {
@@ -2351,7 +2351,7 @@
             }
           else
 #endif  /* SUPPORT_UTF */
-          otherd = fcc[d];
+          otherd = TABLE_GET(d, fcc, d);
           }
         if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
           {
@@ -2395,7 +2395,7 @@
             }
           else
 #endif  /* SUPPORT_UTF */
-          otherd = fcc[d];
+          otherd = TABLE_GET(d, fcc, d);
           }
         if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
           {


Added: code/branches/pcre16/testdata/testinput20
===================================================================
--- code/branches/pcre16/testdata/testinput20                            (rev 0)
+++ code/branches/pcre16/testdata/testinput20    2011-12-27 11:25:32 UTC (rev 828)
@@ -0,0 +1,19 @@
+/-- These tests are for the handling of characters greater than 255 in 16-bit,
+    non-UTF-16 mode. --/
+
+/^\x{ffff}+/i
+    \x{ffff}
+
+/^\x{ffff}?/i
+    \x{ffff}
+
+/^\x{ffff}*/i
+    \x{ffff}
+
+/^\x{ffff}{3}/i
+    \x{ffff}\x{ffff}\x{ffff}
+
+/^\x{ffff}{0,3}/i
+    \x{ffff}
+
+/-- End of testinput20 --/


Added: code/branches/pcre16/testdata/testoutput20
===================================================================
--- code/branches/pcre16/testdata/testoutput20                            (rev 0)
+++ code/branches/pcre16/testdata/testoutput20    2011-12-27 11:25:32 UTC (rev 828)
@@ -0,0 +1,24 @@
+/-- These tests are for the handling of characters greater than 255 in 16-bit,
+    non-UTF-16 mode. --/
+
+/^\x{ffff}+/i
+    \x{ffff}
+ 0: \x{ffff}
+
+/^\x{ffff}?/i
+    \x{ffff}
+ 0: \x{ffff}
+
+/^\x{ffff}*/i
+    \x{ffff}
+ 0: \x{ffff}
+
+/^\x{ffff}{3}/i
+    \x{ffff}\x{ffff}\x{ffff}
+ 0: \x{ffff}\x{ffff}\x{ffff}
+
+/^\x{ffff}{0,3}/i
+    \x{ffff}
+ 0: \x{ffff}
+
+/-- End of testinput20 --/