| OLD | NEW |
| 1 # 2009 February 24 | 1 # 2009-02-24 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| 11 # This file implements regression tests for SQLite library. The | 11 # This file implements regression tests for SQLite library. The |
| 12 # focus of this file is testing "SELECT count(*)" statements. | 12 # focus of this file is testing "SELECT count(*)" statements. |
| 13 # | 13 # |
| 14 # $Id: count.test,v 1.6 2009/06/05 17:09:12 drh Exp $ | |
| 15 | 14 |
| 16 set testdir [file dirname $argv0] | 15 set testdir [file dirname $argv0] |
| 17 source $testdir/tester.tcl | 16 source $testdir/tester.tcl |
| 18 | 17 |
| 19 # Test plan: | 18 # Test plan: |
| 20 # | 19 # |
| 21 # count-0.*: Make sure count(*) works on an empty database. (Ticket #3774) | 20 # count-0.*: Make sure count(*) works on an empty database. (Ticket #3774) |
| 22 # | 21 # |
| 23 # count-1.*: Test that the OP_Count instruction appears to work on both | 22 # count-1.*: Test that the OP_Count instruction appears to work on both |
| 24 # tables and indexes. Test both when they contain 0 entries, | 23 # tables and indexes. Test both when they contain 0 entries, |
| 25 # when all entries are on the root page, and when the b-tree | 24 # when all entries are on the root page, and when the b-tree |
| 26 # forms a structure 2 and 3 levels deep. | 25 # forms a structure 2 and 3 levels deep. |
| 27 # | |
| 28 # count-2.*: Test that | |
| 29 # | 26 # |
| 30 # | 27 # |
| 31 | 28 |
| 32 do_test count-0.1 { | 29 do_test count-0.1 { |
| 33 db eval { | 30 db eval { |
| 34 SELECT count(*) FROM sqlite_master; | 31 SELECT count(*) FROM sqlite_master; |
| 35 } | 32 } |
| 36 } {0} | 33 } {0} |
| 37 | 34 |
| 38 set iTest 0 | 35 set iTest 0 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 178 } |
| 182 } {1} | 179 } {1} |
| 183 do_test count-4.3 { | 180 do_test count-4.3 { |
| 184 execsql { | 181 execsql { |
| 185 DROP INDEX t4i1; | 182 DROP INDEX t4i1; |
| 186 CREATE INDEX t4i1 ON t4(b, a); | 183 CREATE INDEX t4i1 ON t4(b, a); |
| 187 SELECT count(*) FROM t4; | 184 SELECT count(*) FROM t4; |
| 188 } | 185 } |
| 189 } {1} | 186 } {1} |
| 190 | 187 |
| 188 do_execsql_test count-5.1 { |
| 189 CREATE TABLE t5(a TEXT PRIMARY KEY, b VARCHAR(50)) WITHOUT ROWID; |
| 190 INSERT INTO t5 VALUES('bison','jazz'); |
| 191 SELECT count(*) FROM t5; |
| 192 } {1} |
| 191 | 193 |
| 192 finish_test | 194 finish_test |
| OLD | NEW |