/ Check-in [66581162]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Test that terms longer than interior nodes work correctly. A bug prior to fts2.c r1.10 meant that such large terms caused an eventual stack overflow. (CVS 3523)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 66581162daa188d23078c9d21fd5b2563d4d238a
User & Date: shess 2006-11-29 21:03:01
Context
2006-11-29
23:41
Drop a couple variables which are no longer used anywhere. (CVS 3524) check-in: 08c2cc0e user: shess tags: trunk
21:03
Test that terms longer than interior nodes work correctly. A bug prior to fts2.c r1.10 meant that such large terms caused an eventual stack overflow. (CVS 3523) check-in: 66581162 user: shess tags: trunk
20:53
Added the speed1.test script (CVS 3522) check-in: 30355dfb user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added test/fts2h.test.

            1  +# 2006 October 31 (scaaarey)
            2  +#
            3  +# The author disclaims copyright to this source code.
            4  +#
            5  +#*************************************************************************
            6  +# This file implements regression tests for SQLite library.  The focus
            7  +# here is testing correct handling of excessively long terms.
            8  +#
            9  +# $Id: fts2h.test,v 1.1 2006/11/29 21:03:01 shess Exp $
           10  +#
           11  +
           12  +set testdir [file dirname $argv0]
           13  +source $testdir/tester.tcl
           14  +
           15  +# If SQLITE_ENABLE_FTS2 is defined, omit this file.
           16  +ifcapable !fts2 {
           17  +  finish_test
           18  +  return
           19  +}
           20  +
           21  +# Generate a term of len copies of char.
           22  +proc bigterm {char len} {
           23  +  for {set term ""} {$len>0} {incr len -1} {
           24  +    append term $char
           25  +  }
           26  +  return $term
           27  +}
           28  +
           29  +# Generate a document of bigterms based on characters from the list
           30  +# chars.
           31  +proc bigtermdoc {chars len} {
           32  +  set doc ""
           33  +  foreach char $chars {
           34  +    append doc " " [bigterm $char $len]
           35  +  }
           36  +  return $doc
           37  +}
           38  +
           39  +set len 5000
           40  +set doc1 [bigtermdoc {a b c d} $len]
           41  +set doc2 [bigtermdoc {b d e f} $len]
           42  +set doc3 [bigtermdoc {a c e} $len]
           43  +
           44  +set aterm [bigterm a $len]
           45  +set bterm [bigterm b $len]
           46  +set xterm [bigterm x $len]
           47  +
           48  +db eval {
           49  +  CREATE VIRTUAL TABLE t1 USING fts2(content);
           50  +  INSERT INTO t1 (rowid, content) VALUES(1, $doc1);
           51  +  INSERT INTO t1 (rowid, content) VALUES(2, $doc2);
           52  +  INSERT INTO t1 (rowid, content) VALUES(3, $doc3);
           53  +}
           54  +
           55  +# No hits at all.  Returns empty doclists from termSelect().
           56  +do_test fts2h-1.1 {
           57  +  execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something'}
           58  +} {}
           59  +
           60  +do_test fts2h-1.2 {
           61  +  execsql {SELECT rowid FROM t1 WHERE t1 MATCH $aterm}
           62  +} {1 3}
           63  +
           64  +do_test fts2h-1.2 {
           65  +  execsql {SELECT rowid FROM t1 WHERE t1 MATCH $xterm}
           66  +} {}
           67  +
           68  +do_test fts2h-1.3 {
           69  +  execsql "SELECT rowid FROM t1 WHERE t1 MATCH '$aterm -$xterm'"
           70  +} {1 3}
           71  +
           72  +do_test fts2h-1.4 {
           73  +  execsql "SELECT rowid FROM t1 WHERE t1 MATCH '\"$aterm $bterm\"'"
           74  +} {1}
           75  +
           76  +finish_test