xref: /sqlite-3.40.0/test/fuzz4.test (revision cb0e04f9)
1# 2018-12-12
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#
12# Test cases found by Matthew Denton's fuzzer at Chrome.
13#
14
15
16set testdir [file dirname $argv0]
17source $testdir/tester.tcl
18
19do_execsql_test fuzz4-100 {
20  CREATE TABLE Table0 (Col0  NOT NULL DEFAULT (CURRENT_TIME IS 1 > 1));
21  INSERT OR REPLACE INTO Table0 DEFAULT VALUES ;
22  SELECT * FROM Table0;
23} {0}
24
25do_execsql_test fuzz4-110 {
26  CREATE TABLE Table1(
27    Col0 TEXT DEFAULT (CASE WHEN 1 IS 3530822107858468864
28                            THEN 1 ELSE quote(1) IS 3530822107858468864 END)
29  );
30  INSERT INTO Table1 DEFAULT VALUES;
31  SELECT * FROM Table1;
32} {0}
33
34do_execsql_test fuzz4-200 {
35  CREATE TABLE Table2a(
36     Col0  NOT NULL   DEFAULT (CURRENT_TIME IS 1  IS NOT 1  > 1)
37  );
38  INSERT OR REPLACE INTO Table2a DEFAULT VALUES;
39  SELECT * FROM Table2a;
40} {0}
41
42do_execsql_test fuzz4-210 {
43  CREATE TABLE Table2b (Col0  NOT NULL  DEFAULT (CURRENT_TIME  IS NOT FALSE)) ;
44  INSERT OR REPLACE INTO Table2b DEFAULT VALUES ;
45  SELECT * FROM Table2b;
46} {1}
47
48do_execsql_test fuzz4-300 {
49  CREATE TABLE Table3 (Col0 DEFAULT (CURRENT_TIMESTAMP BETWEEN 1 AND 1));
50  INSERT INTO Table3 DEFAULT VALUES;
51  SELECT * FROM Table3;
52} {0}
53
54do_execsql_test fuzz4-400 {
55  CREATE TABLE Table4 (Col0 DEFAULT (1 BETWEEN CURRENT_TIMESTAMP AND 1));
56  INSERT INTO Table4 DEFAULT VALUES;
57  SELECT * FROM Table4;
58} {0}
59
60do_execsql_test fuzz4-500 {
61  CREATE TABLE Table5 (Col0 DEFAULT (1 BETWEEN 1 AND CURRENT_TIMESTAMP));
62  INSERT INTO Table5 DEFAULT VALUES;
63  SELECT * FROM Table5;
64} {1}
65
66do_execsql_test fuzz4-600 {
67  CREATE TEMPORARY TABLE Table6(
68    Col0 DEFAULT (CASE x'5d' WHEN 1 THEN
69        CASE CURRENT_TIMESTAMP WHEN 1 THEN 1 ELSE 1 END
70        ELSE CASE WHEN 1 THEN FALSE END  END )
71  );
72  INSERT INTO temp.Table6 DEFAULT VALUES ;
73  SELECT * FROM Table6;
74} {0}
75do_execsql_test fuzz4-610 {
76  WITH TableX AS (SELECT DISTINCT * ORDER BY 1  , 1 COLLATE RTRIM)
77      DELETE FROM Table6  WHERE Col0 || +8388608  ;
78  SELECT * FROM Table6;
79} {}
80
81
82finish_test
83