1# 2016-05-32 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# This file contains tests for the r-tree module. 12# 13# Verify that no invalid SQL is run during initialization 14 15if {![info exists testdir]} { 16 set testdir [file join [file dirname [info script]] .. .. test] 17} 18source [file join [file dirname [info script]] rtree_util.tcl] 19source $testdir/tester.tcl 20ifcapable !rtree { finish_test ; return } 21 22db close 23sqlite3_shutdown 24test_sqlite3_log [list lappend ::log] 25set ::log [list] 26sqlite3 db test.db 27 28 29set ::log {} 30do_execsql_test rtreeG-1.1 { 31 CREATE VIRTUAL TABLE t1 USING rtree(id,x0,x1,y0,y1); 32} {} 33do_test rtreeG-1.1log { 34 set ::log 35} {} 36 37do_execsql_test rtreeG-1.2 { 38 INSERT INTO t1 VALUES(1,10,15,5,23),(2,20,21,5,23),(3,10,15,20,30); 39 SELECT id from t1 WHERE x0>8 AND x1<16 AND y0>2 AND y1<25; 40} {1} 41do_rtree_integrity_test rtreeG-1.2.integrity t1 42do_test rtreeG-1.2log { 43 set ::log 44} {} 45 46db close 47sqlite3 db test.db 48do_execsql_test rtreeG-1.3 { 49 SELECT id from t1 WHERE x0>8 AND x1<16 AND y0>2 AND y1<25; 50} {1} 51do_test rtreeG-1.3log { 52 set ::log 53} {} 54 55do_execsql_test rtreeG-1.4 { 56 DROP TABLE t1; 57} {} 58do_test rtreeG-1.4log { 59 set ::log 60} {} 61 62expand_all_sql db 63db close 64sqlite3_shutdown 65test_sqlite3_log 66sqlite3_initialize 67sqlite3 db test.db 68 69finish_test 70