fts5umlaut.test 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # 2014 June 17
  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. source [file join [file dirname [info script]] fts5_common.tcl]
  15. set testprefix fts5umlaut
  16. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  17. ifcapable !fts5 {
  18. finish_test
  19. return
  20. }
  21. do_execsql_test 1.0 {
  22. CREATE VIRTUAL TABLE t1 USING fts5(x);
  23. CREATE VIRTUAL TABLE t2 USING fts5(
  24. x,
  25. tokenize="unicode61 remove_diacritics 2"
  26. );
  27. }
  28. foreach {tn q res1 res2} {
  29. 1 "Hà Nội" 0 1
  30. 2 "Hà Noi" 1 1
  31. 3 "Ha Noi" 1 1
  32. 4 "Ha N\u1ed9i" 0 1
  33. 5 "Ha N\u006fi" 1 1
  34. 6 "Ha N\u006f\u0302i" 1 1
  35. 7 "Ha N\u006f\u0323\u0302i" 1 1
  36. } {
  37. do_execsql_test 1.$tn.1 {
  38. DELETE FROM t1;
  39. INSERT INTO t1(rowid, x) VALUES (1, 'Ha Noi');
  40. SELECT count(*) FROM t1($q)
  41. } $res1
  42. do_execsql_test 1.$tn.2 {
  43. DELETE FROM t1;
  44. INSERT INTO t1(rowid, x) VALUES (1, $q);
  45. SELECT count(*) FROM t1('Ha Noi')
  46. } $res1
  47. do_execsql_test 1.$tn.2 {
  48. DELETE FROM t2;
  49. INSERT INTO t2(rowid, x) VALUES (1, 'Ha Noi');
  50. SELECT count(*) FROM t2($q)
  51. } $res2
  52. do_execsql_test 1.$tn.2 {
  53. DELETE FROM t2;
  54. INSERT INTO t2(rowid, x) VALUES (1, $q);
  55. SELECT count(*) FROM t2('Ha Noi')
  56. } $res2
  57. }
  58. finish_test