xref: /sqlite-3.40.0/ext/rtree/rtreeG.test (revision dfe4e6bb)
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 $testdir/tester.tcl
19ifcapable !rtree { finish_test ; return }
20
21db close
22sqlite3_shutdown
23test_sqlite3_log [list lappend ::log]
24set ::log [list]
25sqlite3 db test.db
26
27
28set ::log {}
29do_execsql_test rtreeG-1.1 {
30  CREATE VIRTUAL TABLE t1 USING rtree(id,x0,x1,y0,y1);
31} {}
32do_test rtreeG-1.1log {
33  set ::log
34} {}
35
36do_execsql_test rtreeG-1.2 {
37  INSERT INTO t1 VALUES(1,10,15,5,23),(2,20,21,5,23),(3,10,15,20,30);
38  SELECT id from t1 WHERE x0>8 AND x1<16 AND y0>2 AND y1<25;
39} {1}
40do_test rtreeG-1.2log {
41  set ::log
42} {}
43
44db close
45sqlite3 db test.db
46do_execsql_test rtreeG-1.3 {
47  SELECT id from t1 WHERE x0>8 AND x1<16 AND y0>2 AND y1<25;
48} {1}
49do_test rtreeG-1.3log {
50  set ::log
51} {}
52
53do_execsql_test rtreeG-1.4 {
54  DROP TABLE t1;
55} {}
56do_test rtreeG-1.4log {
57  set ::log
58} {}
59
60db close
61sqlite3_shutdown
62test_sqlite3_log
63sqlite3_initialize
64sqlite3 db test.db
65
66finish_test
67