Add test for multipass procedure bug.
[pspp-builds.git] / 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
8 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 export STAT_CONFIG_PATH=$top_srcdir/config
14
15
16 cleanup()
17 {
18      rm -rf $TEMPDIR
19 }
20
21
22 fail()
23 {
24     echo $activity
25     echo FAILED
26     cleanup;
27     exit 1;
28 }
29
30
31 no_result()
32 {
33     echo $activity
34     echo NO RESULT;
35     cleanup;
36     exit 2;
37 }
38
39 pass()
40 {
41     cleanup;
42     exit 0;
43 }
44
45 mkdir -p $TEMPDIR
46
47 cd $TEMPDIR
48
49 activity="create program"
50 cat > $TEMPDIR/rnd.sps <<EOF
51 data list list /id * abc *.
52 begin data.
53 1 3.5
54 2 2.0
55 3 2.0
56 4 3.5
57 5 3.0
58 6 4.0
59 7 5.0
60 end data.
61
62 TEMPORARY.
63 SELECT IF id < 7 .
64
65 DESCRIPTIVES
66         /VAR=abc.
67 EOF
68 if [ $? -ne 0 ] ; then no_result ; fi
69
70 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/rnd.sps
71 if [ $? -ne 0 ] ; then no_result ; fi
72
73
74 diff -b -B -w $TEMPDIR/pspp.list - << EOF
75 1.1 DATA LIST.  Reading free-form data from the command file.
76 +--------+------+
77 |Variable|Format|
78 #========#======#
79 |ID      |F8.0  |
80 |ABC     |F8.0  |
81 +--------+------+
82
83 2.1 DESCRIPTIVES.  Valid cases = 6; cases with missing value(s) = 0.
84 +--------#-+-----+-------+-------+-------+
85 |Variable#N| Mean|Std Dev|Minimum|Maximum|
86 #========#=#=====#=======#=======#=======#
87 |ABC     #6|3.000|   .837|  2.000|  4.000|
88 +--------#-+-----+-------+-------+-------+
89 EOF
90 if [ $? -ne 0 ] ; then fail ; fi
91
92 pass;