xref: /sqlite-3.40.0/test/analyzer1.test (revision 8906b7db)
1# 2015-05-11
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# Quick tests for the sqlite3_analyzer tool
13#
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16if {$tcl_platform(platform)=="windows"} {
17  set PROG "sqlite3_analyzer.exe"
18} else {
19  set PROG "./sqlite3_analyzer"
20}
21db close
22forcedelete test.db test.db-journal test.db-wal
23sqlite3 db test.db
24
25do_test analyzer1-1.0 {
26  db eval {
27    CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
28    CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID;
29    WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<250)
30    INSERT INTO t1(a,b) SELECT x, randomblob(200) FROM c;
31    INSERT INTO t2(a,b) SELECT a, b FROM t1;
32  }
33  set line "exec $PROG test.db"
34  unset -nocomplain ::MSG
35  catch {eval $line} ::MSG
36} {0}
37do_test analyzer1-1.1 {
38  regexp {^/\*\* Disk-Space Utilization.*COMMIT;\W*$} $::MSG
39} {1}
40
41finish_test
42