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