drh | 326a67d | 2011-03-26 15:05:27 +0000 | [diff] [blame] | 1 | # 2011 March 25 |
| 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 TCL interface to the |
| 12 | # SQLite library. |
| 13 | # |
| 14 | # The focus of the tests is the word-fuzzer virtual table. |
| 15 | # |
| 16 | |
| 17 | set testdir [file dirname $argv0] |
| 18 | source $testdir/tester.tcl |
| 19 | |
| 20 | ifcapable !vtab { |
| 21 | finish_test |
| 22 | return |
| 23 | } |
| 24 | |
| 25 | register_fuzzer_module db |
| 26 | do_test fuzzer1-1.0 { |
| 27 | catchsql {CREATE VIRTUAL TABLE fault1 USING fuzzer;} |
| 28 | } {1 {fuzzer virtual tables must be TEMP}} |
| 29 | do_test fuzzer1-1.1 { |
| 30 | db eval {CREATE VIRTUAL TABLE temp.f1 USING fuzzer;} |
| 31 | } {} |
| 32 | do_test fuzzer1-1.2 { |
| 33 | db eval { |
drh | 9416956 | 2011-03-26 19:04:47 +0000 | [diff] [blame] | 34 | INSERT INTO f1(cfrom, cto, cost) VALUES('e','a',1); |
drh | 72384dc | 2011-03-29 14:08:09 +0000 | [diff] [blame^] | 35 | INSERT INTO f1(cfrom, cto, cost) VALUES('a','e',10); |
| 36 | INSERT INTO f1(cfrom, cto, cost) VALUES('e','o',100); |
drh | 9416956 | 2011-03-26 19:04:47 +0000 | [diff] [blame] | 37 | } |
| 38 | } {} |
| 39 | |
| 40 | do_test fuzzer1-1.3 { |
| 41 | db eval { |
| 42 | SELECT word, distance FROM f1 WHERE word MATCH 'abcde' |
drh | 326a67d | 2011-03-26 15:05:27 +0000 | [diff] [blame] | 43 | } |
| 44 | } {} |
| 45 | |
| 46 | |
| 47 | finish_test |