summaryrefslogtreecommitdiffstats
path: root/ext/fts5/test/fts5bigid.test
blob: ae20ec641e0b0f21f55a1bbcf2e86d1aaf96ec94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# 2023 May 28
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#*************************************************************************
#

source [file join [file dirname [info script]] fts5_common.tcl]
set testprefix fts5bigid

# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
ifcapable !fts5 {
  finish_test
  return
}

set nRow 20000

proc do_ascdesc_test {tn query} {
  set ::lAsc  [db eval { SELECT rowid FROM x1($query) }] 
  set ::lDesc [db eval { SELECT rowid FROM x1($query) ORDER BY rowid DESC }] 
  do_test $tn.1 { lsort -integer $::lAsc } $::lAsc
  do_test $tn.2 { lsort -integer -decr $::lDesc } $::lDesc
  do_test $tn.3 { lsort -integer $::lDesc } $::lAsc
}

do_execsql_test 1.0 {
  CREATE VIRTUAL TABLE x1 USING fts5(a);
}

do_test 1.1 {
  for {set ii 0} {$ii < $nRow} {incr ii} {
    db eval {
      REPLACE INTO x1(rowid, a) VALUES(random(), 'movement at the station');
    }
  }
} {}

do_ascdesc_test 1.2 "the"

do_execsql_test 1.3 {
  DELETE FROM x1
}

do_test 1.4 {
  for {set ii 0} {$ii < $nRow} {incr ii} {
    db eval {
      INSERT INTO x1(rowid, a) VALUES(
          $ii + 0x6FFFFFFFFFFFFFFF, 'movement at the station'
      );
    }
  }
} {}

do_ascdesc_test 1.5 "movement"

finish_test