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