Annotation of embedaddon/sqlite3/ext/rtree/rtree5.test, revision 1.1.1.1

1.1       misho       1: # 2008 Jul 14
                      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: #
                     12: # The focus of this file is testing the r-tree extension when it is
                     13: # configured to store values as 32 bit integers.
                     14: #
                     15: 
                     16: if {![info exists testdir]} {
                     17:   set testdir [file join [file dirname [info script]] .. .. test]
                     18: } 
                     19: source $testdir/tester.tcl
                     20: 
                     21: ifcapable !rtree {
                     22:   finish_test
                     23:   return
                     24: }
                     25: 
                     26: do_test rtree5-1.0 {
                     27:   execsql { CREATE VIRTUAL TABLE t1 USING rtree_i32(id, x1, x2, y1, y2) }
                     28: } {}
                     29: do_test rtree5-1.1 {
                     30:   execsql { INSERT INTO t1 VALUES(1, 5, 10, 4, 11.2) }
                     31: } {}
                     32: do_test rtree5-1.2 { 
                     33:   execsql { SELECT * FROM t1 }
                     34: } {1 5 10 4 11}
                     35: do_test rtree5-1.3 { 
                     36:   execsql { SELECT typeof(x1) FROM t1 }
                     37: } {integer}
                     38: 
                     39: do_test rtree5-1.4 { 
                     40:   execsql { SELECT x1==5 FROM t1 }
                     41: } {1}
                     42: do_test rtree5-1.5 { 
                     43:   execsql { SELECT x1==5.2 FROM t1 }
                     44: } {0}
                     45: do_test rtree5-1.6 { 
                     46:   execsql { SELECT x1==5.0 FROM t1 }
                     47: } {1}
                     48: 
                     49: do_test rtree5-1.7 { 
                     50:   execsql { SELECT count(*) FROM t1 WHERE x1==5 }
                     51: } {1}
                     52: do_test rtree5-1.8 { 
                     53:   execsql { SELECT count(*) FROM t1 WHERE x1==5.2 }
                     54: } {0}
                     55: do_test rtree5-1.9 { 
                     56:   execsql { SELECT count(*) FROM t1 WHERE x1==5.0 }
                     57: } {1}
                     58: 
                     59: do_test rtree5-1.10 { 
                     60:   execsql { SELECT (1<<31)-5, (1<<31)-1, -1*(1<<31), -1*(1<<31)+5 }
                     61: } {2147483643 2147483647 -2147483648 -2147483643}
                     62: do_test rtree5-1.10 { 
                     63:   execsql { 
                     64:     INSERT INTO t1 VALUES(2, (1<<31)-5, (1<<31)-1, -1*(1<<31), -1*(1<<31)+5) 
                     65:   }
                     66: } {}
                     67: do_test rtree5-1.12 { 
                     68:   execsql { SELECT * FROM t1 WHERE id=2 }
                     69: } {2 2147483643 2147483647 -2147483648 -2147483643}
                     70: do_test rtree5-1.13 { 
                     71:   execsql { 
                     72:     SELECT * FROM t1 WHERE 
                     73:         x1=2147483643 AND x2=2147483647 AND 
                     74:         y1=-2147483648 AND y2=-2147483643
                     75:   }
                     76: } {2 2147483643 2147483647 -2147483648 -2147483643}
                     77: 
                     78: finish_test

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>