diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/auth.test | 6 | ||||
-rw-r--r-- | test/stat3.test | 56 |
2 files changed, 61 insertions, 1 deletions
diff --git a/test/auth.test b/test/auth.test index 8d2159ecd..5b97a9d74 100644 --- a/test/auth.test +++ b/test/auth.test @@ -2324,7 +2324,11 @@ ifcapable compound&&subquery { ifcapable stat2 { set stat2 "sqlite_stat2 " } else { - set stat2 "" + ifcapable stat3 { + set stat2 "sqlite_stat3 " + } else { + set stat2 "" + } } do_test auth-5.2 { execsql { diff --git a/test/stat3.test b/test/stat3.test new file mode 100644 index 000000000..780a69ce6 --- /dev/null +++ b/test/stat3.test @@ -0,0 +1,56 @@ +# 2011 August 08 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# This file implements regression tests for SQLite library. This file +# implements tests for the extra functionality provided by the ANALYZE +# command when the library is compiled with SQLITE_ENABLE_STAT2 defined. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +set testprefix stat3 + + +# Verify that if not compiled with SQLITE_ENABLE_STAT2 that the ANALYZE +# command will delete the sqlite_stat2 table. Likewise, if not compiled +# with SQLITE_ENABLE_STAT3, the sqlite_stat3 table is deleted. +# +do_test 1.1 { + db eval { + PRAGMA writable_schema=ON; + CREATE TABLE sqlite_stat2(tbl,idx,sampleno,sample); + CREATE TABLE sqlite_stat3(tbl,idx,sampleno,sample,neq,nlt); + SELECT name FROM sqlite_master ORDER BY 1; + } +} {sqlite_stat2 sqlite_stat3} +do_test 1.2 { + db close + sqlite3 db test.db + db eval {SELECT name FROM sqlite_master ORDER BY 1} +} {sqlite_stat2 sqlite_stat3} + +ifcapable {stat3} { + do_test 1.3 { + db eval {ANALYZE; SELECT name FROM sqlite_master ORDER BY 1} + } {sqlite_stat1 sqlite_stat3} +} else { + do_test 1.4 { + db eval {ANALYZE; SELECT name FROM sqlite_master ORDER BY 1} + } {sqlite_stat1} + finish_test + return +} + + + + +finish_test |