Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(844)

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/ext/rtree/rtree9.test

Issue 2363173002: [sqlite] Remove obsolete reference version 3.8.7.4. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # 2010 August 28
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. Specifically, it tests
12 # that custom r-tree queries (geometry callbacks) work.
13 #
14
15 if {![info exists testdir]} {
16 set testdir [file join [file dirname [info script]] .. .. test]
17 }
18 source $testdir/tester.tcl
19 ifcapable !rtree { finish_test ; return }
20 ifcapable rtree_int_only { finish_test; return }
21
22 register_cube_geom db
23
24 do_execsql_test rtree9-1.1 {
25 CREATE VIRTUAL TABLE rt USING rtree(id, x1, x2, y1, y2, z1, z2);
26 INSERT INTO rt VALUES(1, 1, 2, 1, 2, 1, 2);
27 } {}
28 do_execsql_test rtree9-1.2 {
29 SELECT * FROM rt WHERE id MATCH cube(0, 0, 0, 2, 2, 2);
30 } {1 1.0 2.0 1.0 2.0 1.0 2.0}
31 do_execsql_test rtree9-1.3 {
32 SELECT * FROM rt WHERE id MATCH cube(3, 3, 3, 2, 2, 2);
33 } {}
34 do_execsql_test rtree9-1.4 {
35 DELETE FROM rt;
36 } {}
37
38
39 for {set i 0} {$i < 1000} {incr i} {
40 set x [expr $i%10]
41 set y [expr ($i/10)%10]
42 set z [expr ($i/100)%10]
43 execsql { INSERT INTO rt VALUES($i, $x, $x+1, $y, $y+1, $z, $z+1) }
44 }
45 do_execsql_test rtree9-2.1 {
46 SELECT id FROM rt WHERE id MATCH cube(2.5, 2.5, 2.5, 1, 1, 1) ORDER BY id;
47 } {222 223 232 233 322 323 332 333}
48 do_execsql_test rtree9-2.2 {
49 SELECT id FROM rt WHERE id MATCH cube(5.5, 5.5, 5.5, 1, 1, 1) ORDER BY id;
50 } {555 556 565 566 655 656 665 666}
51
52
53 do_execsql_test rtree9-3.1 {
54 CREATE VIRTUAL TABLE rt32 USING rtree_i32(id, x1, x2, y1, y2, z1, z2);
55 } {}
56 for {set i 0} {$i < 1000} {incr i} {
57 set x [expr $i%10]
58 set y [expr ($i/10)%10]
59 set z [expr ($i/100)%10]
60 execsql { INSERT INTO rt32 VALUES($i, $x, $x+1, $y, $y+1, $z, $z+1) }
61 }
62 do_execsql_test rtree9-3.2 {
63 SELECT id FROM rt32 WHERE id MATCH cube(3, 3, 3, 1, 1, 1) ORDER BY id;
64 } {222 223 224 232 233 234 242 243 244 322 323 324 332 333 334 342 343 344 422 4 23 424 432 433 434 442 443 444}
65 do_execsql_test rtree9-3.3 {
66 SELECT id FROM rt32 WHERE id MATCH cube(5.5, 5.5, 5.5, 1, 1, 1) ORDER BY id;
67 } {555 556 565 566 655 656 665 666}
68
69
70 do_catchsql_test rtree9-4.1 {
71 SELECT id FROM rt32 WHERE id MATCH cube(5.5, 5.5, 1, 1, 1) ORDER BY id;
72 } {1 {SQL logic error or missing database}}
73 for {set x 2} {$x<200} {incr x 2} {
74 do_catchsql_test rtree9-4.2.[expr $x/2] {
75 SELECT id FROM rt WHERE id MATCH randomblob($x)
76 } {1 {SQL logic error or missing database}}
77 }
78 do_catchsql_test rtree9-4.3 {
79 SELECT id FROM rt WHERE id MATCH CAST(
80 (cube(5.5, 5.5, 5.5, 1, 1, 1) || X'1234567812345678') AS blob
81 )
82 } {1 {SQL logic error or missing database}}
83
84
85 #-------------------------------------------------------------------------
86 # Test the example 2d "circle" geometry callback.
87 #
88 register_circle_geom db
89
90 breakpoint
91 do_execsql_test rtree9-5.1 {
92 CREATE VIRTUAL TABLE rt2 USING rtree(id, xmin, xmax, ymin, ymax);
93
94 INSERT INTO rt2 VALUES(1, 1, 2, 1, 2);
95 INSERT INTO rt2 VALUES(2, 1, 2, -2, -1);
96 INSERT INTO rt2 VALUES(3, -2, -1, -2, -1);
97 INSERT INTO rt2 VALUES(4, -2, -1, 1, 2);
98
99 INSERT INTO rt2 VALUES(5, 2, 3, 2, 3);
100 INSERT INTO rt2 VALUES(6, 2, 3, -3, -2);
101 INSERT INTO rt2 VALUES(7, -3, -2, -3, -2);
102 INSERT INTO rt2 VALUES(8, -3, -2, 2, 3);
103
104 INSERT INTO rt2 VALUES(9, 1.8, 3, 1.8, 3);
105 INSERT INTO rt2 VALUES(10, 1.8, 3, -3, -1.8);
106 INSERT INTO rt2 VALUES(11, -3, -1.8, -3, -1.8);
107 INSERT INTO rt2 VALUES(12, -3, -1.8, 1.8, 3);
108
109 INSERT INTO rt2 VALUES(13, -15, 15, 1.8, 2.2);
110 INSERT INTO rt2 VALUES(14, -15, 15, -2.2, -1.8);
111 INSERT INTO rt2 VALUES(15, 1.8, 2.2, -15, 15);
112 INSERT INTO rt2 VALUES(16, -2.2, -1.8, -15, 15);
113
114 INSERT INTO rt2 VALUES(17, -100, 100, -100, 100);
115 } {}
116
117 do_execsql_test rtree9-5.2 {
118 SELECT id FROM rt2 WHERE id MATCH circle(0.0, 0.0, 2.0);
119 } {1 2 3 4 13 14 15 16 17}
120
121 do_execsql_test rtree9-5.3 {
122 UPDATE rt2 SET xmin=xmin+5, ymin=ymin+5, xmax=xmax+5, ymax=ymax+5;
123 SELECT id FROM rt2 WHERE id MATCH circle(5.0, 5.0, 2.0);
124 } {1 2 3 4 13 14 15 16 17}
125
126 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698