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'
66 VALUE LABELS /s 'a' 'Wouldn''t buy again'
71 STRING nlabel slabel(a10).
72 COMPUTE nlabel = VALUELABEL(n).
73 COMPUTE slabel = VALUELABEL(s).
86 if [ $? -ne 0 ] ; then no_result ; fi
88 activity="run program"
89 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/valuelabel.stat
90 if [ $? -ne 0 ] ; then fail ; fi
92 activity="compare results"
93 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
94 diff -b $TEMPDIR/pspp.list - <<EOF
96 - - ---------- ----------
98 0 a Very dissa Wouldn't b
99 1 b Dissatisfi Unhappy
101 3 d Satisfied Satiated
102 4 e Very satis Elated
106 if [ $? -ne 0 ] ; then fail ; fi