1*8e734e35Sshess# 2006 October 1 2*8e734e35Sshess# 3*8e734e35Sshess# The author disclaims copyright to this source code. In place of 4*8e734e35Sshess# a legal notice, here is a blessing: 5*8e734e35Sshess# 6*8e734e35Sshess# May you do good and not evil. 7*8e734e35Sshess# May you find forgiveness for yourself and forgive others. 8*8e734e35Sshess# May you share freely, never taking more than you give. 9*8e734e35Sshess# 10*8e734e35Sshess#************************************************************************* 11*8e734e35Sshess# This file implements regression tests for SQLite library. The 12*8e734e35Sshess# focus of this script is testing the FTS2 module, and in particular 13*8e734e35Sshess# the Porter stemmer. 14*8e734e35Sshess# 15*8e734e35Sshess# $Id: fts2d.test,v 1.1 2006/10/19 23:36:26 shess Exp $ 16*8e734e35Sshess# 17*8e734e35Sshess 18*8e734e35Sshessset testdir [file dirname $argv0] 19*8e734e35Sshesssource $testdir/tester.tcl 20*8e734e35Sshess 21*8e734e35Sshess# If SQLITE_ENABLE_FTS2 is defined, omit this file. 22*8e734e35Sshessifcapable !fts2 { 23*8e734e35Sshess finish_test 24*8e734e35Sshess return 25*8e734e35Sshess} 26*8e734e35Sshess 27*8e734e35Sshessdo_test fts2d-1.1 { 28*8e734e35Sshess execsql { 29*8e734e35Sshess CREATE VIRTUAL TABLE t1 USING fts2(content, tokenize porter); 30*8e734e35Sshess INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping'); 31*8e734e35Sshess SELECT rowid FROM t1 WHERE content MATCH 'run jump'; 32*8e734e35Sshess } 33*8e734e35Sshess} {1} 34*8e734e35Sshessdo_test fts2d-1.2 { 35*8e734e35Sshess execsql { 36*8e734e35Sshess SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'run jump'; 37*8e734e35Sshess } 38*8e734e35Sshess} {{<b>running</b> and <b>jumping</b>}} 39*8e734e35Sshessdo_test fts2d-1.3 { 40*8e734e35Sshess execsql { 41*8e734e35Sshess INSERT INTO t1(rowid, content) 42*8e734e35Sshess VALUES(2, 'abcdefghijklmnopqrstuvwyxz'); 43*8e734e35Sshess SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijqrstuvwyxz' 44*8e734e35Sshess } 45*8e734e35Sshess} {2 <b>abcdefghijklmnopqrstuvwyxz</b>} 46*8e734e35Sshessdo_test fts2d-1.4 { 47*8e734e35Sshess execsql { 48*8e734e35Sshess SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijXXXXqrstuvwyxz' 49*8e734e35Sshess } 50*8e734e35Sshess} {2 <b>abcdefghijklmnopqrstuvwyxz</b>} 51*8e734e35Sshessdo_test fts2d-1.5 { 52*8e734e35Sshess execsql { 53*8e734e35Sshess INSERT INTO t1(rowid, content) 54*8e734e35Sshess VALUES(3, 'The value is 123456789'); 55*8e734e35Sshess SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123789' 56*8e734e35Sshess } 57*8e734e35Sshess} {3 {The value is <b>123456789</b>}} 58*8e734e35Sshessdo_test fts2d-1.6 { 59*8e734e35Sshess execsql { 60*8e734e35Sshess SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123000000789' 61*8e734e35Sshess } 62*8e734e35Sshess} {3 {The value is <b>123456789</b>}} 63*8e734e35Sshess 64*8e734e35Sshess 65*8e734e35Sshessfinish_test 66