]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add new test file fts3defer2.test.
authordan <dan@noemail.net>
Fri, 22 Oct 2010 19:03:33 +0000 (19:03 +0000)
committerdan <dan@noemail.net>
Fri, 22 Oct 2010 19:03:33 +0000 (19:03 +0000)
FossilOrigin-Name: 5a4d5bfcaeb78a81713f138b01c0ea45a15c4d6c

manifest
manifest.uuid
test/fts3defer2.test [new file with mode: 0644]

index f272f609a260de9660a739c6b43172fa822fc488..5e1278d700c181bbdc64b13772b5af7418ddcc01 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\smissing\scomments\sand\sfix\scompiler\swarnings\sin\snew\sFTS3/4\scode.\sOther\sminor\sfixes\stoo.
-D 2010-10-22T16:44:39
+C Add\snew\stest\sfile\sfts3defer2.test.
+D 2010-10-22T19:03:34
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2c8cefd962eca0147132c7cf9eaa4bb24c656f3f
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -434,6 +434,7 @@ F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
 F test/fts3cov.test 54cf1f98c72abee246447cd688590898c9ecbaf7
 F test/fts3d.test 95fb3c862cbc4297c93fceb9a635543744e9ef52
 F test/fts3defer.test cf66bf69afcc2fb8373d3aed31c55399409e83f2
+F test/fts3defer2.test 98259e5d7fa16b2d275d9b6a6c0c972e285fa18c
 F test/fts3e.test 1f6c6ac9cc8b772ca256e6b22aaeed50c9350851
 F test/fts3expr.test 5e745b2b6348499d9ef8d59015de3182072c564c
 F test/fts3expr2.test 18da930352e5693eaa163a3eacf96233b7290d1a
@@ -875,7 +876,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P fd1e5cade04961c2f5438a1dfcc2e15eafb4503f
-R 206dc3599103f123f01ecb7943eabb05
+P 1c9c70fec3c88319f7b2efe5316694a6ce0ab1a5
+R d4195a622cd830429b9e32aeb4872a48
 U dan
-Z dd51b6660510db15d5633c2bf486673b
+Z 7c9af859e7e36df7363e90eaf6cd38eb
index a2460faecb8da11ad42e823d083da571f9ef0212..5fc6ae80f4450d36d665099fc06a24a4c669a1a9 100644 (file)
@@ -1 +1 @@
-1c9c70fec3c88319f7b2efe5316694a6ce0ab1a5
\ No newline at end of file
+5a4d5bfcaeb78a81713f138b01c0ea45a15c4d6c
\ No newline at end of file
diff --git a/test/fts3defer2.test b/test/fts3defer2.test
new file mode 100644 (file)
index 0000000..2ec3d4f
--- /dev/null
@@ -0,0 +1,106 @@
+# 2010 October 23
+#
+# The author disclaims copyright to this source code.  In place of
+# a legal notice, here is a blessing:
+#
+#    May you do good and not evil.
+#    May you find forgiveness for yourself and forgive others.
+#    May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+source $testdir/malloc_common.tcl
+ifcapable !fts3 { finish_test ; return }
+
+set testprefix fts3defer2
+
+proc mit {blob} {
+  set scan(littleEndian) i*
+  set scan(bigEndian) I*
+  binary scan $blob $scan($::tcl_platform(byteOrder)) r
+  return $r
+}
+db func mit mit
+
+#-----------------------------------------------------------------------------
+# This block of tests - fts3defer2-1.* - test the interaction of deferred NEAR
+# expressions and the snippet, offsets and matchinfo functions.
+# 
+do_execsql_test 1.1.1 {
+  CREATE VIRTUAL TABLE t1 USING fts4;
+}
+do_execsql_test 1.1.2 "INSERT INTO t1 VALUES('[string repeat {a } 20000]')"
+do_execsql_test 1.1.3 "INSERT INTO t1 VALUES('[string repeat {z } 20000]')"
+do_execsql_test 1.1.4 {
+  INSERT INTO t1 VALUES('a b c d e f a x y');
+  INSERT INTO t1(t1) VALUES('optimize');
+  UPDATE t1_segments 
+    SET block = zeroblob(length(block)) 
+    WHERE length(block)>10000;
+}
+do_execsql_test 1.1.4 {
+  SELECT count(*) FROM t1_segments WHERE length(block)>10000;
+  UPDATE t1_segments 
+    SET block = zeroblob(length(block)) WHERE length(block)>10000;
+} {2}
+
+do_execsql_test 1.2.1 {
+  SELECT content FROM t1 WHERE t1 MATCH 'f (e NEAR/2 a)';
+} {{a b c d e f a x y}}
+
+do_execsql_test 1.2.2 {
+  SELECT snippet(t1, '[', ']'), offsets(t1), mit(matchinfo(t1))
+  FROM t1 WHERE t1 MATCH 'f (e NEAR/2 a)';
+} [list                              \
+   {a b c d [e] [f] [a] x y}         \
+   {0 1 8 1 0 0 10 1 0 2 12 1}       \
+   [list 3 1   1 1 1   1 1 1   1 1 1   3 13336 9]
+]
+
+do_execsql_test 1.2.3 {
+  SELECT snippet(t1, '[', ']'), offsets(t1), mit(matchinfo(t1))
+  FROM t1 WHERE t1 MATCH 'f (e NEAR/3 a)';
+} [list                                 \
+   {[a] b c d [e] [f] [a] x y}          \
+   {0 2 0 1 0 1 8 1 0 0 10 1 0 2 12 1}  \
+   [list 3 1   1 1 1   1 1 1   2 2 1   3 13336 9]
+]
+
+do_execsql_test 1.3.1 { DROP TABLE t1 }
+
+#-----------------------------------------------------------------------------
+# Test cases fts3defer2-2.* focus specifically on the matchinfo function.
+# 
+do_execsql_test 2.1.1 {
+  CREATE VIRTUAL TABLE t2 USING fts4;
+}
+do_execsql_test 2.1.2 "INSERT INTO t2 VALUES('[string repeat {a } 20000]')"
+do_execsql_test 2.1.3 "INSERT INTO t2 VALUES('[string repeat {z } 20000]')"
+do_execsql_test 2.1.4 {
+  INSERT INTO t2 VALUES('a b c d e f g');
+  INSERT INTO t2 VALUES('a b c d e f g');
+}
+
+foreach {tn sql} {
+  1 {}
+  2 { INSERT INTO t2(t2) VALUES('optimize') }
+  3 { UPDATE t2_segments SET block = zeroblob(length(block)) 
+      WHERE length(block)>10000;
+  }
+} {
+if {$tn==3} break
+  execsql $sql
+  do_execsql_test 2.2.$tn.1 {
+    SELECT mit(matchinfo(t2)) FROM t2 WHERE t2 MATCH 'a b';
+  } [list                                          \
+    [list 2 1  1 20002 3  1 2 2  4 10004 7]        \
+    [list 2 1  1 20002 3  1 2 2  4 10004 7]        \
+  ]
+}
+
+
+finish_test
+