OLD | NEW |
1 # 2007 June 21 | 1 # 2007 June 21 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #************************************************************************* | 10 #************************************************************************* |
11 # This file implements regression tests for SQLite library. The focus | 11 # This file implements regression tests for SQLite library. The focus |
12 # of this script is testing the pluggable tokeniser feature of the | 12 # of this script is testing the pluggable tokeniser feature of the |
13 # FTS3 module. | 13 # FTS3 module. |
14 # | 14 # |
15 # $Id: fts3atoken.test,v 1.1 2007/08/20 17:38:42 shess Exp $ | 15 # $Id: fts3atoken.test,v 1.1 2007/08/20 17:38:42 shess Exp $ |
16 # | 16 # |
17 | 17 |
18 set testdir [file dirname $argv0] | 18 set testdir [file dirname $argv0] |
19 source $testdir/tester.tcl | 19 source $testdir/tester.tcl |
20 | 20 |
21 # If SQLITE_ENABLE_FTS3 is defined, omit this file. | 21 # If SQLITE_ENABLE_FTS3 is defined, omit this file. |
22 ifcapable !fts3 { | 22 ifcapable !fts3 { |
23 finish_test | 23 finish_test |
24 return | 24 return |
25 } | 25 } |
26 | 26 |
| 27 set ::testprefix fts3token |
| 28 |
27 proc escape_string {str} { | 29 proc escape_string {str} { |
28 set out "" | 30 set out "" |
29 foreach char [split $str ""] { | 31 foreach char [split $str ""] { |
30 scan $char %c i | 32 scan $char %c i |
31 if {$i<=127} { | 33 if {$i<=127} { |
32 append out $char | 34 append out $char |
33 } else { | 35 } else { |
34 append out [format {\x%.4x} $i] | 36 append out [format {\x%.4x} $i] |
35 } | 37 } |
36 } | 38 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 set input "short tokens then " | 160 set input "short tokens then " |
159 append input $longtoken | 161 append input $longtoken |
160 set output "0 short short " | 162 set output "0 short short " |
161 append output "1 tokens tokens " | 163 append output "1 tokens tokens " |
162 append output "2 then then " | 164 append output "2 then then " |
163 append output "3 [string tolower $longtoken] $longtoken" | 165 append output "3 [string tolower $longtoken] $longtoken" |
164 | 166 |
165 do_icu_test fts3token-4.6 MiddleOfTheOcean $input $output | 167 do_icu_test fts3token-4.6 MiddleOfTheOcean $input $output |
166 do_icu_test fts3token-4.7 th_TH $input $output | 168 do_icu_test fts3token-4.7 th_TH $input $output |
167 do_icu_test fts3token-4.8 en_US $input $output | 169 do_icu_test fts3token-4.8 en_US $input $output |
| 170 |
| 171 do_execsql_test 5.1 { |
| 172 CREATE VIRTUAL TABLE x1 USING fts3(name,TOKENIZE icu en_US); |
| 173 insert into x1 (name) values (NULL); |
| 174 insert into x1 (name) values (NULL); |
| 175 delete from x1; |
| 176 } |
| 177 |
| 178 proc cp_to_str {codepoint_list} { |
| 179 set fmt [string repeat %c [llength $codepoint_list]] |
| 180 eval [list format $fmt] $codepoint_list |
| 181 } |
| 182 |
| 183 do_test 5.2 { |
| 184 set str [cp_to_str {19968 26085 32822 32645 27874 23433 20986}] |
| 185 execsql { INSERT INTO x1 VALUES($str) } |
| 186 } {} |
168 } | 187 } |
169 | 188 |
| 189 |
170 do_test fts3token-internal { | 190 do_test fts3token-internal { |
171 execsql { SELECT fts3_tokenizer_internal_test() } | 191 execsql { SELECT fts3_tokenizer_internal_test() } |
172 } {ok} | 192 } {ok} |
173 | 193 |
| 194 |
174 finish_test | 195 finish_test |
OLD | NEW |