From c1e63be3601e5a287c97f946a2a49a4761509176 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 18 Aug 2015 19:09:28 +0000 Subject: [PATCH] Add test file spellfix2.test, which should have been checked in some time ago. FossilOrigin-Name: 8599402092537ab3df8926eb900661c12d738d4c --- manifest | 13 ++--- manifest.uuid | 2 +- test/spellfix2.test | 114 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 7 deletions(-) create mode 100644 test/spellfix2.test diff --git a/manifest b/manifest index 8add10892e..e8d8f571a1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarning\sin\sFTS5. -D 2015-08-18T16:32:45.211 +C Add\stest\sfile\sspellfix2.test,\swhich\sshould\shave\sbeen\schecked\sin\ssome\stime\sago. +D 2015-08-18T19:09:28.809 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2fc9ca6bf5949d415801c007ed3004a4bdb7c380 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1016,6 +1016,7 @@ F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b F test/speedtest1.c 857439869d1cb4db35e1c720ee9c2756eb9ea2a0 F test/spellfix.test 0597065ff57042df1f138e6a2611ae19c2698135 +F test/spellfix2.test e5f2bc1dae046dbdd8008f2a84ed7749ff9b325e F test/sqldiff1.test 8f6bc7c6a5b3585d350d779c6078869ba402f8f5 F test/sqllimits1.test e05786eaed7950ff6a2d00031d001d8a26131e68 F test/stat.test 8de91498c99f5298b303f70f1d1f3b9557af91bf @@ -1373,7 +1374,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f65a9b4ab2c6f0b7028e16e2a0f83fd6d58ae1cd -R 991670fb0c06e37ef5a984fb7f069a97 -U mistachkin -Z 6b28dc07256cbacd1d8439eff1dbe32a +P 02448a9fccd4532daa667e4ba6ff1dbb7f68008a +R e8ec4f5131e6ed0a1e842df7f619d541 +U dan +Z 8dc6a1f25685915b0d47708aa8d01a68 diff --git a/manifest.uuid b/manifest.uuid index 355b99a2e1..5d84140b43 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -02448a9fccd4532daa667e4ba6ff1dbb7f68008a \ No newline at end of file +8599402092537ab3df8926eb900661c12d738d4c \ No newline at end of file diff --git a/test/spellfix2.test b/test/spellfix2.test new file mode 100644 index 0000000000..b4614a9e1f --- /dev/null +++ b/test/spellfix2.test @@ -0,0 +1,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 + -- 2.47.2