*** empty log message ***
[pspp] / tests / bugs / multipass.sh
1 #!/bin/sh
2
3 # This program tests for a bug which caused UNIFORM(x) to always return zero.
4
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 here=`pwd`;
10
11 # ensure that top_srcdir is absolute
12 cd $top_srcdir; top_srcdir=`pwd`
13
14 STAT_CONFIG_PATH=$top_srcdir/config
15 export STAT_CONFIG_PATH
16
17
18 cleanup()
19 {
20      cd /
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
50 cd $TEMPDIR
51
52 activity="create program"
53 cat > $TESTFILE <<EOF
54 data list list /ID * ABC *.
55 begin data.
56 1 3.5
57 2 2.0
58 3 2.0
59 4 3.5
60 5 3.0
61 6 4.0
62 7 5.0
63 end data.
64
65 TEMPORARY.
66 SELECT IF id < 7 .
67
68 DESCRIPTIVES
69         /VAR=abc.
70 EOF
71 if [ $? -ne 0 ] ; then no_result ; fi
72
73 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
74 if [ $? -ne 0 ] ; then no_result ; fi
75
76
77 perl -pi -e s/^\s*\$//g $TEMPDIR/pspp.list
78 diff -b  -w $TEMPDIR/pspp.list - << EOF | perl -e 's/^\s*$//g'
79 1.1 DATA LIST.  Reading free-form data from the command file.
80 +--------+------+
81 |Variable|Format|
82 #========#======#
83 |ID      |F8.0  |
84 |ABC     |F8.0  |
85 +--------+------+
86
87 2.1 DESCRIPTIVES.  Valid cases = 6; cases with missing value(s) = 0.
88 +--------#-+-----+-------+-------+-------+
89 |Variable#N| Mean|Std Dev|Minimum|Maximum|
90 #========#=#=====#=======#=======#=======#
91 |ABC     #6|3.000|   .837|  2.000|  4.000|
92 +--------#-+-----+-------+-------+-------+
93 EOF
94 if [ $? -ne 0 ] ; then fail ; fi
95
96 pass;