blob: a5a652fb42938d3616c8bc117622bb035477dde2 [file] [log] [blame]
dane89feee2018-12-03 16:14:49 +00001# 2018 December 3
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
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.
9#
10#*************************************************************************
11# This file implements regression tests for SQLite library. The
12# focus of this script is testing the FTS5 module.
13#
14
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17set testprefix fts4umlaut
18
dan583521f2018-12-22 07:16:42 +000019ifcapable !fts3 {
dane89feee2018-12-03 16:14:49 +000020 finish_test
21 return
22}
23
24do_execsql_test 1.0 {
dan583521f2018-12-22 07:16:42 +000025 CREATE VIRTUAL TABLE t1 USING fts4(x, tokenize=unicode61);
dane89feee2018-12-03 16:14:49 +000026 CREATE VIRTUAL TABLE t2 USING fts4(
27 x,
28 tokenize=unicode61 "remove_diacritics=2"
29 );
30}
31
32foreach {tn q res1 res2} {
33 1 "Hà Nội" 0 1
34 2 "Hà Noi" 1 1
35 3 "Ha Noi" 1 1
36 4 "Ha N\u1ed9i" 0 1
37 5 "Ha N\u006fi" 1 1
38 6 "Ha N\u006f\u0302i" 1 1
39 7 "Ha N\u006f\u0323\u0302i" 1 1
40} {
41 do_execsql_test 1.$tn.1 {
42 DELETE FROM t1;
43 INSERT INTO t1(rowid, x) VALUES (1, 'Ha Noi');
44 SELECT count(*) FROM t1 WHERE t1 MATCH $q
45 } $res1
46 do_execsql_test 1.$tn.2 {
47 DELETE FROM t1;
48 INSERT INTO t1(rowid, x) VALUES (1, $q);
49 SELECT count(*) FROM t1 WHERE t1 MATCH 'Ha Noi'
50 } $res1
51
dan583521f2018-12-22 07:16:42 +000052 do_execsql_test 1.$tn.3 {
dane89feee2018-12-03 16:14:49 +000053 DELETE FROM t2;
54 INSERT INTO t2(rowid, x) VALUES (1, 'Ha Noi');
55 SELECT count(*) FROM t2 WHERE t2 MATCH $q
56 } $res2
dan583521f2018-12-22 07:16:42 +000057 do_execsql_test 1.$tn.4 {
dane89feee2018-12-03 16:14:49 +000058 DELETE FROM t2;
59 INSERT INTO t2(rowid, x) VALUES (1, $q);
60 SELECT count(*) FROM t2 WHERE t2 MATCH 'Ha Noi'
61 } $res2
62}
63
64finish_test