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
54 activity="create program"
55 cat > $TEMPDIR/valuelabel.stat <<EOF
56 DATA LIST notable /n 1 s 2(a).
57 VALUE LABELS /n 0 'Very dissatisfied'
62 VALUE LABELS /s 'a' 'Wouldn''t buy again'
67 STRING nlabel slabel(a10).
68 COMPUTE nlabel = VALUELABEL(n).
69 COMPUTE slabel = VALUELABEL(s).
82 if [ $? -ne 0 ] ; then no_result ; fi
84 activity="run program"
85 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/valuelabel.stat
86 if [ $? -ne 0 ] ; then fail ; fi
88 activity="compare results"
89 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
90 diff -b $TEMPDIR/pspp.list - <<EOF
92 - - ---------- ----------
94 0 a Very dissa Wouldn't b
95 1 b Dissatisfi Unhappy
97 3 d Satisfied Satiated
102 if [ $? -ne 0 ] ; then fail ; fi