1# 2014 Dec 20
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#
12# Tests focusing on the fts5 porter stemmer implementation.
13#
14# These are extra tests added to those in fts5porter.test in order to
15# improve test coverage of the porter stemmer implementation.
16#
17
18source [file join [file dirname [info script]] fts5_common.tcl]
19set testprefix fts5porter2
20
21# If SQLITE_ENABLE_FTS5 is defined, omit this file.
22ifcapable !fts5 {
23  finish_test
24  return
25}
26
27set test_vocab {
28  tion          tion
29  ation         ation
30  vation        vation
31  avation       avat
32  vion          vion
33  ion           ion
34  relational    relat
35  relation      relat
36  relate        relat
37  zzz           zzz
38  ii            ii
39  iiing         ii
40  xtional       xtional
41  xenci         xenci
42  xlogi         xlogi
43  realization   realiz
44  realize       realiz
45  xization      xizat
46  capitalism    capit
47  talism        talism
48  xiveness      xive
49  xfulness      xful
50  xousness      xous
51  xical         xical
52  xicate        xicat
53  xicity        xiciti
54  ies           ie
55  eed           e
56  eing           e
57  s             s
58}
59
60set i 0
61foreach {in out} $test_vocab {
62  do_test "1.$i.($in -> $out)" {
63    lindex [sqlite3_fts5_tokenize db porter $in] 0
64  } $out
65  incr i
66}
67
68
69finish_test
70