blob: aaceaf1ce14e7a6759872f9dcd6f043cdbe202e5 [file] [log] [blame]
drh326a67d2011-03-26 15:05:27 +00001# 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 {
drh94169562011-03-26 19:04:47 +000034 INSERT INTO f1(cfrom, cto, cost) VALUES('e','a',1);
drh72384dc2011-03-29 14:08:09 +000035 INSERT INTO f1(cfrom, cto, cost) VALUES('a','e',10);
36 INSERT INTO f1(cfrom, cto, cost) VALUES('e','o',100);
drh94169562011-03-26 19:04:47 +000037 }
38} {}
39
40do_test fuzzer1-1.3 {
41 db eval {
42 SELECT word, distance FROM f1 WHERE word MATCH 'abcde'
drh326a67d2011-03-26 15:05:27 +000043 }
44} {}
45
46
47finish_test