fts5bigid.test 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # 2023 May 28
  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. source [file join [file dirname [info script]] fts5_common.tcl]
  13. set testprefix fts5bigid
  14. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  15. ifcapable !fts5 {
  16. finish_test
  17. return
  18. }
  19. set nRow 20000
  20. proc do_ascdesc_test {tn query} {
  21. set ::lAsc [db eval { SELECT rowid FROM x1($query) }]
  22. set ::lDesc [db eval { SELECT rowid FROM x1($query) ORDER BY rowid DESC }]
  23. do_test $tn.1 { lsort -integer $::lAsc } $::lAsc
  24. do_test $tn.2 { lsort -integer -decr $::lDesc } $::lDesc
  25. do_test $tn.3 { lsort -integer $::lDesc } $::lAsc
  26. }
  27. do_execsql_test 1.0 {
  28. CREATE VIRTUAL TABLE x1 USING fts5(a);
  29. }
  30. do_test 1.1 {
  31. for {set ii 0} {$ii < $nRow} {incr ii} {
  32. db eval {
  33. REPLACE INTO x1(rowid, a) VALUES(random(), 'movement at the station');
  34. }
  35. }
  36. } {}
  37. do_ascdesc_test 1.2 "the"
  38. do_execsql_test 1.3 {
  39. DELETE FROM x1
  40. }
  41. do_test 1.4 {
  42. for {set ii 0} {$ii < $nRow} {incr ii} {
  43. db eval {
  44. INSERT INTO x1(rowid, a) VALUES(
  45. $ii + 0x6FFFFFFFFFFFFFFF, 'movement at the station'
  46. );
  47. }
  48. }
  49. } {}
  50. do_ascdesc_test 1.5 "movement"
  51. finish_test