Merge remote-tracking branch 'origin/master' into sheet
[pspp] / tests / language / dictionary / variable-display.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
17 AT_BANNER([variable display attributes])
18
19 AT_SETUP([variable display attribute commands])
20 AT_DATA([var-display.sps], [dnl
21 DATA LIST FREE /x y z.
22 VARIABLE ALIGNMENT x (LEFT)/y (RIGHT)/z (CENTER).
23 VARIABLE WIDTH x (10)/y (12)/z (14).
24 VARIABLE LEVEL x (SCALE)/y (ORDINAL)/z (NOMINAL).
25 VARIABLE ROLE /TARGET x /BOTH y /NONE z.
26 DISPLAY DICTIONARY.
27 ])
28 AT_CHECK([pspp -o pspp.csv var-display.sps])
29 AT_CHECK([cat pspp.csv], [0], [dnl
30 Variable,Description,Position
31 x,"Format: F8.2
32 Measure: Scale
33 Role: Output
34 Display Alignment: Left
35 Display Width: 10",1
36 y,"Format: F8.2
37 Measure: Ordinal
38 Role: Both
39 Display Alignment: Right
40 Display Width: 12",2
41 z,"Format: F8.2
42 Measure: Nominal
43 Role: None
44 Display Alignment: Center
45 Display Width: 14",3
46 ])
47 AT_CLEANUP
48
49
50 AT_BANNER([VARIABLE LABELS])
51
52 AT_SETUP([variable labels])
53
54 dnl The following test is to make sure the TVARS command works and that
55 dnl variables are displayed accordingly.
56 AT_DATA([var-labels.sps], [dnl
57 DATA LIST LIST NOTABLE /x * y *.
58 BEGIN DATA.
59 1 100
60 2 200
61 3 300
62 4 400
63 END DATA.
64
65 * While no labels have been set, the TVARS is irrelevant.
66 SET TVARS=NAMES.
67 DESCRIPTIVES ALL.
68
69 SET TVARS=LABELS.
70 DESCRIPTIVES ALL.
71
72 SET TVARS=BOTH.
73 DESCRIPTIVES ALL.
74
75 VARIABLE LABEL x 'foo' y 'bar'.
76
77 * Now, the TVARS setting should have effect
78
79 SET TVARS=NAMES.
80 DESCRIPTIVES ALL.
81
82 SET TVARS=LABELS.
83 DESCRIPTIVES ALL.
84
85 SET TVARS=BOTH.
86 DESCRIPTIVES ALL.
87 ])
88
89 AT_CHECK([pspp -O format=csv var-labels.sps], [0],[dnl
90 Table: Valid cases = 4; cases with missing value(s) = 0.
91 Variable,N,Mean,Std Dev,Minimum,Maximum
92 x,4,2.50,1.29,1.00,4.00
93 y,4,250.00,129.10,100.00,400.00
94
95 Table: Valid cases = 4; cases with missing value(s) = 0.
96 Variable,N,Mean,Std Dev,Minimum,Maximum
97 x,4,2.50,1.29,1.00,4.00
98 y,4,250.00,129.10,100.00,400.00
99
100 Table: Valid cases = 4; cases with missing value(s) = 0.
101 Variable,N,Mean,Std Dev,Minimum,Maximum
102 x,4,2.50,1.29,1.00,4.00
103 y,4,250.00,129.10,100.00,400.00
104
105 Table: Valid cases = 4; cases with missing value(s) = 0.
106 Variable,N,Mean,Std Dev,Minimum,Maximum
107 x,4,2.50,1.29,1.00,4.00
108 y,4,250.00,129.10,100.00,400.00
109
110 Table: Valid cases = 4; cases with missing value(s) = 0.
111 Variable,N,Mean,Std Dev,Minimum,Maximum
112 foo,4,2.50,1.29,1.00,4.00
113 bar,4,250.00,129.10,100.00,400.00
114
115 Table: Valid cases = 4; cases with missing value(s) = 0.
116 Variable,N,Mean,Std Dev,Minimum,Maximum
117 foo (x),4,2.50,1.29,1.00,4.00
118 bar (y),4,250.00,129.10,100.00,400.00
119 ])
120
121 AT_CLEANUP