1*522efc62Sdrh# 2009 November 10 2*522efc62Sdrh# 3*522efc62Sdrh# The author disclaims copyright to this source code. In place of 4*522efc62Sdrh# a legal notice, here is a blessing: 5*522efc62Sdrh# 6*522efc62Sdrh# May you do good and not evil. 7*522efc62Sdrh# May you find forgiveness for yourself and forgive others. 8*522efc62Sdrh# May you share freely, never taking more than you give. 9*522efc62Sdrh# 10*522efc62Sdrh#*********************************************************************** 11*522efc62Sdrh# This file implements regression tests for SQLite library. 12*522efc62Sdrh# 13*522efc62Sdrh# This file implements tests for the "intarray" object implemented 14*522efc62Sdrh# in test_intarray.c. 15*522efc62Sdrh# 16*522efc62Sdrh 17*522efc62Sdrhset testdir [file dirname $argv0] 18*522efc62Sdrhsource $testdir/tester.tcl 19*522efc62Sdrh 20*522efc62Sdrhifcapable !vtab { 21*522efc62Sdrh return 22*522efc62Sdrh} 23*522efc62Sdrh 24*522efc62Sdrhdo_test intarray-1.0 { 25*522efc62Sdrh db eval { 26*522efc62Sdrh CREATE TABLE t1(a INTEGER PRIMARY KEY, b); 27*522efc62Sdrh } 28*522efc62Sdrh for {set i 1} {$i<=999} {incr i} { 29*522efc62Sdrh set b [format {x%03d} $i] 30*522efc62Sdrh db eval {INSERT INTO t1(a,b) VALUES($i,$b)} 31*522efc62Sdrh } 32*522efc62Sdrh db eval { 33*522efc62Sdrh SELECT b FROM t1 WHERE a IN (12,34,56,78) ORDER BY a 34*522efc62Sdrh } 35*522efc62Sdrh} {x012 x034 x056 x078} 36*522efc62Sdrh 37*522efc62Sdrhdo_test intarray-1.1 { 38*522efc62Sdrh set ia1 [sqlite3_intarray_create db ia1] 39*522efc62Sdrh set ia2 [sqlite3_intarray_create db ia2] 40*522efc62Sdrh set ia3 [sqlite3_intarray_create db ia3] 41*522efc62Sdrh set ia4 [sqlite3_intarray_create db ia4] 42*522efc62Sdrh db eval { 43*522efc62Sdrh SELECT type, name FROM sqlite_temp_master 44*522efc62Sdrh ORDER BY name 45*522efc62Sdrh } 46*522efc62Sdrh} {table ia1 table ia2 table ia3 table ia4} 47*522efc62Sdrh 48*522efc62Sdrhdo_test intarray-1.2 { 49*522efc62Sdrh db eval { 50*522efc62Sdrh SELECT b FROM t1 WHERE a IN ia3 ORDER BY a 51*522efc62Sdrh } 52*522efc62Sdrh} {} 53*522efc62Sdrh 54*522efc62Sdrhdo_test intarray-1.3 { 55*522efc62Sdrh sqlite3_intarray_bind $ia3 45 123 678 56*522efc62Sdrh db eval { 57*522efc62Sdrh SELECT b FROM t1 WHERE a IN ia3 ORDER BY a 58*522efc62Sdrh } 59*522efc62Sdrh} {x045 x123 x678} 60*522efc62Sdrh 61*522efc62Sdrh 62*522efc62Sdrhfinish_test 63