/ Check-in [3a289b6d]
Login

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

Overview
Comment:Use 1<<$x instead of pow(2,$x) in the test suite code. (CVS 4715)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3a289b6d28bcf399845586b15f100d7c3a78b550
User & Date: danielk1977 2008-01-16 18:20:42
Context
2008-01-17
02:36
Registerification of the WHERE clause logic. (CVS 4716) check-in: b3a141b2 user: drh tags: trunk
2008-01-16
18:20
Use 1<<$x instead of pow(2,$x) in the test suite code. (CVS 4715) check-in: 3a289b6d user: danielk1977 tags: trunk
17:46
Get all tests running without memory leaks. (CVS 4714) check-in: 5807921f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/expr.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing expressions.
    13     13   #
    14         -# $Id: expr.test,v 1.59 2007/09/01 18:24:55 danielk1977 Exp $
           14  +# $Id: expr.test,v 1.60 2008/01/16 18:20:42 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Create a table to work with.
    20     20   #
    21     21   execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)}
................................................................................
   507    507   # The sqliteExprIfFalse and sqliteExprIfTrue routines are only
   508    508   # executed as part of a WHERE clause.  Create a table suitable
   509    509   # for testing these functions.
   510    510   #
   511    511   execsql {DROP TABLE test1}
   512    512   execsql {CREATE TABLE test1(a int, b int);}
   513    513   for {set i 1} {$i<=20} {incr i} {
   514         -  execsql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])"
          514  +  execsql "INSERT INTO test1 VALUES($i,[expr {1<<$i}])"
   515    515   }
   516    516   execsql "INSERT INTO test1 VALUES(NULL,0)"
   517    517   do_test expr-7.1 {
   518    518     execsql {SELECT * FROM test1 ORDER BY a}
   519    519   } {{} 0 1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024 11 2048 12 4096 13 8192 14 16384 15 32768 16 65536 17 131072 18 262144 19 524288 20 1048576}
   520    520   
   521    521   proc test_expr2 {name expr result} {

Changes to test/in.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the IN and BETWEEN operator.
    13     13   #
    14         -# $Id: in.test,v 1.18 2007/12/13 18:24:22 danielk1977 Exp $
           14  +# $Id: in.test,v 1.19 2008/01/16 18:20:42 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Generate the test data we will need for the first squences of tests.
    20     20   #
    21     21   do_test in-1.0 {
    22     22     execsql {
    23     23       BEGIN;
    24     24       CREATE TABLE t1(a int, b int);
    25     25     }
    26     26     for {set i 1} {$i<=10} {incr i} {
    27         -    execsql "INSERT INTO t1 VALUES($i,[expr {int(pow(2,$i))}])"
           27  +    execsql "INSERT INTO t1 VALUES($i,[expr {1<<$i}])"
    28     28     }
    29     29     execsql {
    30     30       COMMIT;
    31     31       SELECT count(*) FROM t1;
    32     32     }
    33     33   } {10}
    34     34   

Changes to test/index.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the CREATE INDEX statement.
    13     13   #
    14         -# $Id: index.test,v 1.42 2006/03/29 00:24:07 drh Exp $
           14  +# $Id: index.test,v 1.43 2008/01/16 18:20:42 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Create a basic index and verify it is added to sqlite_master
    20     20   #
    21     21   do_test index-1.1 {
................................................................................
   110    110   #
   111    111   # Note that the index names "index9" and "indext" are chosen because
   112    112   # they both have the same hash.
   113    113   #
   114    114   do_test index-4.1 {
   115    115     execsql {CREATE TABLE test1(cnt int, power int)}
   116    116     for {set i 1} {$i<20} {incr i} {
   117         -    execsql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])"
          117  +    execsql "INSERT INTO test1 VALUES($i,[expr {1<<$i}])"
   118    118     }
   119    119     execsql {CREATE INDEX index9 ON test1(cnt)}
   120    120     execsql {CREATE INDEX indext ON test1(power)}
   121    121     execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name}
   122    122   } {index9 indext test1}
   123    123   do_test index-4.2 {
   124    124     execsql {SELECT cnt FROM test1 WHERE power=4}
................................................................................
   217    217   
   218    218   
   219    219   # Create a primary key
   220    220   #
   221    221   do_test index-7.1 {
   222    222     execsql {CREATE TABLE test1(f1 int, f2 int primary key)}
   223    223     for {set i 1} {$i<20} {incr i} {
   224         -    execsql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])"
          224  +    execsql "INSERT INTO test1 VALUES($i,[expr {1<<$i}])"
   225    225     }
   226    226     execsql {SELECT count(*) FROM test1}
   227    227   } {19}
   228    228   do_test index-7.2 {
   229    229     execsql {SELECT f1 FROM test1 WHERE f2=65536}
   230    230   } {16}
   231    231   do_test index-7.3 {

Changes to test/insert2.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the INSERT statement that takes is
    13     13   # result from a SELECT.
    14     14   #
    15         -# $Id: insert2.test,v 1.18 2005/10/05 11:35:09 drh Exp $
           15  +# $Id: insert2.test,v 1.19 2008/01/16 18:20:42 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Create some tables with data that we can select against
    21     21   #
    22     22   do_test insert2-1.0 {
    23     23     execsql {CREATE TABLE d1(n int, log int);}
    24     24     for {set i 1} {$i<=20} {incr i} {
    25         -    for {set j 0} {pow(2,$j)<$i} {incr j} {}
           25  +    for {set j 0} {(1<<$j)<$i} {incr j} {}
    26     26       execsql "INSERT INTO d1 VALUES($i,$j)"
    27     27     }
    28     28     execsql {SELECT * FROM d1 ORDER BY n}
    29     29   } {1 0 2 1 3 2 4 2 5 3 6 3 7 3 8 3 9 4 10 4 11 4 12 4 13 4 14 4 15 4 16 4 17 5 18 5 19 5 20 5}
    30     30   
    31     31   # Insert into a new table from the old one.
    32     32   #

Changes to test/limit.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the LIMIT ... OFFSET ... clause
    13     13   #  of SELECT statements.
    14     14   #
    15         -# $Id: limit.test,v 1.30 2006/06/20 11:01:09 danielk1977 Exp $
           15  +# $Id: limit.test,v 1.31 2008/01/16 18:20:42 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Build some test data
    21     21   #
    22     22   execsql {
    23     23     CREATE TABLE t1(x int, y int);
    24     24     BEGIN;
    25     25   }
    26     26   for {set i 1} {$i<=32} {incr i} {
    27         -  for {set j 0} {pow(2,$j)<$i} {incr j} {}
           27  +  for {set j 0} {(1<<$j)<$i} {incr j} {}
    28     28     execsql "INSERT INTO t1 VALUES([expr {32-$i}],[expr {10-$j}])"
    29     29   }
    30     30   execsql {
    31     31     COMMIT;
    32     32   }
    33     33   
    34     34   do_test limit-1.0 {

Changes to test/quick.test.

     2      2   #    May you do good and not evil.
     3      3   #    May you find forgiveness for yourself and forgive others.
     4      4   #    May you share freely, never taking more than you give.
     5      5   #
     6      6   #***********************************************************************
     7      7   # This file runs all tests.
     8      8   #
     9         -# $Id: quick.test,v 1.68 2008/01/08 18:57:50 drh Exp $
            9  +# $Id: quick.test,v 1.69 2008/01/16 18:20:42 danielk1977 Exp $
    10     10   
    11     11   proc lshift {lvar} {
    12     12     upvar $lvar l
    13     13     set ret [lindex $l 0]
    14     14     set l [lrange $l 1 end]
    15     15     return $ret
    16     16   }
................................................................................
   107    107       set sqlite_open_file_count 0
   108    108     }
   109    109   }
   110    110   source $testdir/misuse.test
   111    111   
   112    112   set sqlite_open_file_count 0
   113    113   really_finish_test
          114  +
          115  +

