/ Check-in [2e5786d1]
Login

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

Overview
Comment::-) (CVS 83)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2e5786d10148872db47d99e39c3f54597ad777c8
User & Date: drh 2000-06-08 16:54:40
Context
2000-06-08
19:38
:-) (CVS 84) check-in: 57dce04a user: drh tags: trunk
16:54
:-) (CVS 83) check-in: 2e5786d1 user: drh tags: trunk
16:26
:-) (CVS 82) check-in: 33355b2d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/index.test.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements regression tests for SQLite library.  The
    24     24   # focus of this file is testing the CREATE INDEX statement.
    25     25   #
    26         -# $Id: index.test,v 1.3 2000/06/03 18:06:53 drh Exp $
           26  +# $Id: index.test,v 1.4 2000/06/08 16:54:40 drh Exp $
    27     27   
    28     28   set testdir [file dirname $argv0]
    29     29   source $testdir/tester.tcl
    30     30   
    31     31   # Create a basic index and verify it is added to sqlite_master
    32     32   #
    33     33   do_test index-1.1 {
................................................................................
   252    252     execsql {EXPLAIN CREATE INDEX idx1 ON tab1(a)}
   253    253     execsql {SELECT name FROM sqlite_master WHERE tbl_name='tab1'}
   254    254   } {tab1}
   255    255   do_test index-9.2 {
   256    256     execsql {CREATE INDEX idx1 ON tab1(a)}
   257    257     execsql {SELECT name FROM sqlite_master WHERE tbl_name='tab1' ORDER BY name}
   258    258   } {idx1 tab1}
          259  +
          260  +# Allow more than one entry with the same key.
          261  +#
          262  +do_test index-10.0 {
          263  +  execsql {
          264  +    CREATE TABLE t1(a int, b int);
          265  +    CREATE INDEX i1 ON t1(a);
          266  +    INSERT INTO t1 VALUES(1,2);
          267  +    INSERT INTO t1 VALUES(2,4);
          268  +    INSERT INTO t1 VALUES(3,8);
          269  +    INSERT INTO t1 VALUES(1,12);
          270  +    SELECT b FROM t1 WHERE a=1 ORDER BY b;
          271  +  }
          272  +} {2 12}
          273  +do_test index-10.1 {
          274  +  execsql {
          275  +    SELECT b FROM t1 WHERE a=2 ORDER BY b;
          276  +  }
          277  +} {4}
          278  +do_test index-10.2 {
          279  +  execsql {
          280  +    DELETE FROM t1 WHERE b=12;
          281  +    SELECT b FROM t1 WHERE a=1 ORDER BY b;
          282  +  }
          283  +} {2}
          284  +do_test index-10.2 {
          285  +  execsql {
          286  +    DELETE FROM t1 WHERE b=2;
          287  +    SELECT b FROM t1 WHERE a=1 ORDER BY b;
          288  +  }
          289  +} {}
   259    290   
   260    291   finish_test

Changes to test/select2.test.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements regression tests for SQLite library.  The
    24     24   # focus of this file is testing the SELECT statement.
    25     25   #
    26         -# $Id: select2.test,v 1.5 2000/06/05 18:54:47 drh Exp $
           26  +# $Id: select2.test,v 1.6 2000/06/08 16:54:40 drh Exp $
    27     27   
    28     28   set testdir [file dirname $argv0]
    29     29   source $testdir/tester.tcl
    30     30   
    31     31   # Create a table with some data
    32     32   #
    33     33   execsql {CREATE TABLE tbl1(f1 int, f2 int)}
................................................................................
    86     86     execsql {SELECT count(*) FROM tbl2}
    87     87   } {30000}
    88     88   do_test select2-2.2 {
    89     89     execsql {SELECT count(*) FROM tbl2 WHERE f2>1000}
    90     90   } {29500}
    91     91   
    92     92   do_test select2-3.1 {
    93         -  execsql {SELECT f1 FROM tbl2 WHERE f2==1000}
           93  +  execsql {SELECT f1 FROM tbl2 WHERE 1000=f2}
    94     94   } {500}
    95     95   
    96     96   do_test select2-3.2a {
    97     97     execsql {CREATE INDEX idx1 ON tbl2(f2)}
    98     98   } {}
    99     99   
   100    100   do_test select2-3.2b {
   101         -  execsql {SELECT f1 FROM tbl2 WHERE f2==1000}
          101  +  execsql {SELECT f1 FROM tbl2 WHERE 1000=f2}
          102  +} {500}
          103  +do_test select2-3.2c {
          104  +  execsql {SELECT f1 FROM tbl2 WHERE f2=1000}
   102    105   } {500}
          106  +do_test select2-3.2d {
          107  +  set t1 [lindex [time {execsql {SELECT f1 FROM tbl2 WHERE 1000=f2}} 1] 0]
          108  +  set t2 [lindex [time {execsql {SELECT f1 FROM tbl2 WHERE f2=1000}} 1] 0]
          109  +  expr {$t1*0.9<$t2 && $t2*0.9<$t1}
          110  +} {1}
   103    111   
   104    112   # Make sure queries run faster with an index than without
   105    113   #
   106    114   do_test select2-3.3 {
   107    115     set t1 [lindex [time {execsql {SELECT f1 from tbl2 WHERE f2==2000}} 1] 0]
   108    116     execsql {DROP INDEX idx1}
   109    117     set t2 [lindex [time {execsql {SELECT f1 FROM tbl2 WHERE f2==2000}} 1] 0]
   110    118     expr {$t1*25 < $t2}
   111    119   } {1}
   112    120   
   113    121   finish_test