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([VALUE LABELS])
19 AT_SETUP([VALUE LABELS date formats])
20 AT_DATA([value-labels.sps], [dnl
21 DATA LIST LIST NOTABLE /ad (adate10) dt (datetime20).
22 VALUE LABELS ad 'july 10, 1982' 'label 1'
25 /dt '12 Apr 2011 06:09:56' 'label 4'.
28 AT_CHECK([pspp -O format=csv value-labels.sps], [0], [dnl
30 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
31 ad,1,,Scale,Input,8,Right,ADATE10,ADATE10,
32 dt,2,,Scale,Input,8,Right,DATETIME20.0,DATETIME20.0,
39 dt,12-APR-2011 06:09:56,label 4
43 AT_SETUP([VALUE LABELS with new-line])
44 AT_DATA([value-labels.sps], [dnl
45 DATA LIST LIST NOTABLE /x.
46 VALUE LABELS x 1 'one' 2 'first line\nsecond line' 3 'three'.
53 FREQUENCIES x/STAT=NONE.
55 AT_CHECK([pspp -o pspp.csv -o pspp.txt value-labels.sps])
56 AT_CHECK([cat pspp.csv], [0], [dnl
58 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
59 x,1,,Scale,Input,8,Right,F8.2,F8.2,
64 ,2.00,first line\nsecond line
68 ,,Frequency,Percent,Valid Percent,Cumulative Percent
69 Valid,one,1,33.3%,33.3%,33.3%
71 second line",1,33.3%,33.3%,66.7%
72 ,three,1,33.3%,33.3%,100.0%
77 AT_SETUP([VALUE LABELS with new-line in system file])
78 AT_DATA([save.sps], [dnl
79 DATA LIST LIST NOTABLE /x.
80 VALUE LABELS x 1 'one' 2 'first line\nsecond line' 3 'three'.
86 SAVE OUTFILE='value-labels.sav'.
88 AT_CHECK([pspp -O format=csv save.sps])
89 AT_DATA([get.sps], [dnl
90 GET FILE='value-labels.sav'.
92 FREQUENCIES x/STAT=NONE.
94 AT_CHECK([pspp -o pspp.csv -o pspp.txt get.sps])
95 AT_CHECK([cat pspp.csv], [0], [dnl
97 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
98 x,1,,Scale,Input,8,Right,F8.2,F8.2,
101 Variable Value,,Label
103 ,2.00,first line\nsecond line
107 ,,Frequency,Percent,Valid Percent,Cumulative Percent
108 Valid,one,1,33.3%,33.3%,33.3%
110 second line",1,33.3%,33.3%,66.7%
111 ,three,1,33.3%,33.3%,100.0%
116 dnl Tests for a bug which caused VALUE LABELS to
117 dnl crash when given invalid syntax.
118 AT_SETUP([VALUE LABELS invalid syntax bug])
119 AT_DATA([value-labels.sps], [dnl
120 DATA LIST LIST NOTABLE /a * pref * .
128 VALUE LABELS /var=a 'label for a'.
130 AT_CHECK([pspp -O format=csv value-labels.sps], [1], [dnl
131 value-labels.sps:9: error: VALUE LABELS: var is not a variable name.
135 # Tests for a bug which caused a crash if VALUE LABELS had a trailing /.
136 AT_SETUP([VALUE LABELS trailing `/' bug])
137 AT_DATA([value-labels.sps], [dnl
138 DATA LIST LIST NOTABLE /X * .
147 VALUE LABELS X 1 'one' 2 'two' 3 'three'/
152 AT_CHECK([pspp -O format=csv value-labels.sps], [0], [dnl