1*cb0e04f9Sdrh# 2018-12-12 2*cb0e04f9Sdrh# 3*cb0e04f9Sdrh# The author disclaims copyright to this source code. In place of 4*cb0e04f9Sdrh# a legal notice, here is a blessing: 5*cb0e04f9Sdrh# 6*cb0e04f9Sdrh# May you do good and not evil. 7*cb0e04f9Sdrh# May you find forgiveness for yourself and forgive others. 8*cb0e04f9Sdrh# May you share freely, never taking more than you give. 9*cb0e04f9Sdrh# 10*cb0e04f9Sdrh#*********************************************************************** 11*cb0e04f9Sdrh# 12*cb0e04f9Sdrh# Test cases found by Matthew Denton's fuzzer at Chrome. 13*cb0e04f9Sdrh# 14*cb0e04f9Sdrh 15*cb0e04f9Sdrh 16*cb0e04f9Sdrhset testdir [file dirname $argv0] 17*cb0e04f9Sdrhsource $testdir/tester.tcl 18*cb0e04f9Sdrh 19*cb0e04f9Sdrhdo_execsql_test fuzz4-100 { 20*cb0e04f9Sdrh CREATE TABLE Table0 (Col0 NOT NULL DEFAULT (CURRENT_TIME IS 1 > 1)); 21*cb0e04f9Sdrh INSERT OR REPLACE INTO Table0 DEFAULT VALUES ; 22*cb0e04f9Sdrh SELECT * FROM Table0; 23*cb0e04f9Sdrh} {0} 24*cb0e04f9Sdrh 25*cb0e04f9Sdrhdo_execsql_test fuzz4-110 { 26*cb0e04f9Sdrh CREATE TABLE Table1( 27*cb0e04f9Sdrh Col0 TEXT DEFAULT (CASE WHEN 1 IS 3530822107858468864 28*cb0e04f9Sdrh THEN 1 ELSE quote(1) IS 3530822107858468864 END) 29*cb0e04f9Sdrh ); 30*cb0e04f9Sdrh INSERT INTO Table1 DEFAULT VALUES; 31*cb0e04f9Sdrh SELECT * FROM Table1; 32*cb0e04f9Sdrh} {0} 33*cb0e04f9Sdrh 34*cb0e04f9Sdrhdo_execsql_test fuzz4-200 { 35*cb0e04f9Sdrh CREATE TABLE Table2a( 36*cb0e04f9Sdrh Col0 NOT NULL DEFAULT (CURRENT_TIME IS 1 IS NOT 1 > 1) 37*cb0e04f9Sdrh ); 38*cb0e04f9Sdrh INSERT OR REPLACE INTO Table2a DEFAULT VALUES; 39*cb0e04f9Sdrh SELECT * FROM Table2a; 40*cb0e04f9Sdrh} {0} 41*cb0e04f9Sdrh 42*cb0e04f9Sdrhdo_execsql_test fuzz4-210 { 43*cb0e04f9Sdrh CREATE TABLE Table2b (Col0 NOT NULL DEFAULT (CURRENT_TIME IS NOT FALSE)) ; 44*cb0e04f9Sdrh INSERT OR REPLACE INTO Table2b DEFAULT VALUES ; 45*cb0e04f9Sdrh SELECT * FROM Table2b; 46*cb0e04f9Sdrh} {1} 47*cb0e04f9Sdrh 48*cb0e04f9Sdrhdo_execsql_test fuzz4-300 { 49*cb0e04f9Sdrh CREATE TABLE Table3 (Col0 DEFAULT (CURRENT_TIMESTAMP BETWEEN 1 AND 1)); 50*cb0e04f9Sdrh INSERT INTO Table3 DEFAULT VALUES; 51*cb0e04f9Sdrh SELECT * FROM Table3; 52*cb0e04f9Sdrh} {0} 53*cb0e04f9Sdrh 54*cb0e04f9Sdrhdo_execsql_test fuzz4-400 { 55*cb0e04f9Sdrh CREATE TABLE Table4 (Col0 DEFAULT (1 BETWEEN CURRENT_TIMESTAMP AND 1)); 56*cb0e04f9Sdrh INSERT INTO Table4 DEFAULT VALUES; 57*cb0e04f9Sdrh SELECT * FROM Table4; 58*cb0e04f9Sdrh} {0} 59*cb0e04f9Sdrh 60*cb0e04f9Sdrhdo_execsql_test fuzz4-500 { 61*cb0e04f9Sdrh CREATE TABLE Table5 (Col0 DEFAULT (1 BETWEEN 1 AND CURRENT_TIMESTAMP)); 62*cb0e04f9Sdrh INSERT INTO Table5 DEFAULT VALUES; 63*cb0e04f9Sdrh SELECT * FROM Table5; 64*cb0e04f9Sdrh} {1} 65*cb0e04f9Sdrh 66*cb0e04f9Sdrhdo_execsql_test fuzz4-600 { 67*cb0e04f9Sdrh CREATE TEMPORARY TABLE Table6( 68*cb0e04f9Sdrh Col0 DEFAULT (CASE x'5d' WHEN 1 THEN 69*cb0e04f9Sdrh CASE CURRENT_TIMESTAMP WHEN 1 THEN 1 ELSE 1 END 70*cb0e04f9Sdrh ELSE CASE WHEN 1 THEN FALSE END END ) 71*cb0e04f9Sdrh ); 72*cb0e04f9Sdrh INSERT INTO temp.Table6 DEFAULT VALUES ; 73*cb0e04f9Sdrh SELECT * FROM Table6; 74*cb0e04f9Sdrh} {0} 75*cb0e04f9Sdrhdo_execsql_test fuzz4-610 { 76*cb0e04f9Sdrh WITH TableX AS (SELECT DISTINCT * ORDER BY 1 , 1 COLLATE RTRIM) 77*cb0e04f9Sdrh DELETE FROM Table6 WHERE Col0 || +8388608 ; 78*cb0e04f9Sdrh SELECT * FROM Table6; 79*cb0e04f9Sdrh} {} 80*cb0e04f9Sdrh 81*cb0e04f9Sdrh 82*cb0e04f9Sdrhfinish_test 83