summaryrefslogtreecommitdiffstats
path: root/test/fts3f.test
blob: d9a57cbc30ab455fef9d0c68e8914b805b89f97d (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
# 2006 September 9
#
# 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.
#
#*************************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is testing the FTS3 module.
#
# $Id: fts3aa.test,v 1.1 2007/08/20 17:38:42 shess Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix fts3f

# If SQLITE_ENABLE_FTS3 is defined, omit this file.
ifcapable !fts3 {
  finish_test
  return
}

do_execsql_test 1.0 {
  CREATE VIRTUAL TABLE ft USING fts3(x);
  BEGIN;
    INSERT INTO ft VALUES('a one'), ('b one'), ('c one');
}

do_test 1.1 {
  set ret [list]
  db eval { SELECT docid FROM ft WHERE ft MATCH 'one' } {
    if { $docid==2 } {
      db eval COMMIT
    }
    lappend ret $docid
  }
  set ret
} {1 2 3}

do_execsql_test 1.2 {
  BEGIN;
    INSERT INTO ft VALUES('a one'), ('b one'), ('c one');
}

do_execsql_test 1.3 {
  SELECT docid, optimize(ft) FROM ft WHERE ft MATCH 'one'
} {
  1 {Index optimized} 2 {Index already optimal} 3 {Index already optimal}
  4 {Index already optimal}
  5 {Index already optimal} 6 {Index already optimal}
}

finish_test