fts4merge4.test 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # 2013 May 29
  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 implements regression tests for SQLite library.
  12. #
  13. set testdir [file dirname $argv0]
  14. source $testdir/tester.tcl
  15. source $testdir/fts3_common.tcl
  16. set ::testprefix fts4merge4
  17. ifcapable !fts3 {
  18. finish_test
  19. return
  20. }
  21. set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
  22. do_execsql_test 1.1 { CREATE VIRTUAL TABLE t1 USING fts4 }
  23. do_test 1.2 {
  24. for {set i 0} {$i < 2000} {incr i} {
  25. execsql {INSERT INTO t1 VALUES('a b c d e f g h i j k l');}
  26. }
  27. } {}
  28. do_test 1.3 {
  29. execsql BEGIN
  30. for {set i 0} {$i < 2000} {incr i} {
  31. execsql {INSERT INTO t1 VALUES('a b c d e f g h i j k l');}
  32. }
  33. execsql {
  34. INSERT INTO t1(t1) VALUES('merge=8,50');
  35. COMMIT
  36. }
  37. } {}
  38. reset_db
  39. do_execsql_test 2.0 { CREATE VIRTUAL TABLE t1 USING fts4 }
  40. do_test 2.1 {
  41. for {set i 0} {$i < 2000} {incr i} {
  42. execsql {INSERT INTO t1 VALUES('a b c d e f g h i j k l');}
  43. }
  44. } {}
  45. do_execsql_test 2.2 { SELECT count(*) FROM t1_segdir; } 35
  46. do_execsql_test 2.3 { INSERT INTO t1(t1) VALUES('optimize') } {}
  47. do_execsql_test 2.4 { SELECT count(*) FROM t1_segdir; } 1
  48. sqlite3_enable_shared_cache $::enable_shared_cache
  49. finish_test