1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/fts2d.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,65 @@
1.4 +# 2006 October 1
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#*************************************************************************
1.14 +# This file implements regression tests for SQLite library. The
1.15 +# focus of this script is testing the FTS2 module, and in particular
1.16 +# the Porter stemmer.
1.17 +#
1.18 +# $Id: fts2d.test,v 1.1 2006/10/19 23:36:26 shess Exp $
1.19 +#
1.20 +
1.21 +set testdir [file dirname $argv0]
1.22 +source $testdir/tester.tcl
1.23 +
1.24 +# If SQLITE_ENABLE_FTS2 is defined, omit this file.
1.25 +ifcapable !fts2 {
1.26 + finish_test
1.27 + return
1.28 +}
1.29 +
1.30 +do_test fts2d-1.1 {
1.31 + execsql {
1.32 + CREATE VIRTUAL TABLE t1 USING fts2(content, tokenize porter);
1.33 + INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
1.34 + SELECT rowid FROM t1 WHERE content MATCH 'run jump';
1.35 + }
1.36 +} {1}
1.37 +do_test fts2d-1.2 {
1.38 + execsql {
1.39 + SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'run jump';
1.40 + }
1.41 +} {{<b>running</b> and <b>jumping</b>}}
1.42 +do_test fts2d-1.3 {
1.43 + execsql {
1.44 + INSERT INTO t1(rowid, content)
1.45 + VALUES(2, 'abcdefghijklmnopqrstuvwyxz');
1.46 + SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijqrstuvwyxz'
1.47 + }
1.48 +} {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
1.49 +do_test fts2d-1.4 {
1.50 + execsql {
1.51 + SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijXXXXqrstuvwyxz'
1.52 + }
1.53 +} {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
1.54 +do_test fts2d-1.5 {
1.55 + execsql {
1.56 + INSERT INTO t1(rowid, content)
1.57 + VALUES(3, 'The value is 123456789');
1.58 + SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123789'
1.59 + }
1.60 +} {3 {The value is <b>123456789</b>}}
1.61 +do_test fts2d-1.6 {
1.62 + execsql {
1.63 + SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123000000789'
1.64 + }
1.65 +} {3 {The value is <b>123456789</b>}}
1.66 +
1.67 +
1.68 +finish_test