| OLD | NEW | 
 | (Empty) | 
|   1 # 2009 April 17 |  | 
|   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 # This file implements regression tests for SQLite library.  The |  | 
|  13 # focus of this file is the code in rowhash.c. |  | 
|  14 # |  | 
|  15 # $Id: rowhash.test,v 1.5 2009/05/02 12:02:02 drh Exp $ |  | 
|  16  |  | 
|  17 set testdir [file dirname $argv0] |  | 
|  18 source $testdir/tester.tcl |  | 
|  19  |  | 
|  20 do_test rowhash-1.1 { |  | 
|  21   execsql { |  | 
|  22     CREATE TABLE t1(id INTEGER PRIMARY KEY, a, b, c); |  | 
|  23     CREATE INDEX i1 ON t1(a); |  | 
|  24     CREATE INDEX i2 ON t1(b); |  | 
|  25     CREATE INDEX i3 ON t1(c); |  | 
|  26   } |  | 
|  27 } {} |  | 
|  28  |  | 
|  29 proc do_keyset_test {name lKey} { |  | 
|  30   db transaction { |  | 
|  31     execsql { DELETE FROM t1 } |  | 
|  32     foreach key $lKey { |  | 
|  33       execsql { INSERT OR IGNORE INTO t1 VALUES($key, 'a', 'b', 'c') } |  | 
|  34     } |  | 
|  35   } |  | 
|  36   do_test $name { |  | 
|  37     lsort -integer [execsql { |  | 
|  38       SELECT id FROM t1 WHERE a = 'a' OR b = 'b' OR c = 'c'; |  | 
|  39     }] |  | 
|  40   } [lsort -integer -unique $lKey] |  | 
|  41 } |  | 
|  42  |  | 
|  43 do_keyset_test rowhash-2.1 {1 2 3} |  | 
|  44 do_keyset_test rowhash-2.2 {0 1 2 3} |  | 
|  45 do_keyset_test rowhash-2.3 {62 125 188} |  | 
|  46 if {[working_64bit_int]} { |  | 
|  47   expr srand(1) |  | 
|  48   for {set i 4} {$i < 10} {incr i} { |  | 
|  49     for {set j 0} {$j < 5000} {incr j} { |  | 
|  50         lappend L [expr int(rand()*1000000000)] |  | 
|  51     } |  | 
|  52     do_keyset_test rowhash-2.$i $L |  | 
|  53   } |  | 
|  54 } |  | 
|  55  |  | 
|  56 finish_test |  | 
| OLD | NEW |