2016-05-23 21:12:04 +03:00
|
|
|
# 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]
|
|
|
|
}
|
2017-10-25 19:38:34 +03:00
|
|
|
source [file join [file dirname [info script]] rtree_util.tcl]
|
2016-05-23 21:12:04 +03:00
|
|
|
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 {}
|
2016-05-23 21:27:07 +03:00
|
|
|
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}
|
2017-10-25 19:38:34 +03:00
|
|
|
do_rtree_integrity_test rtreeG-1.2.integrity t1
|
2016-05-23 21:27:07 +03:00
|
|
|
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 {
|
2016-05-23 21:12:04 +03:00
|
|
|
set ::log
|
|
|
|
} {}
|
|
|
|
|
2016-05-23 21:27:07 +03:00
|
|
|
do_execsql_test rtreeG-1.4 {
|
|
|
|
DROP TABLE t1;
|
|
|
|
} {}
|
|
|
|
do_test rtreeG-1.4log {
|
|
|
|
set ::log
|
|
|
|
} {}
|
|
|
|
|
2018-02-07 21:02:50 +03:00
|
|
|
expand_all_sql db
|
2016-05-23 21:27:07 +03:00
|
|
|
db close
|
|
|
|
sqlite3_shutdown
|
|
|
|
test_sqlite3_log
|
|
|
|
sqlite3_initialize
|
|
|
|
sqlite3 db test.db
|
|
|
|
|
2016-05-23 21:12:04 +03:00
|
|
|
finish_test
|