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 format=csv value-labels.sps], [0], [dnl
57 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
58 x,1,,Scale,Input,8,Right,F8.2,F8.2,
63 ,2.00,first line\nsecond line
67 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
68 one,1.00,1,33.33,33.33,33.33
70 second line",2.00,1,33.33,33.33,66.67
71 three,3.00,1,33.33,33.33,100.00
76 AT_SETUP([VALUE LABELS with new-line in system file])
77 AT_DATA([save.sps], [dnl
78 DATA LIST LIST NOTABLE /x.
79 VALUE LABELS x 1 'one' 2 'first line\nsecond line' 3 'three'.
85 SAVE OUTFILE='value-labels.sav'.
87 AT_CHECK([pspp -O format=csv save.sps])
88 AT_DATA([get.sps], [dnl
89 GET FILE='value-labels.sav'.
91 FREQUENCIES x/STAT=NONE.
93 AT_CHECK([pspp -O format=csv get.sps], [0], [dnl
95 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
96 x,1,,Scale,Input,8,Right,F8.2,F8.2,
101 ,2.00,first line\nsecond line
105 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
106 one,1.00,1,33.33,33.33,33.33
108 second line",2.00,1,33.33,33.33,66.67
109 three,3.00,1,33.33,33.33,100.00
110 Total,,3,100.0,100.0,
114 dnl Tests for a bug which caused VALUE LABELS to
115 dnl crash when given invalid syntax.
116 AT_SETUP([VALUE LABELS invalid syntax bug])
117 AT_DATA([value-labels.sps], [dnl
118 DATA LIST LIST NOTABLE /a * pref * .
126 VALUE LABELS /var=a 'label for a'.
128 AT_CHECK([pspp -O format=csv value-labels.sps], [1], [dnl
129 value-labels.sps:9: error: VALUE LABELS: var is not a variable name.
133 # Tests for a bug which caused a crash if VALUE LABELS had a trailing /.
134 AT_SETUP([VALUE LABELS trailing `/' bug])
135 AT_DATA([value-labels.sps], [dnl
136 DATA LIST LIST NOTABLE /X * .
145 VALUE LABELS X 1 'one' 2 'two' 3 'three'/
150 AT_CHECK([pspp -O format=csv value-labels.sps], [0], [dnl