# 2019-12-05
#
# 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.
#
#***********************************************************************
# Additional test cases

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 }

# The following is a test of rowvalue handling on virtual tables that
# deal with inequalities and that set the OMIT flag on terms of the
# WHERE clause.  This is not specific to rtree.  We just use rtree because
# it is a convenient test platform since it has all the right
# characteristics.
#
do_execsql_test rtreeI-1.10 {
  CREATE TABLE t1(a);
  INSERT INTO t1 VALUES(2);
  CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1);
  INSERT INTO t2(id,x0,x1) VALUES(1,2,3);
} {}
do_execsql_test rtreeI-1.20 {
  SELECT 123 FROM t1, t2 WHERE (a,0)>(x0,0);
} {}
do_execsql_test rtreeI-1.21 {
  SELECT 123 FROM t1, t2 WHERE (a,0.1)>(x0,0);
} {123}
do_execsql_test rtreeI-1.22 {
  SELECT 123 FROM t1, t2 WHERE (a,0)>=(x0,0);
} {123}
do_execsql_test rtreeI-1.23 {
  SELECT 123 FROM t1, t2 WHERE (a,0)<=(x0,0);
} {123}
do_execsql_test rtreeI-1.24 {
  SELECT 123 FROM t1, t2 WHERE (a,0)<(x0,0);
} {}
do_execsql_test rtreeI-1.30 {
  SELECT 123 FROM t1, t2 WHERE (x0,0)<(a,0);
} {}
do_execsql_test rtreeI-1.31 {
  SELECT 123 FROM t1, t2 WHERE (x0,0)<(a,0.1);
} {123}
do_execsql_test rtreeI-1.40 {
  SELECT 123 FROM t1, t2 WHERE x1<5 AND id<99 AND (a,0)>(x0,0);
} {}
do_execsql_test rtreeI-1.41 {
  SELECT 123 FROM t1, t2 WHERE x1<5 AND id<99 AND (a,0.5)>(x0,0);
} {123}
do_execsql_test rtreeI-1.42 {
  SELECT 123 FROM t1, t2 WHERE x1<5 AND id<99 AND (a,0)>=(x0,0);
} {123}
do_execsql_test rtreeI-1.43 {
  SELECT 123 FROM t1, t2 WHERE x1<5 AND id<99 AND (a,0)<(x0,0);
} {}
do_execsql_test rtreeI-1.50 {
  SELECT 123 FROM t1, t2 WHERE 5>x1 AND 99>id AND (x0,0)<(a,0);
} {}
do_execsql_test rtreeI-1.51 {
  SELECT 123 FROM t1, t2 WHERE 5>x1 AND 99>id AND (x0,0)<(a,0.5);
} {123}



finish_test
