3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
11 # This file implements regression tests for TCL interface to the
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 ifcapable !vtab { finish_test ; return }
18 set ::testprefix fuzzerfault
20 load_static_extension db fuzzer
24 CREATE TABLE x1_rules(ruleset, cFrom, cTo, cost);
25 INSERT INTO x1_rules VALUES(0, 'a', 'b', 1);
26 INSERT INTO x1_rules VALUES(0, 'a', 'c', 2);
27 INSERT INTO x1_rules VALUES(0, 'a', 'd', 3);
29 faultsim_save_and_close
31 do_faultsim_test 1 -prep {
32 faultsim_restore_and_reopen
33 load_static_extension db fuzzer
36 CREATE VIRTUAL TABLE x1 USING fuzzer(x1_rules);
37 SELECT word FROM x1 WHERE word MATCH 'xax';
40 faultsim_test_result {0 {xax xbx xcx xdx}} \
41 {1 {vtable constructor failed: x1}}
45 faultsim_delete_and_reopen
46 load_static_extension db fuzzer
48 CREATE TABLE x2_rules(ruleset, cFrom, cTo, cost);
49 INSERT INTO x2_rules VALUES(0, 'a', 'x', 1);
50 INSERT INTO x2_rules VALUES(0, 'b', 'x', 2);
51 INSERT INTO x2_rules VALUES(0, 'c', 'x', 3);
52 CREATE VIRTUAL TABLE x2 USING fuzzer(x2_rules);
54 faultsim_save_and_close
57 do_faultsim_test 2 -prep {
58 faultsim_restore_and_reopen
59 load_static_extension db fuzzer
62 SELECT count(*) FROM x2 WHERE word MATCH 'abc';
65 faultsim_test_result {0 8} {1 {vtable constructor failed: x2}}
69 faultsim_delete_and_reopen
71 CREATE TABLE x1_rules(ruleset, cFrom, cTo, cost);
72 INSERT INTO x1_rules VALUES(0, 'a',
73 '123456789012345678901234567890a1234567890123456789', 10
76 faultsim_save_and_close
79 do_faultsim_test 3 -prep {
80 faultsim_restore_and_reopen
81 load_static_extension db fuzzer
84 CREATE VIRTUAL TABLE x1 USING fuzzer(x1_rules);
85 SELECT count(*) FROM (SELECT * FROM x1 WHERE word MATCH 'a' LIMIT 2);
88 faultsim_test_result {0 2} {1 {vtable constructor failed: x1}}