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 #***********************************************************************
12 # Test cases for the editdist3() function in the spellfix extension.
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 set testprefix spellfix4
19 ifcapable !vtab { finish_test ; return }
21 load_static_extension db spellfix
24 CREATE TABLE cost1(iLang, cFrom, cTo, iCost);
25 INSERT INTO cost1 VALUES
32 SELECT editdist3('cost1');
33 SELECT editdist3('anchor','amchor');
36 SELECT editdist3('anchor','anchoxr');
39 SELECT editdist3('anchor','xanchor');
42 SELECT editdist3('anchor','anchorx');
45 SELECT editdist3('anchor','anchr');
48 SELECT editdist3('anchor','ancho');
51 SELECT editdist3('anchor','nchor');
54 SELECT editdist3('anchor','anchur');
57 SELECT editdist3('anchor','onchor');
60 SELECT editdist3('anchor','anchot');
63 SELECT editdist3('anchor','omchor');
67 INSERT INTO cost1 VALUES
71 SELECT editdist3('cost1');
72 SELECT editdist3('strasse','straße');
73 SELECT editdist3('straße','strasse');
76 SELECT editdist3('baume','bäume');
79 SELECT editdist3('baum','bäume');
82 INSERT INTO cost1 VALUES
86 SELECT editdist3('cost1');
87 SELECT editdist3('strasse','straße');
88 SELECT editdist3('straße','strasse');
93 INSERT INTO cost1 VALUES
120 CREATE TABLE words(x TEXT);
121 INSERT INTO words VALUES
335 SELECT editdist3('cost1');
337 do_execsql_test 310 {
338 SELECT editdist3(a.x,b.x), a.x, b.x
339 FROM words a, words b
343 } {139 bucket pocket 144 meter motor 149 manual mental 169 crack trick 173 sinatra sonata 174 edition emotion 174 major motor 174 risk rose 174 state stone 194 deal detail 196 alert talent 196 analog catalog 196 deal legal 196 ford forum 196 risk trick 196 stone strong 197 china tina 197 congo logo 197 diana tina 197 florida gloria}
344 do_execsql_test 320 {
345 SELECT md5sum(ed||'/'||sx||'/'||sy||',') FROM (
346 SELECT editdist3(a.x,b.x) AS ed, a.x AS sx, b.x AS sy
347 FROM words a, words b
351 } {69d0a31872203a775e19325ea98cd053}