3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # The focus of this file is testing the r-tree extension when it is
13 # configured to store values as 32 bit integers.
16 if {![info exists testdir]} {
17 set testdir [file join [file dirname [info script]] .. .. test]
19 source [file join [file dirname [info script]] rtree_util.tcl]
20 source $testdir/tester.tcl
28 execsql { CREATE VIRTUAL TABLE t1 USING rtree_i32(id, x1, x2, y1, y2) }
31 execsql { INSERT INTO t1 VALUES(1, 5, 10, 4, 11.2) }
34 execsql { SELECT * FROM t1 }
37 execsql { SELECT typeof(x1) FROM t1 }
41 execsql { SELECT x1==5 FROM t1 }
44 execsql { SELECT x1==5.2 FROM t1 }
47 execsql { SELECT x1==5.0 FROM t1 }
51 execsql { SELECT count(*) FROM t1 WHERE x1==5 }
53 ifcapable !rtree_int_only {
55 execsql { SELECT count(*) FROM t1 WHERE x1==5.2 }
59 execsql { SELECT count(*) FROM t1 WHERE x1==5.0 }
63 execsql { SELECT (1<<31)-5, (1<<31)-1, -1*(1<<31), -1*(1<<31)+5 }
64 } {2147483643 2147483647 -2147483648 -2147483643}
67 INSERT INTO t1 VALUES(2, (1<<31)-5, (1<<31)-1, -1*(1<<31), -1*(1<<31)+5)
71 execsql { SELECT * FROM t1 WHERE id=2 }
72 } {2 2147483643 2147483647 -2147483648 -2147483643}
75 SELECT * FROM t1 WHERE
76 x1=2147483643 AND x2=2147483647 AND
77 y1=-2147483648 AND y2=-2147483643
79 } {2 2147483643 2147483647 -2147483648 -2147483643}
80 do_rtree_integrity_test rtree5-1.14 t1