3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 set testprefix spellfix2
17 ifcapable !vtab { finish_test ; return }
18 load_static_extension db spellfix nextchar
21 CREATE VIRTUAL TABLE demo USING spellfix1;
22 INSERT INTO demo(word) VALUES ('amsterdam');
23 INSERT INTO demo(word) VALUES ('amsterdammetje');
24 INSERT INTO demo(word) VALUES ('amsterdamania');
25 INSERT INTO demo(word) VALUES ('amsterdamweg');
26 INSERT INTO demo(word) VALUES ('amsterdamsestraat');
27 INSERT INTO demo(word) VALUES ('amsterdamlaan');
31 SELECT word, distance, matchlen FROM demo
32 WHERE word MATCH 'amstedam*' AND top=3
41 SELECT word, distance, matchlen FROM demo WHERE
42 word MATCH 'amstedam*' AND top=3 AND distance <= 100
51 SELECT word, distance, matchlen FROM demo WHERE
52 word MATCH 'amstedam*' AND distance <= 100
59 amsterdamsestraat 100 9
64 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} {
65 execsql { INSERT INTO demo(word) VALUES ('amsterdam' || $l) }
70 SELECT count(*) FROM demo WHERE word MATCH 'amstedam*' AND distance <= 100;
71 SELECT count(*) FROM demo
72 WHERE word MATCH 'amstedam*' AND distance <= 100 AND top=20;
78 SELECT word, distance, matchlen FROM demo
79 WHERE word MATCH 'amstedam*' AND distance <= 100
80 ORDER BY distance, word;
82 amsterdam 100 9 amsterdama 100 9
83 amsterdamania 100 9 amsterdamb 100 9
84 amsterdamc 100 9 amsterdamd 100 9
85 amsterdame 100 9 amsterdamf 100 9
86 amsterdamg 100 9 amsterdamh 100 9
87 amsterdami 100 9 amsterdamj 100 9
88 amsterdamk 100 9 amsterdaml 100 9
89 amsterdamlaan 100 9 amsterdamm 100 9
90 amsterdammetje 100 9 amsterdamn 100 9
91 amsterdamo 100 9 amsterdamp 100 9
92 amsterdamq 100 9 amsterdamr 100 9
93 amsterdams 100 9 amsterdamsestraat 100 9
94 amsterdamt 100 9 amsterdamu 100 9
95 amsterdamv 100 9 amsterdamw 100 9
96 amsterdamweg 100 9 amsterdamx 100 9
97 amsterdamy 100 9 amsterdamz 100 9
100 do_execsql_test 1.7 {
101 SELECT word, distance, matchlen FROM demo
102 WHERE word MATCH 'amstedam*' AND distance <= 100 AND top=20
103 ORDER BY distance, word;
105 amsterdam 100 9 amsterdama 100 9
106 amsterdamania 100 9 amsterdamb 100 9
107 amsterdamc 100 9 amsterdame 100 9
108 amsterdamf 100 9 amsterdamg 100 9
109 amsterdamh 100 9 amsterdami 100 9
110 amsterdamm 100 9 amsterdammetje 100 9
111 amsterdamn 100 9 amsterdamo 100 9
112 amsterdamp 100 9 amsterdamu 100 9
113 amsterdamv 100 9 amsterdamw 100 9
114 amsterdamweg 100 9 amsterdamy 100 9