SQLite

Check-in [a195d74ff9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add test file test/count.test for testing "SELECT count(*)" statements. It is not properly populated yet. (CVS 6318)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a195d74ff9ce836447dba4da7edcc6f1cdae5574
User & Date: danielk1977 2009-02-24 10:48:28.000
Context
2009-02-24
16:18
Enhanced comments on table locking logic as it relates to preparing new statements. Added assert() and testcase() but no other changes to code. (CVS 6319) (check-in: 4a12f5b818 user: drh tags: trunk)
10:48
Add test file test/count.test for testing "SELECT count(*)" statements. It is not properly populated yet. (CVS 6318) (check-in: a195d74ff9 user: danielk1977 tags: trunk)
10:14
Reverse commit (6315) for now. (CVS 6317) (check-in: 0e7c369c23 user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Added test/count.test.
























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# 2009 February 24
#
# 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.  The
# focus of this file is testing "SELECT count(*)" statements.
#
# $Id: count.test,v 1.1 2009/02/24 10:48:28 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

set iTest 0
foreach zIndex [list {
  /* no-op */
} {
  CREATE INDEX i1 ON t1(a);
}] { 
  incr iTest
  do_test count-1.$iTest.1 {
    execsql {
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1(a, b);
    }
    execsql $zIndex
    execsql {
      INSERT INTO t1 VALUES(1, 2);
      INSERT INTO t1 VALUES(3, 4);
      SELECT count(*) FROM t1;
    }
  } {2}
  
  do_test count-1.$iTest.2 {
    execsql {
      INSERT INTO t1 SELECT * FROM t1;          --   4
      INSERT INTO t1 SELECT * FROM t1;          --   8
      INSERT INTO t1 SELECT * FROM t1;          --  16
      INSERT INTO t1 SELECT * FROM t1;          --  32
      INSERT INTO t1 SELECT * FROM t1;          --  64
      INSERT INTO t1 SELECT * FROM t1;          -- 128
      INSERT INTO t1 SELECT * FROM t1;          -- 256
      SELECT count(*) FROM t1;
    }
  } {256}
  
  do_test count-1.$iTest.3 {
    execsql {
      INSERT INTO t1 SELECT * FROM t1;          --  512
      INSERT INTO t1 SELECT * FROM t1;          -- 1024
      INSERT INTO t1 SELECT * FROM t1;          -- 2048
      INSERT INTO t1 SELECT * FROM t1;          -- 4096
      SELECT count(*) FROM t1;
    }
  } {4096}
  
  do_test count-1.$iTest.4 {
    execsql {
      BEGIN;
      INSERT INTO t1 SELECT * FROM t1;          --  8192
      INSERT INTO t1 SELECT * FROM t1;          -- 16384
      INSERT INTO t1 SELECT * FROM t1;          -- 32768
      INSERT INTO t1 SELECT * FROM t1;          -- 65536
      COMMIT;
      SELECT count(*) FROM t1;
    }
  } {65536}
}

finish_test