Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them.
Page: /drakestapleton/sqlite/blob/master/test/fts3ad.test
# sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
Sign in to star 0 stars 0 watching
About Files History Releases Proposed changes Issues For developers
branch `master` Branches Tags History
`sqlite / test / fts3ad.test`
106 lines ยท 3172 bytes Raw Blame History
1 # 2006 October 1
2 #
3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
5 #
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
9 #
10 #*************************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this script is testing the FTS3 module, and in particular
13 # the Porter stemmer.
14 #
15 # $Id: fts3ad.test,v 1.1 2007/08/20 17:38:42 shess Exp $
16 #
17
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
20
21 # If SQLITE_ENABLE_FTS3 is defined, omit this file.
22 ifcapable !fts3 {
23 finish_test
24 return
25 }
26
27 do_test fts3ad-1.1 {
28 execsql {
29 CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize porter);
30 INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
31 SELECT rowid FROM t1 WHERE content MATCH 'run jump';
32 }
33 } {1}
34 do_test fts3ad-1.2 {
35 execsql {
36 SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'run jump';
37 }
38 } {{running and jumping}}
39 do_test fts3ad-1.3 {
40 execsql {
41 INSERT INTO t1(rowid, content)
42 VALUES(2, 'abcdefghijklmnopqrstuvwyxz');
43 SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijqrstuvwyxz'
44 }
45 } {2 abcdefghijklmnopqrstuvwyxz}
46 do_test fts3ad-1.4 {
47 execsql {
48 SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijXXXXqrstuvwyxz'
49 }
50 } {2 abcdefghijklmnopqrstuvwyxz}
51 do_test fts3ad-1.5 {
52 execsql {
53 INSERT INTO t1(rowid, content)
54 VALUES(3, 'The value is `123456789`');
55 SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123789'
56 }
57 } {3 {The value is `123456789`}}
58 do_test fts3ad-1.6 {
59 execsql {
60 SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '`123000000789`'
61 }
62 } {3 {The value is `123456789`}}
63
64 do_test fts3ad-2.1 {
65 execsql {
66 DROP TABLE t1;
67 CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize porter);
68 INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
69 SELECT rowid FROM t1 WHERE content MATCH 'run jump';
70 }
71 } {1}
72 do_test fts3ad-2.2 {
73 execsql {
74 DROP TABLE t1;
75 CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize= porter);
76 INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
77 SELECT rowid FROM t1 WHERE content MATCH 'run jump';
78 }
79 } {1}
80 do_test fts3ad-2.3 {
81 execsql {
82 DROP TABLE t1;
83 CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize= simple);
84 INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
85 SELECT rowid FROM t1 WHERE content MATCH 'run jump';
86 }
87 } {}
88 do_test fts3ad-2.4 {
89 execsql {
90 DROP TABLE t1;
91 CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize= porter);
92 INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
93 SELECT rowid FROM t1 WHERE content MATCH 'run jump';
94 }
95 } {1}
96 do_test fts3ad-2.5 {
97 execsql {
98 DROP TABLE t1;
99 CREATE VIRTUAL TABLE t1 USING fts3(content, tokenize = porter);
100 INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
101 SELECT rowid FROM t1 WHERE content MATCH 'run jump';
102 }
103 } {1}
104
105
106 finish_test