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([DO REPEAT])
19 AT_SETUP([DO REPEAT -- simple])
20 AT_DATA([do-repeat.sps], [dnl
23 DO REPEAT xval = 1 2 3 / yval = 'a' 'b' 'c' / var = a b c.
33 AT_CHECK([pspp -o pspp.csv do-repeat.sps])
34 AT_CHECK([cat pspp.csv], [0], [dnl
43 AT_SETUP([DO REPEAT -- containing BEGIN DATA])
44 AT_DATA([do-repeat.sps], [dnl
45 DO REPEAT offset = 1 2 3.
46 DATA LIST NOTABLE /x 1-2.
52 COMPUTE x = x + offset.
56 AT_CHECK([pspp -o pspp.csv do-repeat.sps])
57 AT_CHECK([cat pspp.csv], [0], [dnl
78 AT_SETUP([DO REPEAT -- dummy vars not expanded in include files])
79 AT_DATA([include.sps], [dnl
80 COMPUTE y = y + x + 10.
82 AT_DATA([do-repeat.sps], [dnl
96 AT_CHECK([pspp -o pspp.csv do-repeat.sps], [0], [dnl
97 do-repeat.sps:8: warning: DO REPEAT: Dummy variable name `x' hides dictionary variable `x'.
99 AT_CHECK([cat pspp.csv], [0], [dnl
100 do-repeat.sps:8: warning: DO REPEAT: Dummy variable name `x' hides dictionary variable `x'.
108 AT_SETUP([DO REPEAT -- nested])
109 AT_DATA([do-repeat.sps], [dnl
110 DATA LIST NOTABLE /a 1.
115 DO REPEAT h = h0 TO h3 / x = 0 TO 3 / y = 8, 7.5, 6, 5.
121 DO REPEAT i = 1 TO 2.
122 DO REPEAT j = 3 TO 5.
124 COMPUTE #idx = #idx + 1.
125 COMPUTE v(#idx) = #x.
131 AT_CHECK([pspp -o pspp.csv do-repeat.sps])
132 AT_CHECK([cat pspp.csv], [0], [dnl
134 a,h0,h1,h2,h3,v1,v2,v3,v4,v5,v6
135 0,8.00,8.50,8.00,8.00,4.00,5.00,6.00,5.00,6.00,7.00
139 dnl This program tests for a bug that crashed PSPP given an empty DO
140 dnl REPEAT...END REPEAT block. See bug #18407.
141 AT_SETUP([DO REPEAT -- empty])
142 AT_DATA([do-repeat.sps], [dnl
143 DATA LIST NOTABLE /a 1.
151 AT_CHECK([pspp -o pspp.csv do-repeat.sps])
152 AT_CHECK([cat pspp.csv], [0], [dnl
156 dnl This program tests for a bug that crashed PSPP when END REPEAT
157 dnl was missing. See bug #31016.
158 AT_SETUP([DO REPEAT -- missing END REPEAT])
159 AT_DATA([do-repeat.sps], [dnl
160 DATA LIST NOTABLE /x 1.
161 DO REPEAT y = 1 TO 10.
163 AT_CHECK([pspp -O format=csv do-repeat.sps], [1], [dnl
164 error: DO REPEAT: Syntax error at end of input: expecting END.