forked from Mirrors/freeswitch
165f180162
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3735 d0543943-73ff-0310-b7d9-9358b9ac24b2
66 lines
1.8 KiB
Plaintext
66 lines
1.8 KiB
Plaintext
# 2006 October 1
|
|
#
|
|
# 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.
|
|
#
|
|
#*************************************************************************
|
|
# This file implements regression tests for SQLite library. The
|
|
# focus of this script is testing the FTS1 module, and in particular
|
|
# the Porter stemmer.
|
|
#
|
|
# $Id: fts1d.test,v 1.1 2006/10/01 18:41:21 drh Exp $
|
|
#
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
# If SQLITE_ENABLE_FTS1 is defined, omit this file.
|
|
ifcapable !fts1 {
|
|
finish_test
|
|
return
|
|
}
|
|
|
|
do_test fts1d-1.1 {
|
|
execsql {
|
|
CREATE VIRTUAL TABLE t1 USING fts1(content, tokenize porter);
|
|
INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
|
|
SELECT rowid FROM t1 WHERE content MATCH 'run jump';
|
|
}
|
|
} {1}
|
|
do_test fts1d-1.2 {
|
|
execsql {
|
|
SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'run jump';
|
|
}
|
|
} {{<b>running</b> and <b>jumping</b>}}
|
|
do_test fts1d-1.3 {
|
|
execsql {
|
|
INSERT INTO t1(rowid, content)
|
|
VALUES(2, 'abcdefghijklmnopqrstuvwyxz');
|
|
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijqrstuvwyxz'
|
|
}
|
|
} {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
|
|
do_test fts1d-1.4 {
|
|
execsql {
|
|
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijXXXXqrstuvwyxz'
|
|
}
|
|
} {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
|
|
do_test fts1d-1.5 {
|
|
execsql {
|
|
INSERT INTO t1(rowid, content)
|
|
VALUES(3, 'The value is 123456789');
|
|
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123789'
|
|
}
|
|
} {3 {The value is <b>123456789</b>}}
|
|
do_test fts1d-1.6 {
|
|
execsql {
|
|
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123000000789'
|
|
}
|
|
} {3 {The value is <b>123456789</b>}}
|
|
|
|
|
|
finish_test
|