Fixed bug reporting the significance of paired value t-test.
[pspp-builds.git] / tests / bugs / temp-freq.sh
1 #!/bin/sh
2
3 # This program tests for a bug which caused FREQUENCIES following
4 # TEMPORARY to crash (PR 11492).
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 # ensure that top_builddir  are absolute
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
12 top_builddir=`cd $top_builddir; pwd`
13 PSPP=$top_builddir/src/ui/terminal/pspp
14
15 # ensure that top_srcdir is absolute
16 top_srcdir=`cd $top_srcdir; pwd`
17
18 STAT_CONFIG_PATH=$top_srcdir/config
19 export STAT_CONFIG_PATH
20
21 LANG=C
22 export LANG
23
24
25 cleanup()
26 {
27      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
28         echo "NOT cleaning $TEMPDIR" 
29         return ; 
30      fi
31      cd /
32      rm -rf $TEMPDIR
33 }
34
35
36 fail()
37 {
38     echo $activity
39     echo FAILED
40     cleanup;
41     exit 1;
42 }
43
44
45 no_result()
46 {
47     echo $activity
48     echo NO RESULT;
49     cleanup;
50     exit 2;
51 }
52
53 pass()
54 {
55     cleanup;
56     exit 0;
57 }
58
59 mkdir -p $TEMPDIR
60
61 cd $TEMPDIR
62
63 activity="create program"
64 cat > $TESTFILE <<EOF
65 DATA LIST LIST /SEX (A1) X *.
66 BEGIN DATA.
67 M 31
68 F 21
69 M 41
70 F 31
71 M 13
72 F 12
73 M 14
74 F 13
75 END DATA.
76
77
78 TEMPORARY
79 SELECT IF SEX EQ 'F'
80 FREQUENCIES /X .
81
82 FINISH
83 EOF
84 if [ $? -ne 0 ] ; then no_result ; fi
85
86 $SUPERVISOR $PSPP --testing-mode $TESTFILE
87 if [ $? -ne 0 ] ; then no_result ; fi
88
89 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
90 diff -b  -w $TEMPDIR/pspp.list - << EOF
91 1.1 DATA LIST.  Reading free-form data from INLINE.
92 +--------+------+
93 |Variable|Format|
94 #========#======#
95 |SEX     |A1    |
96 |X       |F8.0  |
97 +--------+------+
98 2.1 FREQUENCIES.  X
99 +-----------+--------+---------+--------+--------+--------+
100 |           |        |         |        |  Valid |   Cum  |
101 |Value Label|  Value |Frequency| Percent| Percent| Percent|
102 #===========#========#=========#========#========#========#
103 |           |   12.00|        1|   25.00|   25.00|   25.00|
104 |           |   13.00|        1|   25.00|   25.00|   50.00|
105 |           |   21.00|        1|   25.00|   25.00|   75.00|
106 |           |   31.00|        1|   25.00|   25.00|  100.00|
107 #===========#========#=========#========#========#========#
108 |               Total|        4|   100.0|   100.0|        |
109 +--------------------+---------+--------+--------+--------+
110 +---------------+-----+
111 |N       Valid  |    4|
112 |        Missing|    0|
113 |Mean           |19.25|
114 |Std Dev        | 8.81|
115 |Minimum        |12.00|
116 |Maximum        |31.00|
117 +---------------+-----+
118 EOF
119 if [ $? -ne 0 ] ; then fail ; fi
120
121 pass;