1# 2014 June 17 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 SQLite library. The 12# focus of this script is testing the FTS5 module. 13# 14 15source [file join [file dirname [info script]] fts5_common.tcl] 16return_if_no_fts5 17set testprefix fts5fuzz1 18 19 20#------------------------------------------------------------------------- 21reset_db 22do_catchsql_test 1.1 { 23 CREATE VIRTUAL TABLE f1 USING fts5(a b); 24} {/1 {parse error in.*}/} 25 26 27#------------------------------------------------------------------------- 28reset_db 29do_execsql_test 2.1 { 30 CREATE VIRTUAL TABLE f1 USING fts5(a, b); 31 INSERT INTO f1 VALUES('a b', 'c d'); 32 INSERT INTO f1 VALUES('e f', 'a b'); 33} 34 35do_execsql_test 2.2.1 { 36 SELECT rowid FROM f1('""'); 37} {} 38 39do_execsql_test 2.2.2 { 40 SELECT rowid FROM f1('"" AND a'); 41} {} 42 43 44do_execsql_test 2.2.3 { 45 SELECT rowid FROM f1('"" a'); 46} {1 2} 47 48do_execsql_test 2.2.4 { 49 SELECT rowid FROM f1('"" OR a'); 50} {1 2} 51 52do_execsql_test 2.3 { 53 SELECT a, b FROM f1('NEAR("")'); 54} {} 55 56do_execsql_test 2.4 { 57 SELECT a, b FROM f1('NEAR("", 5)'); 58} {} 59 60do_execsql_test 2.5 { 61 SELECT a, b FROM f1('NEAR("" c, 5)'); 62} {{a b} {c d}} 63 64do_execsql_test 2.6 { 65 SELECT a, b FROM f1('NEAR("" c d, 5)'); 66} {{a b} {c d}} 67 68do_execsql_test 2.7 { 69 SELECT a, b FROM f1('NEAR(c d, 5)'); 70} {{a b} {c d}} 71 72do_execsql_test 2.8 { 73 SELECT rowid FROM f1('NEAR("a" "b", 5)'); 74} {1 2} 75 76#------------------------------------------------------------------------- 77reset_db 78do_execsql_test 3.2 { 79 CREATE VIRTUAL TABLE f2 USING fts5(o, t, tokenize="ascii separators abc"); 80 SELECT * FROM f2('a+4'); 81} {} 82 83 84 85#------------------------------------------------------------------------- 86reset_db 87do_catchsql_test 4.1 { 88 CREATE VIRTUAL TABLE f2 USING fts5(o, t); 89 SELECT * FROM f2('(8 AND 9)`AND 10'); 90} {1 {fts5: syntax error near "`"}} 91 92finish_test 93