summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-12-27 11:25:32 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-12-27 11:25:32 +0000
commit041f627ce61da03579a61be8c8854a2fbf144fe0 (patch)
tree8d2431d04b78d4f05990983a9c718d29c3198d4b
parent7a7abf9d520b43be4b6802c6d914f689156a735f (diff)
downloadpcre-041f627ce61da03579a61be8c8854a2fbf144fe0.tar.gz
Updata DFA matching for 16-bit issues; add appropriate tests.
git-svn-id: svn://vcs.exim.org/pcre/code/branches/pcre16@828 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rwxr-xr-xRunTest26
-rw-r--r--pcre_dfa_exec.c8
-rw-r--r--testdata/testinput2019
-rw-r--r--testdata/testoutput2024
4 files changed, 72 insertions, 5 deletions
diff --git a/RunTest b/RunTest
index 46a1c6b..d595549 100755
--- a/RunTest
+++ b/RunTest
@@ -54,6 +54,7 @@ do16=no
do17=no
do18=no
do19=no
+do20=no
while [ $# -gt 0 ] ; do
case $1 in
@@ -76,6 +77,7 @@ while [ $# -gt 0 ] ; do
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 @@ if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
$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 @@ if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
do17=yes
do18=yes
do19=yes
+ do20=yes
fi
# Show which release and which test data
@@ -714,6 +717,27 @@ if [ $do19 = yes ] ; then
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
diff --git a/pcre_dfa_exec.c b/pcre_dfa_exec.c
index 663865b..c738069 100644
--- a/pcre_dfa_exec.c
+++ b/pcre_dfa_exec.c
@@ -2269,7 +2269,7 @@ for (;;)
}
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 @@ for (;;)
}
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 @@ for (;;)
}
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 @@ for (;;)
}
else
#endif /* SUPPORT_UTF */
- otherd = fcc[d];
+ otherd = TABLE_GET(d, fcc, d);
}
if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
{
diff --git a/testdata/testinput20 b/testdata/testinput20
new file mode 100644
index 0000000..d3dcaa5
--- /dev/null
+++ b/testdata/testinput20
@@ -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 --/
diff --git a/testdata/testoutput20 b/testdata/testoutput20
new file mode 100644
index 0000000..8214921
--- /dev/null
+++ b/testdata/testoutput20
@@ -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 --/