1dnl PSPP - a program for statistical analysis.
2dnl Copyright (C) 2017 Free Software Foundation, Inc.
3dnl
4dnl This program is free software: you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation, either version 3 of the License, or
7dnl (at your option) any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12dnl GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16dnl
17AT_BANNER([FLIP command])
18
19AT_SETUP([FLIP with NEWNAMES])
20AT_DATA([flip.sps], [dnl
21data list notable /N 1 (a) a b c d 2-9.
22list.
23begin data.
24v 1 2 3 4 5
25w 6 7 8 910
26x1112131415
27y1617181920
28z2122232425
29end data.
30temporary.
31compute e = a.
32flip newnames=n.
33list.
34flip.
35list.
36])
37AT_CHECK([pspp -O format=csv flip.sps], [0], [dnl
38Table: Data List
39N,a,b,c,d
40v,1,2,3,4
41w,6,7,8,9
42x,11,12,13,14
43y,16,17,18,19
44z,21,22,23,24
45
46flip.sps:12: warning: FLIP: FLIP ignores TEMPORARY.  Temporary transformations will be made permanent.
47
48Table: Data List
49CASE_LBL,v,w,x,y,z
50a,1.00,6.00,11.00,16.00,21.00
51b,2.00,7.00,12.00,17.00,22.00
52c,3.00,8.00,13.00,18.00,23.00
53d,4.00,9.00,14.00,19.00,24.00
54e,1.00,6.00,11.00,16.00,21.00
55
56Table: Data List
57CASE_LBL,a,b,c,d,e
58v,1.00,2.00,3.00,4.00,1.00
59w,6.00,7.00,8.00,9.00,6.00
60x,11.00,12.00,13.00,14.00,11.00
61y,16.00,17.00,18.00,19.00,16.00
62z,21.00,22.00,23.00,24.00,21.00
63])
64AT_CLEANUP
65
66AT_SETUP([FLIP without NEWNAMES])
67AT_DATA([flip.sps], [dnl
68data list list notable /v1 to v10.
69format all(f2).
70begin data.
711 2 3 4 5 6 7 8 9 10
724 5 6 7 8 9 10 11 12 13
73end data.
74
75list.
76
77flip.
78list.
79])
80AT_CHECK([pspp -O format=csv flip.sps], [0], [dnl
81Table: Data List
82v1,v2,v3,v4,v5,v6,v7,v8,v9,v10
831,2,3,4,5,6,7,8,9,10
844,5,6,7,8,9,10,11,12,13
85
86Table: Data List
87CASE_LBL,VAR000,VAR001
88v1,1.00,4.00
89v2,2.00,5.00
90v3,3.00,6.00
91v4,4.00,7.00
92v5,5.00,8.00
93v6,6.00,9.00
94v7,7.00,10.00
95v8,8.00,11.00
96v9,9.00,12.00
97v10,10.00,13.00
98])
99AT_CLEANUP
100
101
102
103
104AT_SETUP([FLIP badly formed])
105
106AT_DATA([flip.sps], [dnl
107data list notable /N 1 (a) a b c d 2-9.
108
109flip newnames=n.
110list.
111flip.
112])
113
114AT_CHECK([pspp -O format=csv flip.sps], [1], [ignore])
115
116AT_CLEANUP
117
118
119
120AT_SETUP([FLIP with invalid variable names])
121
122AT_DATA([flip.sps], [dnl
123data list notable list /N (a3) a b c d *.
124begin data.
125""   1  2  3  4
126BY   1  2  3  4
127end data.
128
129flip newnames=n.
130
131list.
132])
133
134AT_CHECK([pspp -O format=csv flip.sps], [0], [dnl
135Table: Data List
136CASE_LBL,v,BY1
137a,1.00,1.00
138b,2.00,2.00
139c,3.00,3.00
140d,4.00,4.00
141])
142
143AT_CLEANUP
144