output: Introduce pivot tables.
[pspp] / tests / language / dictionary / attributes.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 ATTRIBUTES and DATAFILE ATTRIBUTES])
18
19 AT_SETUP([VARIABLE ATTRIBUTES and DATAFILE ATTRIBUTES])
20 AT_DATA([save-attrs.pspp],
21   [[DATA LIST FREE/a b c.
22 BEGIN DATA.
23 1 2 3
24 END DATA.
25
26 DATAFILE ATTRIBUTE
27         ATTRIBUTE=key('value')
28                   array('array element 1')
29                   Array[2]('array element 2').
30 VARIABLE ATTRIBUTE
31         VARIABLES=a b
32         ATTRIBUTE=ValidationRule[2]("a + b > 2")
33                   ValidationRule[1]('a * b > 3')
34        /VARIABLES=c
35         ATTRIBUTE=QuestionWording('X or Y?').
36 DISPLAY ATTRIBUTES.
37
38 SAVE OUTFILE='attributes.sav'.
39 ]])
40 AT_DATA([get-attrs.pspp],
41   [[GET FILE='attributes.sav'.
42
43 DATAFILE ATTRIBUTE
44          DELETE=Array[1] Array[2].
45 VARIABLE ATTRIBUTE
46          VARIABLES=a
47          DELETE=ValidationRule
48         /VARIABLE=b
49          DELETE=validationrule[2].
50
51 DISPLAY ATTRIBUTES.
52 ]])
53 AT_CHECK([pspp -O format=csv save-attrs.pspp], [0],
54   [[Table: Variable and Dataset Attributes
55 Variable and Name,,Value
56 (dataset),array[1],array element 1
57 ,array[2],array element 2
58 ,key,value
59 a,ValidationRule[1],a * b > 3
60 ,ValidationRule[2],a + b > 2
61 b,ValidationRule[1],a * b > 3
62 ,ValidationRule[2],a + b > 2
63 c,QuestionWording,X or Y?
64 ]])
65 AT_CHECK([pspp -O format=csv get-attrs.pspp], [0], [dnl
66 Table: Variable and Dataset Attributes
67 Variable and Name,,Value
68 (dataset),array,array element 2
69 ,key,value
70 b,ValidationRule,a * b > 3
71 c,QuestionWording,X or Y?
72 ])
73 AT_CLEANUP