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 $testdir/tester.tcl
27 execsql { CREATE VIRTUAL TABLE t1 USING rtree_i32(id, x1, x2, y1, y2) }
30 execsql { INSERT INTO t1 VALUES(1, 5, 10, 4, 11.2) }
33 execsql { SELECT * FROM t1 }
36 execsql { SELECT typeof(x1) FROM t1 }
40 execsql { SELECT x1==5 FROM t1 }
43 execsql { SELECT x1==5.2 FROM t1 }
46 execsql { SELECT x1==5.0 FROM t1 }
50 execsql { SELECT count(*) FROM t1 WHERE x1==5 }
52 ifcapable !rtree_int_only {
54 execsql { SELECT count(*) FROM t1 WHERE x1==5.2 }
58 execsql { SELECT count(*) FROM t1 WHERE x1==5.0 }
62 execsql { SELECT (1<<31)-5, (1<<31)-1, -1*(1<<31), -1*(1<<31)+5 }
63 } {2147483643 2147483647 -2147483648 -2147483643}
66 INSERT INTO t1 VALUES(2, (1<<31)-5, (1<<31)-1, -1*(1<<31), -1*(1<<31)+5)
70 execsql { SELECT * FROM t1 WHERE id=2 }
71 } {2 2147483643 2147483647 -2147483648 -2147483643}
74 SELECT * FROM t1 WHERE
75 x1=2147483643 AND x2=2147483647 AND
76 y1=-2147483648 AND y2=-2147483643
78 } {2 2147483643 2147483647 -2147483648 -2147483643}