Changes to test/select3.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing aggregate functions and the
    13     13   # GROUP BY and HAVING clauses of SELECT statements.
    14     14   #
    15         -# $Id: select3.test,v 1.22 2007/12/13 07:58:51 danielk1977 Exp $
           15  +# $Id: select3.test,v 1.23 2008/01/16 18:20:42 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Build some test data
    21     21   #
    22     22   do_test select3-1.0 {
    23     23     execsql {
    24     24       CREATE TABLE t1(n int, log int);
    25     25       BEGIN;
    26     26     }
    27     27     for {set i 1} {$i<32} {incr i} {
    28         -    for {set j 0} {pow(2,$j)<$i} {incr j} {}
           28  +    for {set j 0} {(1<<$j)<$i} {incr j} {}
    29     29       execsql "INSERT INTO t1 VALUES($i,$j)"
    30     30     }
    31     31     execsql {
    32     32       COMMIT
    33     33     }
    34     34     execsql {SELECT DISTINCT log FROM t1 ORDER BY log}
    35     35   } {0 1 2 3 4 5}

Changes to test/select4.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing UNION, INTERSECT and EXCEPT operators
    13     13   # in SELECT statements.
    14     14   #
    15         -# $Id: select4.test,v 1.25 2008/01/12 12:48:09 drh Exp $
           15  +# $Id: select4.test,v 1.26 2008/01/16 18:20:42 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Most tests in this file depend on compound-select. But there are a couple
    21     21   # right at the end that test DISTINCT, so we cannot omit the entire file.
    22     22   #
