2011-03-26 18:05:27 +03:00
|
|
|
# 2011 March 25
|
|
|
|
#
|
|
|
|
# The author disclaims copyright to this source code. In place of
|
|
|
|
# a legal notice, here is a blessing:
|
|
|
|
#
|
|
|
|
# May you do good and not evil.
|
|
|
|
# May you find forgiveness for yourself and forgive others.
|
|
|
|
# May you share freely, never taking more than you give.
|
|
|
|
#
|
|
|
|
#***********************************************************************
|
|
|
|
# This file implements regression tests for TCL interface to the
|
|
|
|
# SQLite library.
|
|
|
|
#
|
|
|
|
# The focus of the tests is the word-fuzzer virtual table.
|
|
|
|
#
|
|
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
|
|
source $testdir/tester.tcl
|
|
|
|
|
|
|
|
ifcapable !vtab {
|
|
|
|
finish_test
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
register_fuzzer_module db
|
|
|
|
do_test fuzzer1-1.0 {
|
|
|
|
catchsql {CREATE VIRTUAL TABLE fault1 USING fuzzer;}
|
|
|
|
} {1 {fuzzer virtual tables must be TEMP}}
|
|
|
|
do_test fuzzer1-1.1 {
|
|
|
|
db eval {CREATE VIRTUAL TABLE temp.f1 USING fuzzer;}
|
|
|
|
} {}
|
|
|
|
do_test fuzzer1-1.2 {
|
|
|
|
db eval {
|
2011-03-26 22:04:47 +03:00
|
|
|
INSERT INTO f1(cfrom, cto, cost) VALUES('e','a',1);
|
2011-03-29 18:08:09 +04:00
|
|
|
INSERT INTO f1(cfrom, cto, cost) VALUES('a','e',10);
|
|
|
|
INSERT INTO f1(cfrom, cto, cost) VALUES('e','o',100);
|
2011-03-26 22:04:47 +03:00
|
|
|
}
|
|
|
|
} {}
|
|
|
|
|
|
|
|
do_test fuzzer1-1.3 {
|
|
|
|
db eval {
|
|
|
|
SELECT word, distance FROM f1 WHERE word MATCH 'abcde'
|
2011-03-26 18:05:27 +03:00
|
|
|
}
|
|
|
|
} {}
|
|
|
|
|
|
|
|
|
|
|
|
finish_test
|