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