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
29 Variable,Description,Position
36 dt,"Format: DATETIME20.0
39 12-APR-2011 06:09:56,label 4",2
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 format=csv value-labels.sps], [0], [dnl
56 Variable,Description,Position
61 2.00,first line\nsecond line
65 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
66 one,1.00,1,33.33,33.33,33.33
68 second line",2.00,1,33.33,33.33,66.67
69 three,3.00,1,33.33,33.33,100.00
74 AT_SETUP([VALUE LABELS with new-line in system file])
75 AT_DATA([save.sps], [dnl
76 DATA LIST LIST NOTABLE /x.
77 VALUE LABELS x 1 'one' 2 'first line\nsecond line' 3 'three'.
83 SAVE OUTFILE='value-labels.sav'.
85 AT_CHECK([pspp -O format=csv save.sps])
86 AT_DATA([get.sps], [dnl
87 GET FILE='value-labels.sav'.
89 FREQUENCIES x/STAT=NONE.
91 AT_CHECK([pspp -O format=csv get.sps], [0], [dnl
92 Variable,Description,Position
97 2.00,first line\nsecond line
101 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
102 one,1.00,1,33.33,33.33,33.33
104 second line",2.00,1,33.33,33.33,66.67
105 three,3.00,1,33.33,33.33,100.00
106 Total,,3,100.0,100.0,
110 dnl Tests for a bug which caused VALUE LABELS to
111 dnl crash when given invalid syntax.
112 AT_SETUP([VALUE LABELS invalid syntax bug])
113 AT_DATA([value-labels.sps], [dnl
114 DATA LIST LIST NOTABLE /a * pref * .
122 VALUE LABELS /var=a 'label for a'.
124 AT_CHECK([pspp -O format=csv value-labels.sps], [1], [dnl
125 value-labels.sps:9: error: VALUE LABELS: var is not a variable name.
129 # Tests for a bug which caused a crash if VALUE LABELS had a trailing /.
130 AT_SETUP([VALUE LABELS trailing `/' bug])
131 AT_DATA([value-labels.sps], [dnl
132 DATA LIST LIST NOTABLE /X * .
141 VALUE LABELS X 1 'one' 2 'two' 3 'three'/
146 AT_CHECK([pspp -O format=csv value-labels.sps], [0], [dnl