fts5expr.test 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # 2024 August 8
  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. The
  12. # focus of this script is testing the FTS5 module.
  13. #
  14. source [file join [file dirname [info script]] fts5_common.tcl]
  15. set testprefix fts5expr
  16. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  17. ifcapable !fts5 {
  18. finish_test
  19. return
  20. }
  21. do_execsql_test 1.0 {
  22. CREATE VIRTUAL TABLE x1 USING fts5(a);
  23. INSERT INTO x1(rowid, a) VALUES (113, 'fts5 expr test');
  24. }
  25. do_execsql_test 1.1 {
  26. SELECT rowid FROM x1('expr');
  27. } {113}
  28. for {set ii 0} {$ii < 300} {incr ii} {
  29. set expr "expr "
  30. append expr [string repeat "NOT abcd " $ii]
  31. if {$ii<257} {
  32. set res {0 113}
  33. } else {
  34. set res {1 {fts5 expression tree is too large (maximum depth 256)}}
  35. }
  36. do_catchsql_test 1.1.$ii {
  37. SELECT rowid FROM x1($expr)
  38. } $res
  39. }
  40. do_execsql_test 1.2 {
  41. SELECT rowid FROM x1 WHERE a MATCH '"..."'
  42. } {}
  43. finish_test