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([RENAME VARIABLES])
18 AT_SETUP([RENAME VARIABLES])
19 AT_DATA([rename-variables.sps], [dnl
20 DATA LIST LIST /brakeFluid y auxiliary warp (F2.0).
30 RENAME VARIABLES brakeFluid=applecarts y=bananamobiles.
31 RENAME VARIABLES (warp auxiliary=foobar xyzzy).
35 SAVE /OUTFILE='rename.sav'.
37 AT_CHECK([pspp -O format=csv rename-variables.sps], [0], [dnl
38 Table: Reading free-form data from INLINE.
46 brakeFluid,y,auxiliary,warp
53 applecarts,bananamobiles,xyzzy,foobar
59 AT_CHECK([grep '[bB][rR][aA][kK][eE]' rename.sav], [1], [ignore-nolog])
63 AT_SETUP([RENAME VARIABLES -- multiple sets])
64 AT_DATA([rename-variables.sps], [dnl
65 data list list /a b c d e *.
70 rename variables (a b=x y) (c d e=z zz zzz).
75 AT_CHECK([pspp -O format=csv rename-variables.sps], [0], [dnl
76 Table: Reading free-form data from INLINE.
86 1.00,2.00,3.00,4.00,5.00
92 AT_SETUP([RENAME VARIABLES -- invalid syntax 1])
94 AT_DATA([rename-variables.sps], [dnl
95 DATA LIST LIST /brakeFluid y auxiliary warp (F2.0).
96 RENAME VARIABLES warp auxiliary=foobar xyzzy.
99 AT_CHECK([pspp -o pspp.csv rename-variables.sps], [1], [dnl
100 rename-variables.sps:2.23-2.31: error: RENAME VARIABLES: Syntax error at `auxiliary': expecting `='.
104 AT_SETUP([RENAME VARIABLES -- invalid syntax 2])
105 AT_DATA([rename-variables.sps], [dnl
106 DATA LIST LIST /brakeFluid y auxiliary warp (F2.0).
107 RENAME VARIABLES (brakeFluid=applecarts y=bananamobiles).
110 AT_CHECK([pspp -o pspp.csv rename-variables.sps], [1], [dnl
111 rename-variables.sps:2: error: RENAME VARIABLES: Differing number of variables in old name list (1) and in new name list (2).
118 AT_SETUP([RENAME VARIABLES -- invalid syntax 3])
119 AT_DATA([rename-variables.sps], [dnl
120 DATA LIST NOTABLE LIST /z y p q (F2.0).
125 RENAME VARIABLES z=a y}bqnanamobiles.
130 AT_CHECK([pspp -O format=csv rename-variables.sps], [1], [ignore])