70 lines
1.5 KiB
Plaintext
70 lines
1.5 KiB
Plaintext
# 2016-05-32
|
|
#
|
|
# 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 contains tests for the r-tree module.
|
|
#
|
|
# Verify that no invalid SQL is run during initialization
|
|
|
|
if {![info exists testdir]} {
|
|
set testdir [file join [file dirname [info script]] .. .. test]
|
|
}
|
|
source [file join [file dirname [info script]] rtree_util.tcl]
|
|
source $testdir/tester.tcl
|
|
ifcapable !rtree { finish_test ; return }
|
|
|
|
db close
|
|
sqlite3_shutdown
|
|
test_sqlite3_log [list lappend ::log]
|
|
set ::log [list]
|
|
sqlite3 db test.db
|
|
|
|
|
|
set ::log {}
|
|
do_execsql_test rtreeG-1.1 {
|
|
CREATE VIRTUAL TABLE t1 USING rtree(id,x0,x1,y0,y1);
|
|
} {}
|
|
do_test rtreeG-1.1log {
|
|
set ::log
|
|
} {}
|
|
|
|
do_execsql_test rtreeG-1.2 {
|
|
INSERT INTO t1 VALUES(1,10,15,5,23),(2,20,21,5,23),(3,10,15,20,30);
|
|
SELECT id from t1 WHERE x0>8 AND x1<16 AND y0>2 AND y1<25;
|
|
} {1}
|
|
do_rtree_integrity_test rtreeG-1.2.integrity t1
|
|
do_test rtreeG-1.2log {
|
|
set ::log
|
|
} {}
|
|
|
|
db close
|
|
sqlite3 db test.db
|
|
do_execsql_test rtreeG-1.3 {
|
|
SELECT id from t1 WHERE x0>8 AND x1<16 AND y0>2 AND y1<25;
|
|
} {1}
|
|
do_test rtreeG-1.3log {
|
|
set ::log
|
|
} {}
|
|
|
|
do_execsql_test rtreeG-1.4 {
|
|
DROP TABLE t1;
|
|
} {}
|
|
do_test rtreeG-1.4log {
|
|
set ::log
|
|
} {}
|
|
|
|
expand_all_sql db
|
|
db close
|
|
sqlite3_shutdown
|
|
test_sqlite3_log
|
|
sqlite3_initialize
|
|
sqlite3 db test.db
|
|
|
|
finish_test
|