Implemented long variable names a la spss V12.
[pspp-builds.git] / tests / expressions / randist.sh
1 #! /bin/sh
2
3 # Tests random distribution functions.
4
5 TEMPDIR=/tmp/pspp-tst-$$
6
7 here=`pwd`;
8
9 # ensure that top_srcdir is absolute
10 cd $top_srcdir; top_srcdir=`pwd`
11
12 export STAT_CONFIG_PATH=$top_srcdir/config
13
14
15 cleanup()
16 {
17      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
18         echo NOT removing directory $TEMPDIR
19         return ; 
20      fi
21      rm -rf $TEMPDIR
22 }
23
24
25 fail()
26 {
27     echo $activity
28     echo FAILED
29     cleanup;
30     exit 1;
31 }
32
33
34 no_result()
35 {
36     echo $activity
37     echo NO RESULT;
38     cleanup;
39     exit 2;
40 }
41
42 pass()
43 {
44     cleanup;
45     exit 0;
46 }
47
48 mkdir -p $TEMPDIR
49 cd $TEMPDIR
50
51 activity="run script to generate random distribution test command file"
52 perl $top_srcdir/tests/expressions/randist/randist.pl \
53     < $top_srcdir/tests/expressions/randist/randist.txt \
54     > randist.pspp
55 if [ $? -ne 0 ] ; then no_result ; fi
56
57 activity="run command file"
58 $SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii \
59     $TEMPDIR/randist.pspp >$TEMPDIR/randist.err 2> $TEMPDIR/randist.out
60 if [ $? -ne 0 ] ; then fail ; fi
61
62 for d in beta cauchy chisq exp f gamma laplace logistic lnormal \
63          normal pareto t uniform weibull; do
64     activity="compare output for $d distribution"
65     diff -B -b $top_srcdir/tests/expressions/randist/$d.out $TEMPDIR/$d.out
66     if [ $? -ne 0 ] ; then fail ; fi
67 done
68
69 pass