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 17set testdir [file dirname $argv0] 18source $testdir/tester.tcl 19 20ifcapable !vtab { 21 finish_test 22 return 23} 24 25register_fuzzer_module db 26do_test fuzzer1-1.0 { 27 catchsql {CREATE VIRTUAL TABLE fault1 USING fuzzer;} 28} {1 {fuzzer virtual tables must be TEMP}} 29do_test fuzzer1-1.1 { 30 db eval {CREATE VIRTUAL TABLE temp.f1 USING fuzzer;} 31} {} 32do_test fuzzer1-1.2 { 33 db eval { 34 INSERT INTO f1(cfrom, cto, cost) VALUES('e','a',1); 35 INSERT INTO f1(cfrom, cto, cost) VALUES('a','e',10); 36 INSERT INTO f1(cfrom, cto, cost) VALUES('e','o',100); 37 } 38} {} 39 40do_test fuzzer1-1.3 { 41 db eval { 42 SELECT word, distance FROM f1 WHERE word MATCH 'abcde' 43 } 44} {abcde 0 abcda 1 ebcde 10 ebcda 11 abcdo 100 ebcdo 110 obcde 110 obcda 111 obcdo 210} 45 46 47finish_test 48