1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
17 AT_BANNER([command name matching])
19 AT_SETUP([single words])
20 AT_KEYWORDS([command name matching])
21 AT_CHECK([command-name-test DESCRIPTIVES , DESCRIPTIVESX DESCRIPTIVES descr Des DEX DE '' 'DESCRIPTIVES MORE' 'DESCRIPTIVES++MORE'],
23 string="DESCRIPTIVESX":
24 command="DESCRIPTIVES" match=no
25 match: none, missing_words=0
27 string="DESCRIPTIVES":
28 command="DESCRIPTIVES" match=yes exact=yes missing_words=0
29 match: DESCRIPTIVES, missing_words=0
32 command="DESCRIPTIVES" match=yes exact=no missing_words=0
33 match: DESCRIPTIVES, missing_words=0
36 command="DESCRIPTIVES" match=yes exact=no missing_words=0
37 match: DESCRIPTIVES, missing_words=0
40 command="DESCRIPTIVES" match=no
41 match: none, missing_words=0
44 command="DESCRIPTIVES" match=no
45 match: none, missing_words=0
48 command="DESCRIPTIVES" match=yes exact=yes missing_words=1
49 match: none, missing_words=1
51 string="DESCRIPTIVES MORE":
52 command="DESCRIPTIVES" match=yes exact=yes missing_words=-1
53 match: DESCRIPTIVES, missing_words=-1
55 string="DESCRIPTIVES@<00A0>@MORE":
56 command="DESCRIPTIVES" match=yes exact=yes missing_words=-1
57 match: DESCRIPTIVES, missing_words=-1
61 AT_SETUP([two words without prefix match])
62 AT_KEYWORDS([command name matching])
63 AT_CHECK([command-name-test 'DO IF' 'DO REPEAT' , 'DO++IF' 'DO REPEAT' 'DO REP' 'DO OTHER' 'D IF' 'DO I' DO],
65 string="DO@<00A0>@IF":
66 command="DO IF" match=yes exact=yes missing_words=0
67 command="DO REPEAT" match=no
68 match: DO IF, missing_words=0
71 command="DO IF" match=no
72 command="DO REPEAT" match=yes exact=yes missing_words=0
73 match: DO REPEAT, missing_words=0
76 command="DO IF" match=no
77 command="DO REPEAT" match=yes exact=no missing_words=0
78 match: DO REPEAT, missing_words=0
81 command="DO IF" match=no
82 command="DO REPEAT" match=no
83 match: none, missing_words=0
86 command="DO IF" match=no
87 command="DO REPEAT" match=no
88 match: none, missing_words=0
91 command="DO IF" match=no
92 command="DO REPEAT" match=no
93 match: none, missing_words=0
96 command="DO IF" match=yes exact=yes missing_words=1
97 command="DO REPEAT" match=yes exact=yes missing_words=1
98 match: none, missing_words=1
102 AT_SETUP([two words with prefix match])
103 AT_KEYWORDS([command name matching])
104 AT_CHECK([command-name-test GET 'GET DATA' , GET 'GET TYPE' 'GET DAT' 'GET DATA'],
107 command="GET" match=yes exact=yes missing_words=0
108 command="GET DATA" match=yes exact=yes missing_words=1
109 match: none, missing_words=1
112 command="GET" match=yes exact=yes missing_words=-1
113 command="GET DATA" match=no
114 match: GET, missing_words=-1
117 command="GET" match=yes exact=yes missing_words=-1
118 command="GET DATA" match=yes exact=no missing_words=0
119 match: GET DATA, missing_words=0
122 command="GET" match=yes exact=yes missing_words=-1
123 command="GET DATA" match=yes exact=yes missing_words=0
124 match: GET DATA, missing_words=0
128 AT_SETUP([ambiguous single-word names])
129 AT_KEYWORDS([command name matching])
130 AT_CHECK([command-name-test CASEPLOT CASESTOVARS , CAS Case CaseP CaseS], [0],
133 command="CASEPLOT" match=yes exact=no missing_words=0
134 command="CASESTOVARS" match=yes exact=no missing_words=0
135 match: none, missing_words=0
138 command="CASEPLOT" match=yes exact=no missing_words=0
139 command="CASESTOVARS" match=yes exact=no missing_words=0
140 match: none, missing_words=0
143 command="CASEPLOT" match=yes exact=no missing_words=0
144 command="CASESTOVARS" match=no
145 match: CASEPLOT, missing_words=0
148 command="CASEPLOT" match=no
149 command="CASESTOVARS" match=yes exact=no missing_words=0
150 match: CASESTOVARS, missing_words=0
154 AT_SETUP([ambiguous two-word names])
155 AT_KEYWORDS([command name matching])
156 AT_CHECK([command-name-test VARCOMP VARSTOCASES 'VARIABLE ATTRIBUTE' , VAR VARC VARS VARI 'VAR++ATT'],
159 command="VARCOMP" match=yes exact=no missing_words=0
160 command="VARSTOCASES" match=yes exact=no missing_words=0
161 command="VARIABLE ATTRIBUTE" match=yes exact=no missing_words=1
162 match: none, missing_words=1
165 command="VARCOMP" match=yes exact=no missing_words=0
166 command="VARSTOCASES" match=no
167 command="VARIABLE ATTRIBUTE" match=no
168 match: VARCOMP, missing_words=0
171 command="VARCOMP" match=no
172 command="VARSTOCASES" match=yes exact=no missing_words=0
173 command="VARIABLE ATTRIBUTE" match=no
174 match: VARSTOCASES, missing_words=0
177 command="VARCOMP" match=no
178 command="VARSTOCASES" match=no
179 command="VARIABLE ATTRIBUTE" match=yes exact=no missing_words=1
180 match: none, missing_words=1
182 string="VAR@<00A0>@ATT":
183 command="VARCOMP" match=yes exact=no missing_words=-1
184 command="VARSTOCASES" match=yes exact=no missing_words=-1
185 command="VARIABLE ATTRIBUTE" match=yes exact=no missing_words=0
186 match: VARIABLE ATTRIBUTE, missing_words=0
190 AT_SETUP([numbers and punctuation])
191 AT_KEYWORDS([command name matching])
192 AT_CHECK([command-name-test T-TEST 2SLS LIST , T-TEST 'T - Test' 2SLS '2 SLS' List],
195 command="T-TEST" match=yes exact=yes missing_words=0
196 command="2SLS" match=no
197 command="LIST" match=no
198 match: T-TEST, missing_words=0
201 command="T-TEST" match=yes exact=yes missing_words=0
202 command="2SLS" match=no
203 command="LIST" match=no
204 match: T-TEST, missing_words=0
207 command="T-TEST" match=no
208 command="2SLS" match=yes exact=yes missing_words=0
209 command="LIST" match=no
210 match: 2SLS, missing_words=0
213 command="T-TEST" match=no
214 command="2SLS" match=yes exact=yes missing_words=0
215 command="LIST" match=no
216 match: 2SLS, missing_words=0
219 command="T-TEST" match=no
220 command="2SLS" match=no
221 command="LIST" match=yes exact=yes missing_words=0
222 match: LIST, missing_words=0
226 AT_SETUP([off by more than one word])
227 AT_KEYWORDS([command name matching])
228 AT_CHECK([command-name-test 'a++b c' , a 'a b' 'a b c' 'a++b c d' 'a b c++d e'],
231 command="a@<00A0>@b c" match=yes exact=yes missing_words=2
232 match: none, missing_words=1
235 command="a@<00A0>@b c" match=yes exact=yes missing_words=1
236 match: none, missing_words=1
239 command="a@<00A0>@b c" match=yes exact=yes missing_words=0
240 match: a@<00A0>@b c, missing_words=0
242 string="a@<00A0>@b c d":
243 command="a@<00A0>@b c" match=yes exact=yes missing_words=-1
244 match: a@<00A0>@b c, missing_words=-1
246 string="a b c@<00A0>@d e":
247 command="a@<00A0>@b c" match=yes exact=yes missing_words=-2
248 match: a@<00A0>@b c, missing_words=-2