1dnl PSPP - a program for statistical analysis.
2dnl Copyright (C) 2017 Free Software Foundation, Inc.
3dnl
4dnl This program is free software: you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation, either version 3 of the License, or
7dnl (at your option) any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12dnl GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16dnl
17AT_BANNER([VARIABLE ATTRIBUTES and DATAFILE ATTRIBUTES])
18
19AT_SETUP([VARIABLE ATTRIBUTES and DATAFILE ATTRIBUTES])
20AT_DATA([save-attrs.pspp],
21  [[DATA LIST FREE/a b c.
22BEGIN DATA.
231 2 3
24END DATA.
25
26DATAFILE ATTRIBUTE
27	ATTRIBUTE=key('value')
28                  array('array element 1')
29                  Array[2]('array element 2').
30VARIABLE 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?').
36DISPLAY ATTRIBUTES.
37
38SAVE OUTFILE='attributes.sav'.
39]])
40AT_DATA([get-attrs.pspp],
41  [[GET FILE='attributes.sav'.
42
43DATAFILE ATTRIBUTE
44         DELETE=Array[1] Array[2].
45VARIABLE ATTRIBUTE
46         VARIABLES=a
47         DELETE=ValidationRule
48        /VARIABLE=b
49         DELETE=validationrule[2].
50
51DISPLAY ATTRIBUTES.
52]])
53AT_CHECK([pspp -O format=csv save-attrs.pspp], [0],
54  [[Table: Variable and Dataset Attributes
55Variable and Name,,Value
56(dataset),array[1],array element 1
57,array[2],array element 2
58,key,value
59a,ValidationRule[1],a * b > 3
60,ValidationRule[2],a + b > 2
61b,ValidationRule[1],a * b > 3
62,ValidationRule[2],a + b > 2
63c,QuestionWording,X or Y?
64]])
65AT_CHECK([pspp -O format=csv get-attrs.pspp], [0], [dnl
66Table: Variable and Dataset Attributes
67Variable and Name,,Value
68(dataset),array,array element 2
69,key,value
70b,ValidationRule,a * b > 3
71c,QuestionWording,X or Y?
72])
73AT_CLEANUP
74