SQLite

Check-in [8599402092]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add test file spellfix2.test, which should have been checked in some time ago.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8599402092537ab3df8926eb900661c12d738d4c
User & Date: dan 2015-08-18 19:09:28.809
Context
2015-08-19
08:34
When updating a zipvfs database with RBU, set journal_mode=off to prevent the upper-level pager from creating a large temporary file. (check-in: dec14a3980 user: dan tags: trunk)
2015-08-18
19:09
Add test file spellfix2.test, which should have been checked in some time ago. (check-in: 8599402092 user: dan tags: trunk)
16:32
Fix harmless compiler warning in FTS5. (check-in: 02448a9fcc user: mistachkin tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Added test/spellfix2.test.




































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# 2012 July 12
#
# 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.
#
#***********************************************************************
#

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

ifcapable !vtab { finish_test ; return }
load_static_extension db spellfix nextchar

do_execsql_test 1.0 {
  CREATE VIRTUAL TABLE demo USING spellfix1;
  INSERT INTO demo(word) VALUES ('amsterdam');
  INSERT INTO demo(word) VALUES ('amsterdammetje');
  INSERT INTO demo(word) VALUES ('amsterdamania');
  INSERT INTO demo(word) VALUES ('amsterdamweg');
  INSERT INTO demo(word) VALUES ('amsterdamsestraat');
  INSERT INTO demo(word) VALUES ('amsterdamlaan');
}

do_execsql_test 1.1 {
  SELECT word, distance, matchlen FROM demo 
  WHERE word MATCH 'amstedam*' AND top=3;
} {
   amsterdam      100 9
   amsterdammetje 100 9
   amsterdamania  100 9
}

do_execsql_test 1.2 {
  SELECT word, distance, matchlen FROM demo WHERE 
  word MATCH 'amstedam*' AND top=3 AND distance <= 100;
} {
   amsterdam      100 9
   amsterdammetje 100 9
   amsterdamania  100 9
}

do_execsql_test 1.3 {
  SELECT word, distance, matchlen FROM demo WHERE 
  word MATCH 'amstedam*' AND distance <= 100;
} {
   amsterdam         100 9
   amsterdammetje    100 9
   amsterdamania     100 9
   amsterdamweg      100 9
   amsterdamsestraat 100 9
   amsterdamlaan     100 9
}

do_test 1.4 {
  foreach l {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
    execsql { INSERT INTO demo(word) VALUES ('amsterdam' || $l) }
  }
} {}

do_execsql_test 1.5 {
  SELECT count(*) FROM demo WHERE word MATCH 'amstedam*' AND distance <= 100;
  SELECT count(*) FROM demo 
  WHERE word MATCH 'amstedam*' AND distance <= 100 AND top=20;
} {
  32 20
}

do_execsql_test 1.6 {
  SELECT word, distance, matchlen FROM demo 
  WHERE word MATCH 'amstedam*' AND distance <= 100;
} {
  amsterdam         100 9        amsterdamh        100 9
  amsterdamm        100 9        amsterdamn        100 9
  amsterdama        100 9        amsterdame        100 9
  amsterdami        100 9        amsterdamo        100 9
  amsterdamu        100 9        amsterdamy        100 9
  amsterdammetje    100 9        amsterdamania     100 9
  amsterdamb        100 9        amsterdamf        100 9
  amsterdamp        100 9        amsterdamv        100 9
  amsterdamw        100 9        amsterdamweg      100 9
  amsterdamc        100 9        amsterdamg        100 9
  amsterdamj        100 9        amsterdamk        100 9
  amsterdamq        100 9        amsterdams        100 9
  amsterdamx        100 9        amsterdamz        100 9
  amsterdamsestraat 100 9        amsterdamd        100 9
  amsterdamt        100 9        amsterdaml        100 9
  amsterdamlaan     100 9        amsterdamr        100 9
}

do_execsql_test 1.7 {
  SELECT word, distance, matchlen FROM demo 
  WHERE word MATCH 'amstedam*' AND distance <= 100 AND top=20;
} {
  amsterdam         100 9        amsterdamh        100 9
  amsterdamm        100 9        amsterdamn        100 9
  amsterdama        100 9        amsterdame        100 9
  amsterdami        100 9        amsterdamo        100 9
  amsterdamu        100 9        amsterdamy        100 9
  amsterdammetje    100 9        amsterdamania     100 9
  amsterdamb        100 9        amsterdamf        100 9
  amsterdamp        100 9        amsterdamv        100 9
  amsterdamw        100 9        amsterdamweg      100 9
  amsterdamc        100 9        amsterdamg        100 9
}


finish_test