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