3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #*************************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this script is testing the FTS4 module.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 source $testdir/fts3_common.tcl
19 set testprefix fts4record
21 # If SQLITE_ENABLE_FTS3 is defined, omit this file.
27 sqlite3_fts3_may_be_corrupt 1
30 CREATE VIRTUAL TABLE t1 USING fts4(x);
31 INSERT INTO t1 VALUES('terma terma terma termb');
35 SELECT quote(root) FROM t1_segdir
37 X'00057465726D6105010203030004016203010500'
40 proc make_record_wrapper {args} { make_fts3record $args }
41 db func record make_record_wrapper
45 record(0, 5, 'terma', 5, 1, 2, 3, 3, 0,
46 4, 1, 'b' , 3, 1, 5, 0
49 X'00057465726D6105010203030004016203010500'
52 do_execsql_test 1.3.1 {
53 UPDATE t1_segdir SET root =
54 record(0, 5, 'terma', 5, 1, 2, 3, 3, 0,
56 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
57 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
58 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0
62 do_catchsql_test 1.3.2 {
63 SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'term*'
64 } {1 {database disk image is malformed}}
66 do_execsql_test 1.4.1 {
67 UPDATE t1_segdir SET root =
68 record(0, 5, 'terma', 5, 1, 2, 3, 3, 0,
70 256, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
71 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
72 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0
76 do_catchsql_test 1.4.2 {
77 SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'term*'
78 } {1 {database disk image is malformed}}
80 do_execsql_test 1.4.3 {
81 SELECT quote(root) FROM t1_segdir
83 X'00057465726D610501020303000401620401058002010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100'
86 do_execsql_test 1.5.1 {
87 UPDATE t1_segdir SET root =
88 record(0, 5, 'terma', 5, 1, 2, 3, 3, 0,
90 256, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
91 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
92 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0
96 do_catchsql_test 1.4.2 {
97 SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'term*'
98 } {1 {database disk image is malformed}}
100 do_execsql_test 1.4.3 {
101 SELECT quote(root) FROM t1_segdir
103 X'00057465726D610501020303000401620401058002010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100'
107 do_execsql_test 1.5.1 {
108 UPDATE t1_segdir SET root =
109 X'00057465726D61050102030300040162040105FF00010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100'
112 do_catchsql_test 1.5.2 {
113 SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'term*'
114 } {1 {database disk image is malformed}}
116 do_catchsql_test 1.5.3 {
117 INSERT INTO t1(t1) VALUES('integrity-check');
118 } {1 {database disk image is malformed}}