OLD | NEW |
1 # 2010 June 15 | 1 # 2010 June 15 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # | 11 # |
12 | 12 |
13 set testdir [file dirname $argv0] | 13 set testdir [file dirname $argv0] |
14 source $testdir/tester.tcl | 14 source $testdir/tester.tcl |
15 | 15 |
16 set ::testprefix fts3fault | 16 set ::testprefix fts3fault |
17 | 17 |
18 # If SQLITE_ENABLE_FTS3 is not defined, omit this file. | 18 # If SQLITE_ENABLE_FTS3 is not defined, omit this file. |
19 ifcapable !fts3 { finish_test ; return } | 19 ifcapable !fts3 { finish_test ; return } |
20 | 20 |
| 21 if 0 { |
| 22 |
21 # Test error handling in the sqlite3Fts3Init() function. This is the | 23 # Test error handling in the sqlite3Fts3Init() function. This is the |
22 # function that registers the FTS3 module and various support functions | 24 # function that registers the FTS3 module and various support functions |
23 # with SQLite. | 25 # with SQLite. |
24 # | 26 # |
25 do_faultsim_test 1 -body { | 27 do_faultsim_test 1 -body { |
26 sqlite3 db test.db | 28 sqlite3 db test.db |
27 expr 0 | 29 expr 0 |
28 } -test { | 30 } -test { |
29 catch { db close } | 31 catch { db close } |
30 } | 32 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 do_faultsim_test 7.3 -prep { | 152 do_faultsim_test 7.3 -prep { |
151 faultsim_delete_and_reopen | 153 faultsim_delete_and_reopen |
152 } -body { | 154 } -body { |
153 execsql { CREATE VIRTUAL TABLE t1 USING fts4(a, b, matchnfo=fts3) } | 155 execsql { CREATE VIRTUAL TABLE t1 USING fts4(a, b, matchnfo=fts3) } |
154 } -test { | 156 } -test { |
155 faultsim_test_result {1 {unrecognized parameter: matchnfo=fts3}} \ | 157 faultsim_test_result {1 {unrecognized parameter: matchnfo=fts3}} \ |
156 {1 {vtable constructor failed: t1}} \ | 158 {1 {vtable constructor failed: t1}} \ |
157 {1 {SQL logic error or missing database}} | 159 {1 {SQL logic error or missing database}} |
158 } | 160 } |
159 | 161 |
| 162 |
| 163 } |
| 164 |
160 proc mit {blob} { | 165 proc mit {blob} { |
161 set scan(littleEndian) i* | 166 set scan(littleEndian) i* |
162 set scan(bigEndian) I* | 167 set scan(bigEndian) I* |
163 binary scan $blob $scan($::tcl_platform(byteOrder)) r | 168 binary scan $blob $scan($::tcl_platform(byteOrder)) r |
164 return $r | 169 return $r |
165 } | 170 } |
166 | 171 |
167 do_test 8.0 { | 172 do_test 8.0 { |
168 faultsim_delete_and_reopen | 173 faultsim_delete_and_reopen |
169 execsql { CREATE VIRTUAL TABLE t8 USING fts4 } | 174 execsql { CREATE VIRTUAL TABLE t8 USING fts4 } |
170 execsql "INSERT INTO t8 VALUES('a b c')" | 175 execsql "INSERT INTO t8 VALUES('a b c')" |
171 execsql "INSERT INTO t8 VALUES('b b b')" | 176 execsql "INSERT INTO t8 VALUES('b b b')" |
172 execsql "INSERT INTO t8 VALUES('[string repeat {c } 50000]')" | 177 execsql "INSERT INTO t8 VALUES('[string repeat {c } 50000]')" |
173 execsql "INSERT INTO t8 VALUES('d d d')" | 178 execsql "INSERT INTO t8 VALUES('d d d')" |
174 execsql "INSERT INTO t8 VALUES('e e e')" | 179 execsql "INSERT INTO t8 VALUES('e e e')" |
175 execsql "INSERT INTO t8(t8) VALUES('optimize')" | 180 execsql "INSERT INTO t8(t8) VALUES('optimize')" |
176 faultsim_save_and_close | 181 faultsim_save_and_close |
177 } {} | 182 } {} |
178 | 183 |
179 do_faultsim_test 8.1 -prep { | 184 do_faultsim_test 8.1 -faults oom-t* -prep { |
180 faultsim_restore_and_reopen | 185 faultsim_restore_and_reopen |
181 db func mit mit | 186 db func mit mit |
182 } -body { | 187 } -body { |
183 execsql { SELECT mit(matchinfo(t8, 'x')) FROM t8 WHERE t8 MATCH 'a b c' } | 188 execsql { SELECT mit(matchinfo(t8, 'x')) FROM t8 WHERE t8 MATCH 'a b c' } |
184 } -test { | 189 } -test { |
185 faultsim_test_result {0 {{1 1 1 1 4 2 1 5 5}}} | 190 faultsim_test_result {0 {{1 1 1 1 4 2 1 5 5}}} |
186 } | 191 } |
| 192 |
187 do_faultsim_test 8.2 -faults oom-t* -prep { | 193 do_faultsim_test 8.2 -faults oom-t* -prep { |
188 faultsim_restore_and_reopen | 194 faultsim_restore_and_reopen |
189 db func mit mit | 195 db func mit mit |
190 } -body { | 196 } -body { |
191 execsql { SELECT mit(matchinfo(t8, 's')) FROM t8 WHERE t8 MATCH 'a b c' } | 197 execsql { SELECT mit(matchinfo(t8, 's')) FROM t8 WHERE t8 MATCH 'a b c' } |
192 } -test { | 198 } -test { |
193 faultsim_test_result {0 3} | 199 faultsim_test_result {0 3} |
194 } | 200 } |
195 do_faultsim_test 8.3 -prep { | 201 do_faultsim_test 8.3 -prep { |
196 faultsim_restore_and_reopen | 202 faultsim_restore_and_reopen |
(...skipping 25 matching lines...) Expand all Loading... |
222 } {} | 228 } {} |
223 do_faultsim_test 9.1 -prep { | 229 do_faultsim_test 9.1 -prep { |
224 faultsim_restore_and_reopen | 230 faultsim_restore_and_reopen |
225 } -body { | 231 } -body { |
226 execsql { SELECT offsets(t9) FROM t9 WHERE t9 MATCH 'to*' } | 232 execsql { SELECT offsets(t9) FROM t9 WHERE t9 MATCH 'to*' } |
227 } -test { | 233 } -test { |
228 faultsim_test_result {0 {{0 0 20 39 0 0 64 2}}} | 234 faultsim_test_result {0 {{0 0 20 39 0 0 64 2}}} |
229 } | 235 } |
230 | 236 |
231 finish_test | 237 finish_test |
OLD | NEW |