sl@0: # 2006 October 1 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #************************************************************************* sl@0: # This file implements regression tests for SQLite library. The sl@0: # focus of this script is testing the FTS3 module, and in particular sl@0: # the Porter stemmer. sl@0: # sl@0: # $Id: fts3ad.test,v 1.1 2007/08/20 17:38:42 shess Exp $ sl@0: # sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: # If SQLITE_ENABLE_FTS3 is defined, omit this file. sl@0: ifcapable !fts3 { sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: do_test fts3ad-1.1 { sl@0: execsql { sl@0: CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize porter); sl@0: INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping'); sl@0: SELECT rowid FROM t1 WHERE content MATCH 'run jump'; sl@0: } sl@0: } {1} sl@0: do_test fts3ad-1.2 { sl@0: execsql { sl@0: SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'run jump'; sl@0: } sl@0: } {{running and jumping}} sl@0: do_test fts3ad-1.3 { sl@0: execsql { sl@0: INSERT INTO t1(rowid, content) sl@0: VALUES(2, 'abcdefghijklmnopqrstuvwyxz'); sl@0: SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijqrstuvwyxz' sl@0: } sl@0: } {2 abcdefghijklmnopqrstuvwyxz} sl@0: do_test fts3ad-1.4 { sl@0: execsql { sl@0: SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijXXXXqrstuvwyxz' sl@0: } sl@0: } {2 abcdefghijklmnopqrstuvwyxz} sl@0: do_test fts3ad-1.5 { sl@0: execsql { sl@0: INSERT INTO t1(rowid, content) sl@0: VALUES(3, 'The value is 123456789'); sl@0: SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123789' sl@0: } sl@0: } {3 {The value is 123456789}} sl@0: do_test fts3ad-1.6 { sl@0: execsql { sl@0: SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123000000789' sl@0: } sl@0: } {3 {The value is 123456789}} sl@0: sl@0: sl@0: finish_test