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 -o pspp.csv $TESTFILE
100 if [ $? -ne 0 ] ; then no_result ; fi
102 activity="compare output"
103 diff -c $TEMPDIR/pspp.csv - << EOF
104 Variable,Description,
105 a,Custom attributes:,
106 ,ValidationRule[1],a * b > 3
107 ,ValidationRule[2],a + b > 2
108 b,Custom attributes:,
109 ,ValidationRule[1],a * b > 3
110 ,ValidationRule[2],a + b > 2
111 c,Custom attributes:,
112 ,QuestionWording,X or Y?
114 Table: Custom data file attributes.
116 array[1],array element 1
117 array[2],array element 2
120 Variable,Description,
121 b,Custom attributes:,
122 ,ValidationRule,a * b > 3
123 c,Custom attributes:,
124 ,QuestionWording,X or Y?
126 Table: Custom data file attributes.
128 array,array element 2
131 if [ $? -ne 0 ] ; then fail ; fi