a9f5815b67
FossilOrigin-Name: 5a3cfd747a85480d215784817c3821d87ecfa2f7
113 lines
2.7 KiB
Plaintext
113 lines
2.7 KiB
Plaintext
# 2011 March 2
|
|
#
|
|
# 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.
|
|
#
|
|
#***********************************************************************
|
|
# Make sure the rtreenode() testing function can handle entries with
|
|
# 64-bit rowids.
|
|
#
|
|
|
|
if {![info exists testdir]} {
|
|
set testdir [file join [file dirname [info script]] .. .. test]
|
|
}
|
|
source $testdir/tester.tcl
|
|
ifcapable !rtree { finish_test ; return }
|
|
set testprefix rtreeC
|
|
|
|
do_execsql_test 1.0 {
|
|
CREATE VIRTUAL TABLE r_tree USING rtree(id, min_x, max_x, min_y, max_y);
|
|
CREATE TABLE t(x, y);
|
|
}
|
|
|
|
do_eqp_test 1.1 {
|
|
SELECT * FROM r_tree, t
|
|
WHERE t.x>=min_x AND t.x<=max_x AND t.y>=min_y AND t.x<=max_y
|
|
} {
|
|
0 0 1 {SCAN TABLE t}
|
|
0 1 0 {SCAN TABLE r_tree VIRTUAL TABLE INDEX 2:DdBcDbBa}
|
|
}
|
|
|
|
do_eqp_test 1.2 {
|
|
SELECT * FROM t, r_tree
|
|
WHERE t.x>=min_x AND t.x<=max_x AND t.y>=min_y AND t.x<=max_y
|
|
} {
|
|
0 0 0 {SCAN TABLE t}
|
|
0 1 1 {SCAN TABLE r_tree VIRTUAL TABLE INDEX 2:DdBcDbBa}
|
|
}
|
|
|
|
do_eqp_test 1.3 {
|
|
SELECT * FROM t, r_tree
|
|
WHERE t.x>=min_x AND t.x<=max_x AND t.y>=min_y AND ?<=max_y
|
|
} {
|
|
0 0 0 {SCAN TABLE t}
|
|
0 1 1 {SCAN TABLE r_tree VIRTUAL TABLE INDEX 2:DdBcDbBa}
|
|
}
|
|
|
|
do_eqp_test 1.5 {
|
|
SELECT * FROM t, r_tree
|
|
} {
|
|
0 0 1 {SCAN TABLE r_tree VIRTUAL TABLE INDEX 2:}
|
|
0 1 0 {SCAN TABLE t}
|
|
}
|
|
|
|
do_execsql_test 2.0 {
|
|
INSERT INTO t VALUES(0, 0);
|
|
INSERT INTO t VALUES(0, 1);
|
|
INSERT INTO t VALUES(0, 2);
|
|
INSERT INTO t VALUES(0, 3);
|
|
INSERT INTO t VALUES(0, 4);
|
|
INSERT INTO t VALUES(0, 5);
|
|
INSERT INTO t VALUES(0, 6);
|
|
INSERT INTO t VALUES(0, 7);
|
|
INSERT INTO t VALUES(0, 8);
|
|
INSERT INTO t VALUES(0, 9);
|
|
|
|
INSERT INTO t SELECT x+1, y FROM t;
|
|
INSERT INTO t SELECT x+2, y FROM t;
|
|
INSERT INTO t SELECT x+4, y FROM t;
|
|
INSERT INTO r_tree SELECT NULL, x-1, x+1, y-1, y+1 FROM t;
|
|
ANALYZE;
|
|
}
|
|
|
|
db close
|
|
sqlite3 db test.db
|
|
|
|
do_eqp_test 2.1 {
|
|
SELECT * FROM r_tree, t
|
|
WHERE t.x>=min_x AND t.x<=max_x AND t.y>=min_y AND t.x<=max_y
|
|
} {
|
|
0 0 1 {SCAN TABLE t}
|
|
0 1 0 {SCAN TABLE r_tree VIRTUAL TABLE INDEX 2:DdBcDbBa}
|
|
}
|
|
|
|
do_eqp_test 2.2 {
|
|
SELECT * FROM t, r_tree
|
|
WHERE t.x>=min_x AND t.x<=max_x AND t.y>=min_y AND t.x<=max_y
|
|
} {
|
|
0 0 0 {SCAN TABLE t}
|
|
0 1 1 {SCAN TABLE r_tree VIRTUAL TABLE INDEX 2:DdBcDbBa}
|
|
}
|
|
|
|
do_eqp_test 2.3 {
|
|
SELECT * FROM t, r_tree
|
|
WHERE t.x>=min_x AND t.x<=max_x AND t.y>=min_y AND ?<=max_y
|
|
} {
|
|
0 0 0 {SCAN TABLE t}
|
|
0 1 1 {SCAN TABLE r_tree VIRTUAL TABLE INDEX 2:DdBcDbBa}
|
|
}
|
|
|
|
do_eqp_test 2.5 {
|
|
SELECT * FROM t, r_tree
|
|
} {
|
|
0 0 1 {SCAN TABLE r_tree VIRTUAL TABLE INDEX 2:}
|
|
0 1 0 {SCAN TABLE t}
|
|
}
|
|
|
|
finish_test
|
|
|