................................................................................
    25     25   # Build some test data
    26     26   #
    27     27   execsql {
    28     28     CREATE TABLE t1(n int, log int);
    29     29     BEGIN;
    30     30   }
    31     31   for {set i 1} {$i<32} {incr i} {
    32         -  for {set j 0} {pow(2,$j)<$i} {incr j} {}
           32  +  for {set j 0} {(1<<$j)<$i} {incr j} {}
    33     33     execsql "INSERT INTO t1 VALUES($i,$j)"
    34     34   }
    35     35   execsql {
    36     36     COMMIT;
    37     37   }
    38     38   
    39     39   do_test select4-1.0 {

Changes to test/select5.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing aggregate functions and the
    13     13   # GROUP BY and HAVING clauses of SELECT statements.
    14     14   #
    15         -# $Id: select5.test,v 1.16 2006/01/21 12:08:55 danielk1977 Exp $
           15  +# $Id: select5.test,v 1.17 2008/01/16 18:20:42 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Build some test data
    21     21   #
    22     22   execsql {
    23     23     CREATE TABLE t1(x int, y int);
    24     24     BEGIN;
    25     25   }
    26     26   for {set i 1} {$i<32} {incr i} {
    27         -  for {set j 0} {pow(2,$j)<$i} {incr j} {}
           27  +  for {set j 0} {(1<<$j)<$i} {incr j} {}
    28     28     execsql "INSERT INTO t1 VALUES([expr {32-$i}],[expr {10-$j}])"
    29     29   }
    30     30   execsql {
    31     31     COMMIT
    32     32   }
    33     33   
    34     34   do_test select5-1.0 {

Changes to test/update.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the UPDATE statement.
    13     13   #
    14         -# $Id: update.test,v 1.17 2005/01/21 03:12:16 danielk1977 Exp $
           14  +# $Id: update.test,v 1.18 2008/01/16 18:20:42 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Try to update an non-existent table
    20     20   #
    21     21   do_test update-1.1 {
................................................................................
    32     32   } {1 {table sqlite_master may not be modified}}
    33     33   
    34     34   # Create a table to work with
    35     35   #
    36     36   do_test update-3.1 {
    37     37     execsql {CREATE TABLE test1(f1 int,f2 int)}
    38     38     for {set i 1} {$i<=10} {incr i} {
    39         -    set sql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])"
           39  +    set sql "INSERT INTO test1 VALUES($i,[expr {1<<$i}])"
    40     40       execsql $sql
    41     41     }
    42     42     execsql {SELECT * FROM test1 ORDER BY f1}
    43     43   } {1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024}
    44     44   
    45     45   # Unknown column name in an expression
    46     46   #