3 # This program tests use of the VALUELABEL function in expressions.
5 TEMPDIR=/tmp/pspp-tst-$$
7 # ensure that top_srcdir and top_builddir are absolute
8 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 top_srcdir=`cd $top_srcdir; pwd`
11 top_builddir=`cd $top_builddir; pwd`
12 PSPP=$top_builddir/src/ui/terminal/pspp
14 STAT_CONFIG_PATH=$top_srcdir/config
15 export STAT_CONFIG_PATH
22 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
23 echo "NOT cleaning $TEMPDIR"
58 activity="create program"
59 cat > $TEMPDIR/valuelabel.stat <<EOF
60 DATA LIST notable /n 1 s 2(a).
61 VALUE LABELS /n 0 'Very dissatisfied'
67 VALUE LABELS /s 'a' 'Wouldn''t buy again'
72 STRING nlabel slabel(a10).
73 COMPUTE nlabel = VALUELABEL(n).
74 COMPUTE slabel = VALUELABEL(s).
88 if [ $? -ne 0 ] ; then no_result ; fi
90 activity="run program"
91 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/valuelabel.stat
92 if [ $? -ne 0 ] ; then fail ; fi
94 activity="compare results"
95 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
96 diff -b $TEMPDIR/pspp.list - <<EOF
98 - - ---------- ----------
100 0 a Very dissa Wouldn't b
101 1 b Dissatisfi Unhappy
103 3 d Satisfied Satiated
104 4 e Very satis Elated
108 if [ $? -ne 0 ] ; then fail ; fi