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([RENAME VARIABLES])
19 AT_SETUP([RENAME VARIABLES])
20 AT_DATA([rename-variables.sps], [dnl
21 DATA LIST LIST /brakeFluid y auxiliary warp (F2.0).
31 RENAME VARIABLES brakeFluid=applecarts y=bananamobiles.
32 RENAME VARIABLES (warp auxiliary=foobar xyzzy).
36 SAVE /OUTFILE='rename.sav'.
38 AT_CHECK([pspp -O format=csv rename-variables.sps], [0], [dnl
39 Table: Reading free-form data from INLINE.
47 brakeFluid,y,auxiliary,warp
54 applecarts,bananamobiles,xyzzy,foobar
60 AT_CHECK([grep '[bB][rR][aA][kK][eE]' rename.sav], [1], [ignore-nolog])
64 AT_SETUP([RENAME VARIABLES -- multiple sets])
65 AT_DATA([rename-variables.sps], [dnl
66 data list list /a b c d e *.
71 rename variables (a b=x y) (c d e=z zz zzz).
76 AT_CHECK([pspp -O format=csv rename-variables.sps], [0], [dnl
77 Table: Reading free-form data from INLINE.
87 1.00,2.00,3.00,4.00,5.00
93 AT_SETUP([RENAME VARIABLES -- invalid syntax 1])
95 AT_DATA([rename-variables.sps], [dnl
96 DATA LIST LIST /brakeFluid y auxiliary warp (F2.0).
97 RENAME VARIABLES warp auxiliary=foobar xyzzy.
100 AT_CHECK([pspp -o pspp.csv rename-variables.sps], [1], [dnl
101 rename-variables.sps:2.23-2.31: error: RENAME VARIABLES: Syntax error at `auxiliary': expecting `='.
105 AT_SETUP([RENAME VARIABLES -- invalid syntax 2])
106 AT_DATA([rename-variables.sps], [dnl
107 DATA LIST LIST /brakeFluid y auxiliary warp (F2.0).
108 RENAME VARIABLES (brakeFluid=applecarts y=bananamobiles).
111 AT_CHECK([pspp -o pspp.csv rename-variables.sps], [1], [dnl
112 rename-variables.sps:2: error: RENAME VARIABLES: Differing number of variables in old name list (1) and in new name list (2).
119 AT_SETUP([RENAME VARIABLES -- invalid syntax 3])
120 AT_DATA([rename-variables.sps], [dnl
121 DATA LIST NOTABLE LIST /z y p q (F2.0).
126 RENAME VARIABLES z=a y}bqnanamobiles.
131 AT_CHECK([pspp -O format=csv rename-variables.sps], [1], [ignore])