3 # This program tests VARIABLE ATTRIBUTE and DATAFILE ATTRIBUTE
4 # commands, including the ability to write attributes to system files
5 # and read them back in again.
7 TEMPDIR=/tmp/pspp-tst-$$
8 TESTFILE=$TEMPDIR/`basename $0`.sps
10 # ensure that top_builddir are absolute
11 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
12 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
13 top_builddir=`cd $top_builddir; pwd`
14 PSPP=$top_builddir/src/ui/terminal/pspp
16 # ensure that top_srcdir is absolute
17 top_srcdir=`cd $top_srcdir; pwd`
19 STAT_CONFIG_PATH=$top_srcdir/config
20 export STAT_CONFIG_PATH
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
61 activity="create program"
69 ATTRIBUTE=key('value')
70 array('array element 1')
71 Array[2]('array element 2').
74 ATTRIBUTE=ValidationRule[2]("a + b > 2")
75 ValidationRule[1]('a * b > 3')
77 ATTRIBUTE=QuestionWording('X or Y?').
80 SAVE OUTFILE='attributes.sav'.
82 GET FILE='attributes.sav'.
85 DELETE=Array[1] Array[2].
90 DELETE=validationrule[2].
95 if [ $? -ne 0 ] ; then no_result ; fi
98 activity="run program"
99 $SUPERVISOR $PSPP --testing-mode $TESTFILE
100 if [ $? -ne 0 ] ; then no_result ; fi
102 activity="compare output"
103 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
104 diff -b -w $TEMPDIR/pspp.list - << EOF
106 +--------+-----------------+-----------------------------------+
107 |Variable|Description | |
108 #========#=================#===================================#
109 |a |Custom attributes| |
110 | |ValidationRule[1]|a * b > 3 |
111 | |ValidationRule[2]|a + b > 2 |
112 +--------+-----------------+-----------------------------------+
113 |b |Custom attributes| |
114 | |ValidationRule[1]|a * b > 3 |
115 | |ValidationRule[2]|a + b > 2 |
116 +--------+-----------------+-----------------------------------+
117 |c |Custom attributes| |
118 | |QuestionWording |X or Y? |
119 +--------+-----------------+-----------------------------------+
120 1.2 DISPLAY. Custom data file attributes.
121 +---------+---------------+
123 #=========#===============#
124 |array[1] |array element 1|
125 |array[2] |array element 2|
127 +---------+---------------+
129 +--------+---------------+-----------------------------------+
130 |Variable|Description | |
131 #========#===============#===================================#
132 |b |Custom attribut|s: |
133 | |ValidationRule |a * b > 3 |
134 +--------+---------------+-----------------------------------+
135 |c |Custom attribut|s: |
136 | |QuestionWording|X or Y? |
137 +--------+---------------+-----------------------------------+
138 2.2 DISPLAY. Custom data file attributes.
139 +---------+---------------+
141 #=========#===============#
142 |array |array element 2|
144 +---------+---------------+
146 if [ $? -ne 0 ] ; then fail ; fi