xref: /sqlite-3.40.0/ext/rtree/rtreeI.test (revision b6c94725)
1# 2019-12-05
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
6#    May you do good and not evil.
7#    May you find forgiveness for yourself and forgive others.
8#    May you share freely, never taking more than you give.
9#
10#***********************************************************************
11# Additional test cases
12
13if {![info exists testdir]} {
14  set testdir [file join [file dirname [info script]] .. .. test]
15}
16source [file join [file dirname [info script]] rtree_util.tcl]
17source $testdir/tester.tcl
18ifcapable !rtree { finish_test ; return }
19
20# The following is a test of rowvalue handling on virtual tables that
21# deal with inequalities and that set the OMIT flag on terms of the
22# WHERE clause.  This is not specific to rtree.  We just use rtree because
23# it is a convenient test platform since it has all the right
24# characteristics.
25#
26do_execsql_test rtreeI-1.10 {
27  CREATE TABLE t1(a);
28  INSERT INTO t1 VALUES(2);
29  CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
30  INSERT INTO t2(id,x0,x1) VALUES(1,2,3);
31} {}
32do_execsql_test rtreeI-1.20 {
33  SELECT 123 FROM t1, t2 WHERE (a,0)>(x0,0);
34} {}
35do_execsql_test rtreeI-1.21 {
36  SELECT 123 FROM t1, t2 WHERE (a,0.1)>(x0,0);
37} {123}
38do_execsql_test rtreeI-1.22 {
39  SELECT 123 FROM t1, t2 WHERE (a,0)>=(x0,0);
40} {123}
41do_execsql_test rtreeI-1.23 {
42  SELECT 123 FROM t1, t2 WHERE (a,0)<=(x0,0);
43} {123}
44do_execsql_test rtreeI-1.24 {
45  SELECT 123 FROM t1, t2 WHERE (a,0)<(x0,0);
46} {}
47do_execsql_test rtreeI-1.30 {
48  SELECT 123 FROM t1, t2 WHERE (x0,0)<(a,0);
49} {}
50do_execsql_test rtreeI-1.31 {
51  SELECT 123 FROM t1, t2 WHERE (x0,0)<(a,0.1);
52} {123}
53do_execsql_test rtreeI-1.40 {
54  SELECT 123 FROM t1, t2 WHERE x1<5 AND id<99 AND (a,0)>(x0,0);
55} {}
56do_execsql_test rtreeI-1.41 {
57  SELECT 123 FROM t1, t2 WHERE x1<5 AND id<99 AND (a,0.5)>(x0,0);
58} {123}
59do_execsql_test rtreeI-1.42 {
60  SELECT 123 FROM t1, t2 WHERE x1<5 AND id<99 AND (a,0)>=(x0,0);
61} {123}
62do_execsql_test rtreeI-1.43 {
63  SELECT 123 FROM t1, t2 WHERE x1<5 AND id<99 AND (a,0)<(x0,0);
64} {}
65do_execsql_test rtreeI-1.50 {
66  SELECT 123 FROM t1, t2 WHERE 5>x1 AND 99>id AND (x0,0)<(a,0);
67} {}
68do_execsql_test rtreeI-1.51 {
69  SELECT 123 FROM t1, t2 WHERE 5>x1 AND 99>id AND (x0,0)<(a,0.5);
70} {123}
71
72
73
74finish_test
75