Add copyright and licence notices to files which lack them.
[pspp] / tests / language / stats / flip.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
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.
8 dnl 
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.
13 dnl 
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([FLIP command])
17
18 AT_SETUP([FLIP with NEWNAMES])
19 AT_DATA([flip.sps], [dnl
20 data list notable /N 1 (a) a b c d 2-9.
21 list.
22 begin data.
23 v 1 2 3 4 5
24 w 6 7 8 910
25 x1112131415
26 y1617181920
27 z2122232425
28 end data.
29 temporary.
30 compute e = a.
31 flip newnames=n.
32 list.
33 flip.
34 list.
35 ])
36 AT_CHECK([pspp -O format=csv flip.sps], [0], [dnl
37 Table: Data List
38 N,a,b,c,d
39 v,1,2,3,4
40 w,6,7,8,9
41 x,11,12,13,14
42 y,16,17,18,19
43 z,21,22,23,24
44
45 flip.sps:12: warning: FLIP: FLIP ignores TEMPORARY.  Temporary transformations will be made permanent.
46
47 Table: Data List
48 CASE_LBL,v,w,x,y,z
49 a       ,1.00,6.00,11.00,16.00,21.00
50 b       ,2.00,7.00,12.00,17.00,22.00
51 c       ,3.00,8.00,13.00,18.00,23.00
52 d       ,4.00,9.00,14.00,19.00,24.00
53 e       ,1.00,6.00,11.00,16.00,21.00
54
55 Table: Data List
56 CASE_LBL,a,b,c,d,e
57 v       ,1.00,2.00,3.00,4.00,1.00
58 w       ,6.00,7.00,8.00,9.00,6.00
59 x       ,11.00,12.00,13.00,14.00,11.00
60 y       ,16.00,17.00,18.00,19.00,16.00
61 z       ,21.00,22.00,23.00,24.00,21.00
62 ])
63 AT_CLEANUP
64
65 AT_SETUP([FLIP without NEWNAMES])
66 AT_DATA([flip.sps], [dnl
67 data list list notable /v1 to v10.
68 format all(f2).
69 begin data.
70 1 2 3 4 5 6 7 8 9 10
71 4 5 6 7 8 9 10 11 12 13
72 end data.
73
74 list.
75
76 flip.
77 list. 
78 ])
79 AT_CHECK([pspp -O format=csv flip.sps], [0], [dnl
80 Table: Data List
81 v1,v2,v3,v4,v5,v6,v7,v8,v9,v10
82 1,2,3,4,5,6,7,8,9,10
83 4,5,6,7,8,9,10,11,12,13
84
85 Table: Data List
86 CASE_LBL,VAR000,VAR001
87 v1      ,1.00,4.00
88 v2      ,2.00,5.00
89 v3      ,3.00,6.00
90 v4      ,4.00,7.00
91 v5      ,5.00,8.00
92 v6      ,6.00,9.00
93 v7      ,7.00,10.00
94 v8      ,8.00,11.00
95 v9      ,9.00,12.00
96 v10     ,10.00,13.00
97 ])
98 AT_CLEANUP
99
100
101
102
103 AT_SETUP([FLIP badly formed])
104
105 AT_DATA([flip.sps], [dnl
106 data list notable /N 1 (a) a b c d 2-9.
107
108 flip newnames=n.
109 list.
110 flip.
111 ])
112
113 AT_CHECK([pspp -O format=csv flip.sps], [1], [ignore])
114
115 AT_CLEANUP
116
117
118
119 AT_SETUP([FLIP with invalid variable names])
120
121 AT_DATA([flip.sps], [dnl
122 data list notable list /N (a3) a b c d *.
123 begin data.
124 ""   1  2  3  4
125 BY   1  2  3  4
126 end data.
127
128 flip newnames=n.
129
130 list.
131 ])
132
133 AT_CHECK([pspp -O format=csv flip.sps], [0], [dnl
134 Table: Data List
135 CASE_LBL,v,BY1
136 a       ,1.00,1.00
137 b       ,2.00,2.00
138 c       ,3.00,3.00
139 d       ,4.00,4.00
140 ])
141
142 AT_CLEANUP