mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Initial implementation and test cases for the "intarray" virtual table.
FossilOrigin-Name: 0e7d29253f093d4125ede3cfc478e4bf09aef987
This commit is contained in:
62
test/intarray.test
Normal file
62
test/intarray.test
Normal file
@ -0,0 +1,62 @@
|
||||
# 2009 November 10
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# This file implements tests for the "intarray" object implemented
|
||||
# in test_intarray.c.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
ifcapable !vtab {
|
||||
return
|
||||
}
|
||||
|
||||
do_test intarray-1.0 {
|
||||
db eval {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
|
||||
}
|
||||
for {set i 1} {$i<=999} {incr i} {
|
||||
set b [format {x%03d} $i]
|
||||
db eval {INSERT INTO t1(a,b) VALUES($i,$b)}
|
||||
}
|
||||
db eval {
|
||||
SELECT b FROM t1 WHERE a IN (12,34,56,78) ORDER BY a
|
||||
}
|
||||
} {x012 x034 x056 x078}
|
||||
|
||||
do_test intarray-1.1 {
|
||||
set ia1 [sqlite3_intarray_create db ia1]
|
||||
set ia2 [sqlite3_intarray_create db ia2]
|
||||
set ia3 [sqlite3_intarray_create db ia3]
|
||||
set ia4 [sqlite3_intarray_create db ia4]
|
||||
db eval {
|
||||
SELECT type, name FROM sqlite_temp_master
|
||||
ORDER BY name
|
||||
}
|
||||
} {table ia1 table ia2 table ia3 table ia4}
|
||||
|
||||
do_test intarray-1.2 {
|
||||
db eval {
|
||||
SELECT b FROM t1 WHERE a IN ia3 ORDER BY a
|
||||
}
|
||||
} {}
|
||||
|
||||
do_test intarray-1.3 {
|
||||
sqlite3_intarray_bind $ia3 45 123 678
|
||||
db eval {
|
||||
SELECT b FROM t1 WHERE a IN ia3 ORDER BY a
|
||||
}
|
||||
} {x045 x123 x678}
|
||||
|
||||
|
||||
finish_test
|
Reference in New Issue
Block a user