Snapshot of upstream SQLite 3.15.2
[sqlcipher.git] / ext / fts5 / test / fts5fuzz1.test
blob599d7bcc89d65f7ca94113b65804a21e9b98b976
1 # 2014 June 17
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 SQLite library.  The
12 # focus of this script is testing the FTS5 module.
15 source [file join [file dirname [info script]] fts5_common.tcl]
16 return_if_no_fts5
17 set testprefix fts5fuzz1
20 #-------------------------------------------------------------------------
21 reset_db
22 do_catchsql_test 1.1 {
23   CREATE VIRTUAL TABLE f1 USING fts5(a\f b);
24 } {/1 {parse error in.*}/}
27 #-------------------------------------------------------------------------
28 reset_db
29 do_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');
35 do_execsql_test 2.2.1 {
36   SELECT rowid FROM f1('""');
37 } {}
39 do_execsql_test 2.2.2 {
40   SELECT rowid FROM f1('"" AND a');
41 } {}
44 do_execsql_test 2.2.3 {
45   SELECT rowid FROM f1('"" a');
46 } {1 2}
48 do_execsql_test 2.2.4 {
49   SELECT rowid FROM f1('"" OR a');
50 } {1 2}
52 do_execsql_test 2.3 {
53   SELECT a, b FROM f1('NEAR("")');
54 } {}
56 do_execsql_test 2.4 {
57   SELECT a, b FROM f1('NEAR("", 5)');
58 } {}
60 do_execsql_test 2.5 {
61   SELECT a, b FROM f1('NEAR("" c, 5)');
62 } {{a b} {c d}}
64 do_execsql_test 2.6 {
65   SELECT a, b FROM f1('NEAR("" c d, 5)');
66 } {{a b} {c d}}
68 do_execsql_test 2.7 {
69   SELECT a, b FROM f1('NEAR(c d, 5)');
70 } {{a b} {c d}}
72 do_execsql_test 2.8 {
73   SELECT rowid FROM f1('NEAR("a" "b", 5)');
74 } {1 2}
76 #-------------------------------------------------------------------------
77 reset_db
78 do_execsql_test 3.2 {
79   CREATE VIRTUAL TABLE f2 USING fts5(o, t, tokenize="ascii separators abc");
80   SELECT * FROM f2('a+4');
81 } {}
85 #-------------------------------------------------------------------------
86 reset_db
87 do_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 "`"}}
92 finish_test