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/>.
16 dnl AT_BANNER([command name matching])
18 AT_SETUP([single words])
19 AT_KEYWORDS([command name matching])
20 AT_CHECK([command-name-test DESCRIPTIVES , DESCRIPTIVESX DESCRIPTIVES descr Des DEX DE '' 'DESCRIPTIVES MORE' 'DESCRIPTIVES@<00A0>@MORE'],
22 string="DESCRIPTIVESX":
23 command="DESCRIPTIVES" match=no
24 match: none, missing_words=0
26 string="DESCRIPTIVES":
27 command="DESCRIPTIVES" match=yes exact=yes missing_words=0
28 match: DESCRIPTIVES, missing_words=0
31 command="DESCRIPTIVES" match=yes exact=no missing_words=0
32 match: DESCRIPTIVES, missing_words=0
35 command="DESCRIPTIVES" match=yes exact=no missing_words=0
36 match: DESCRIPTIVES, missing_words=0
39 command="DESCRIPTIVES" match=no
40 match: none, missing_words=0
43 command="DESCRIPTIVES" match=no
44 match: none, missing_words=0
47 command="DESCRIPTIVES" match=yes exact=yes missing_words=1
48 match: none, missing_words=1
50 string="DESCRIPTIVES MORE":
51 command="DESCRIPTIVES" match=yes exact=yes missing_words=-1
52 match: DESCRIPTIVES, missing_words=-1
54 string="DESCRIPTIVES@<00A0>@MORE":
55 command="DESCRIPTIVES" match=yes exact=yes missing_words=-1
56 match: DESCRIPTIVES, missing_words=-1
60 AT_SETUP([two words without prefix match])
61 AT_KEYWORDS([command name matching])
62 AT_CHECK([command-name-test 'DO IF' 'DO REPEAT' , 'DO@<00A0>@IF' 'DO REPEAT' 'DO REP' 'DO OTHER' 'D IF' 'DO I' DO],
64 string="DO@<00A0>@IF":
65 command="DO IF" match=yes exact=yes missing_words=0
66 command="DO REPEAT" match=no
67 match: DO IF, missing_words=0
70 command="DO IF" match=no
71 command="DO REPEAT" match=yes exact=yes missing_words=0
72 match: DO REPEAT, missing_words=0
75 command="DO IF" match=no
76 command="DO REPEAT" match=yes exact=no missing_words=0
77 match: DO REPEAT, missing_words=0
80 command="DO IF" match=no
81 command="DO REPEAT" match=no
82 match: none, missing_words=0
85 command="DO IF" match=no
86 command="DO REPEAT" match=no
87 match: none, missing_words=0
90 command="DO IF" match=no
91 command="DO REPEAT" match=no
92 match: none, missing_words=0
95 command="DO IF" match=yes exact=yes missing_words=1
96 command="DO REPEAT" match=yes exact=yes missing_words=1
97 match: none, missing_words=1
101 AT_SETUP([two words with prefix match])
102 AT_KEYWORDS([command name matching])
103 AT_CHECK([command-name-test GET 'GET DATA' , GET 'GET TYPE' 'GET DAT' 'GET DATA'],
106 command="GET" match=yes exact=yes missing_words=0
107 command="GET DATA" match=yes exact=yes missing_words=1
108 match: none, missing_words=1
111 command="GET" match=yes exact=yes missing_words=-1
112 command="GET DATA" match=no
113 match: GET, missing_words=-1
116 command="GET" match=yes exact=yes missing_words=-1
117 command="GET DATA" match=yes exact=no missing_words=0
118 match: GET DATA, missing_words=0
121 command="GET" match=yes exact=yes missing_words=-1
122 command="GET DATA" match=yes exact=yes missing_words=0
123 match: GET DATA, missing_words=0
127 AT_SETUP([ambiguous single-word names])
128 AT_KEYWORDS([command name matching])
129 AT_CHECK([command-name-test CASEPLOT CASESTOVARS , CAS Case CaseP CaseS], [0],
132 command="CASEPLOT" match=yes exact=no missing_words=0
133 command="CASESTOVARS" match=yes exact=no missing_words=0
134 match: none, missing_words=0
137 command="CASEPLOT" match=yes exact=no missing_words=0
138 command="CASESTOVARS" match=yes exact=no missing_words=0
139 match: none, missing_words=0
142 command="CASEPLOT" match=yes exact=no missing_words=0
143 command="CASESTOVARS" match=no
144 match: CASEPLOT, missing_words=0
147 command="CASEPLOT" match=no
148 command="CASESTOVARS" match=yes exact=no missing_words=0
149 match: CASESTOVARS, missing_words=0
153 AT_SETUP([ambiguous two-word names])
154 AT_KEYWORDS([command name matching])
155 AT_CHECK([command-name-test VARCOMP VARSTOCASES 'VARIABLE ATTRIBUTE' , VAR VARC VARS VARI 'VAR@<00A0>@ATT'],
158 command="VARCOMP" match=yes exact=no missing_words=0
159 command="VARSTOCASES" match=yes exact=no missing_words=0
160 command="VARIABLE ATTRIBUTE" match=yes exact=no missing_words=1
161 match: none, missing_words=1
164 command="VARCOMP" match=yes exact=no missing_words=0
165 command="VARSTOCASES" match=no
166 command="VARIABLE ATTRIBUTE" match=no
167 match: VARCOMP, missing_words=0
170 command="VARCOMP" match=no
171 command="VARSTOCASES" match=yes exact=no missing_words=0
172 command="VARIABLE ATTRIBUTE" match=no
173 match: VARSTOCASES, missing_words=0
176 command="VARCOMP" match=no
177 command="VARSTOCASES" match=no
178 command="VARIABLE ATTRIBUTE" match=yes exact=no missing_words=1
179 match: none, missing_words=1
181 string="VAR@<00A0>@ATT":
182 command="VARCOMP" match=yes exact=no missing_words=-1
183 command="VARSTOCASES" match=yes exact=no missing_words=-1
184 command="VARIABLE ATTRIBUTE" match=yes exact=no missing_words=0
185 match: VARIABLE ATTRIBUTE, missing_words=0
189 AT_SETUP([numbers and punctuation])
190 AT_KEYWORDS([command name matching])
191 AT_CHECK([command-name-test T-TEST 2SLS LIST , T-TEST 'T - Test' 2SLS '2 SLS' List],
194 command="T-TEST" match=yes exact=yes missing_words=0
195 command="2SLS" match=no
196 command="LIST" match=no
197 match: T-TEST, missing_words=0
200 command="T-TEST" match=yes exact=yes missing_words=0
201 command="2SLS" match=no
202 command="LIST" match=no
203 match: T-TEST, missing_words=0
206 command="T-TEST" match=no
207 command="2SLS" match=yes exact=yes missing_words=0
208 command="LIST" match=no
209 match: 2SLS, missing_words=0
212 command="T-TEST" match=no
213 command="2SLS" match=yes exact=yes missing_words=0
214 command="LIST" match=no
215 match: 2SLS, missing_words=0
218 command="T-TEST" match=no
219 command="2SLS" match=no
220 command="LIST" match=yes exact=yes missing_words=0
221 match: LIST, missing_words=0
225 AT_SETUP([off by more than one word])
226 AT_KEYWORDS([command name matching])
227 AT_CHECK([command-name-test 'a@<00A0>@b c' , a 'a b' 'a b c' 'a@<00A0>@b c d' 'a b c@<00A0>@d e'],
230 command="a@<00A0>@b c" match=yes exact=yes missing_words=2
231 match: none, missing_words=1
234 command="a@<00A0>@b c" match=yes exact=yes missing_words=1
235 match: none, missing_words=1
238 command="a@<00A0>@b c" match=yes exact=yes missing_words=0
239 match: a@<00A0>@b c, missing_words=0
241 string="a@<00A0>@b c d":
242 command="a@<00A0>@b c" match=yes exact=yes missing_words=-1
243 match: a@<00A0>@b c, missing_words=-1
245 string="a b c@<00A0>@d e":
246 command="a@<00A0>@b c" match=yes exact=yes missing_words=-2
247 match: a@<00A0>@b c, missing_words=-2