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

Side by Side Diff: third_party/sqlite/src/ext/rtree/rtree1.test

Issue 2765553002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: Created 3 years, 9 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
1 # 2008 Feb 19 1 # 2008 Feb 19
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 execsql { INSERT INTO t1 VALUES(NULL, 1, 3, 2, 4) } 187 execsql { INSERT INTO t1 VALUES(NULL, 1, 3, 2, 4) }
188 execsql { SELECT rowid FROM t1 ORDER BY rowid } 188 execsql { SELECT rowid FROM t1 ORDER BY rowid }
189 } {1 2} 189 } {1 2}
190 do_test rtree-2.1.3 { 190 do_test rtree-2.1.3 {
191 execsql { INSERT INTO t1 VALUES(NULL, 1, 3, 2, 4) } 191 execsql { INSERT INTO t1 VALUES(NULL, 1, 3, 2, 4) }
192 execsql { SELECT ii FROM t1 ORDER BY ii } 192 execsql { SELECT ii FROM t1 ORDER BY ii }
193 } {1 2 3} 193 } {1 2 3}
194 194
195 do_test rtree-2.2.1 { 195 do_test rtree-2.2.1 {
196 catchsql { INSERT INTO t1 VALUES(2, 1, 3, 2, 4) } 196 catchsql { INSERT INTO t1 VALUES(2, 1, 3, 2, 4) }
197 } {1 {constraint failed}} 197 } {1 {UNIQUE constraint failed: t1.ii}}
198 do_test rtree-2.2.2 { 198 do_test rtree-2.2.2 {
199 catchsql { INSERT INTO t1 VALUES(4, 1, 3, 4, 2) } 199 catchsql { INSERT INTO t1 VALUES(4, 1, 3, 4, 2) }
200 } {1 {constraint failed}} 200 } {1 {rtree constraint failed: t1.(y1<=y2)}}
201 do_test rtree-2.2.3 { 201 do_test rtree-2.2.3 {
202 catchsql { INSERT INTO t1 VALUES(4, 3, 1, 2, 4) } 202 catchsql { INSERT INTO t1 VALUES(4, 3, 1, 2, 4) }
203 } {1 {constraint failed}} 203 } {1 {rtree constraint failed: t1.(x1<=x2)}}
204 do_test rtree-2.2.4 { 204 do_test rtree-2.2.4 {
205 execsql { SELECT ii FROM t1 ORDER BY ii } 205 execsql { SELECT ii FROM t1 ORDER BY ii }
206 } {1 2 3} 206 } {1 2 3}
207 207
208 do_test rtree-2.X { 208 do_test rtree-2.X {
209 execsql { DROP TABLE t1 } 209 execsql { DROP TABLE t1 }
210 } {} 210 } {}
211 211
212 #---------------------------------------------------------------------------- 212 #----------------------------------------------------------------------------
213 # Test cases rtree-3.* test linear scans of r-tree table data. To test 213 # Test cases rtree-3.* test linear scans of r-tree table data. To test
(...skipping 15 matching lines...) Expand all
229 do_test rtree-3.1.3 { 229 do_test rtree-3.1.3 {
230 execsql_intout { 230 execsql_intout {
231 INSERT INTO t1 VALUES(6, 2, 6, 4, 8); 231 INSERT INTO t1 VALUES(6, 2, 6, 4, 8);
232 SELECT * FROM t1; 232 SELECT * FROM t1;
233 } 233 }
234 } {5 1 3 2 4 6 2 6 4 8} 234 } {5 1 3 2 4 6 2 6 4 8}
235 235
236 # Test the constraint on the coordinates (c[i]<=c[i+1] where (i%2==0)): 236 # Test the constraint on the coordinates (c[i]<=c[i+1] where (i%2==0)):
237 do_test rtree-3.2.1 { 237 do_test rtree-3.2.1 {
238 catchsql { INSERT INTO t1 VALUES(7, 2, 6, 4, 3) } 238 catchsql { INSERT INTO t1 VALUES(7, 2, 6, 4, 3) }
239 } {1 {constraint failed}} 239 } {1 {rtree constraint failed: t1.(y1<=y2)}}
240 do_test rtree-3.2.2 { 240 do_test rtree-3.2.2 {
241 catchsql { INSERT INTO t1 VALUES(8, 2, 6, 3, 3) } 241 catchsql { INSERT INTO t1 VALUES(8, 2, 6, 3, 3) }
242 } {0 {}} 242 } {0 {}}
243 243
244 #---------------------------------------------------------------------------- 244 #----------------------------------------------------------------------------
245 # Test cases rtree-5.* test DELETE operations. 245 # Test cases rtree-5.* test DELETE operations.
246 # 246 #
247 do_test rtree-5.1.1 { 247 do_test rtree-5.1.1 {
248 execsql { CREATE VIRTUAL TABLE t2 USING rtree(ii, x1, x2) } 248 execsql { CREATE VIRTUAL TABLE t2 USING rtree(ii, x1, x2) }
249 } {} 249 } {}
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 3 "UPDATE %CONF% t1 SET idx = ((idx+1)%5)+1 WHERE idx > 2" { 484 3 "UPDATE %CONF% t1 SET idx = ((idx+1)%5)+1 WHERE idx > 2" {
485 ROLLBACK 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6} 485 ROLLBACK 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6}
486 ABORT 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 486 ABORT 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7}
487 IGNORE 1 0 {1 1 2 3 4 2 2 3 4 5 4 4 5 6 7 5 3 4 5 6} 487 IGNORE 1 0 {1 1 2 3 4 2 2 3 4 5 4 4 5 6 7 5 3 4 5 6}
488 FAIL 1 1 {1 1 2 3 4 2 2 3 4 5 4 4 5 6 7 5 3 4 5 6} 488 FAIL 1 1 {1 1 2 3 4 2 2 3 4 5 4 4 5 6 7 5 3 4 5 6}
489 REPLACE 1 0 {1 4 5 6 7 2 2 3 4 5 5 3 4 5 6} 489 REPLACE 1 0 {1 4 5 6 7 2 2 3 4 5 5 3 4 5 6}
490 } 490 }
491 491
492 4 "INSERT %CONF% INTO t1 VALUES(2, 7, 6, 7, 7)" { 492 4 "INSERT %CONF% INTO t1 VALUES(2, 7, 6, 7, 7)" {
493 ROLLBACK 0 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6} 493 ROLLBACK 0 2 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6}
494 ABORT 0 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 494 ABORT 0 2 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7}
495 IGNORE 0 0 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 495 IGNORE 0 0 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7}
496 FAIL 0 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 496 FAIL 0 2 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7}
497 REPLACE 0 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 497 REPLACE 0 2 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7}
498 } 498 }
499 499
500 } { 500 } {
501 foreach {mode uses error data} $testdata { 501 foreach {mode uses error data} $testdata {
502 db_restore_and_reopen 502 db_restore_and_reopen
503 503
504 set sql [string map [list %CONF% "OR $mode"] $sql_template] 504 set sql [string map [list %CONF% "OR $mode"] $sql_template]
505 set testname "12.$tn.[string tolower $mode]" 505 set testname "12.$tn.[string tolower $mode]"
506 506
507 execsql { 507 execsql {
508 BEGIN; 508 BEGIN;
509 INSERT INTO t1 VALUES(4, 4, 5, 6, 7); 509 INSERT INTO t1 VALUES(4, 4, 5, 6, 7);
510 } 510 }
511 511
512 set res(0) {0 {}} 512 set res(0) {0 {}}
513 set res(1) {1 {constraint failed}} 513 set res(1) {1 {UNIQUE constraint failed: t1.idx}}
514 set res(2) {1 {rtree constraint failed: t1.(x1<=x2)}}
515
514 do_catchsql_test $testname.1 $sql $res($error) 516 do_catchsql_test $testname.1 $sql $res($error)
515 do_test $testname.2 [list sql_uses_stmt db $sql] $uses 517 do_test $testname.2 [list sql_uses_stmt db $sql] $uses
516 do_execsql_test $testname.3 { SELECT * FROM t1 ORDER BY idx } $data 518 do_execsql_test $testname.3 { SELECT * FROM t1 ORDER BY idx } $data
517 519
518 do_test $testname.4 { rtree_check db t1 } 0 520 do_test $testname.4 { rtree_check db t1 } 0
519 db close 521 db close
520 } 522 }
521 } 523 }
522 524
523 #------------------------------------------------------------------------- 525 #-------------------------------------------------------------------------
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 } 586 }
585 do_execsql_test 14.5 { 587 do_execsql_test 14.5 {
586 SELECT * FROM t10; 588 SELECT * FROM t10;
587 } { 589 } {
588 1 0 0 590 1 0 0
589 2 52 81 591 2 52 81
590 3 42 49 592 3 42 49
591 } 593 }
592 594
593 finish_test 595 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698