PageRenderTime 38ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/src/sqlite/test/fts3fault2.test

#
Unknown | 85 lines | 75 code | 10 blank | 0 comment | 0 complexity | f1f3ba860dec29142388ee5e5425a8bf MD5 | raw file
Possible License(s): BSD-3-Clause
  1. # 2011 February 3
  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. #
  12. set testdir [file dirname $argv0]
  13. source $testdir/tester.tcl
  14. set ::testprefix fts3fault2
  15. # If SQLITE_ENABLE_FTS3 is not defined, omit this file.
  16. ifcapable !fts3 { finish_test ; return }
  17. do_test 1.0 {
  18. execsql {
  19. CREATE VIRTUAL TABLE t1 USING fts4(x);
  20. INSERT INTO t1 VALUES('a b c');
  21. INSERT INTO t1 VALUES('c d e');
  22. CREATE VIRTUAL TABLE terms USING fts4aux(t1);
  23. }
  24. faultsim_save_and_close
  25. } {}
  26. do_faultsim_test 1.1 -prep {
  27. faultsim_restore_and_reopen
  28. db eval {SELECT * FROM sqlite_master}
  29. } -body {
  30. execsql "CREATE VIRTUAL TABLE terms2 USING fts4aux(t1)"
  31. } -test {
  32. faultsim_test_result {0 {}}
  33. }
  34. do_faultsim_test 1.2 -prep {
  35. faultsim_restore_and_reopen
  36. db eval {SELECT * FROM sqlite_master}
  37. } -body {
  38. execsql "SELECT * FROM terms"
  39. } -test {
  40. faultsim_test_result {0 {a * 1 1 a 0 1 1 b * 1 1 b 0 1 1 c * 2 2 c 0 2 2 d * 1 1 d 0 1 1 e * 1 1 e 0 1 1}}
  41. }
  42. do_faultsim_test 1.3 -prep {
  43. faultsim_restore_and_reopen
  44. db eval {SELECT * FROM sqlite_master}
  45. } -body {
  46. execsql "SELECT * FROM terms WHERE term>'a' AND TERM < 'd'"
  47. } -test {
  48. faultsim_test_result {0 {b * 1 1 b 0 1 1 c * 2 2 c 0 2 2}}
  49. }
  50. do_faultsim_test 1.4 -prep {
  51. faultsim_restore_and_reopen
  52. db eval {SELECT * FROM sqlite_master}
  53. } -body {
  54. execsql "SELECT * FROM terms WHERE term='c'"
  55. } -test {
  56. faultsim_test_result {0 {c * 2 2 c 0 2 2}}
  57. }
  58. do_test 2.0 {
  59. faultsim_delete_and_reopen
  60. execsql {
  61. CREATE VIRTUAL TABLE tx USING fts4(a, b);
  62. INSERT INTO tx VALUES('a b c', 'x y z');
  63. CREATE VIRTUAL TABLE terms2 USING fts4aux(tx);
  64. }
  65. faultsim_save_and_close
  66. } {}
  67. do_faultsim_test 2.1 -prep {
  68. faultsim_restore_and_reopen
  69. db eval {SELECT * FROM sqlite_master}
  70. } -body {
  71. execsql "SELECT * FROM terms2"
  72. } -test {
  73. faultsim_test_result {0 {a * 1 1 a 0 1 1 b * 1 1 b 0 1 1 c * 1 1 c 0 1 1 x * 1 1 x 1 1 1 y * 1 1 y 1 1 1 z * 1 1 z 1 1 1}}
  74. }
  75. finish_test