rtreeG.test 1.5 KB

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