Rewrite PSPP output engine.
[pspp-builds.git] / tests / bugs / t-test-alpha3.sh
1 #!/bin/sh
2
3 # This program tests for a bug which didn't properly
4 # compare string values.
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 # ensure that top_srcdir and top_builddir  are absolute
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
12 top_srcdir=`cd $top_srcdir; pwd`
13 top_builddir=`cd $top_builddir; pwd`
14
15 PSPP=$top_builddir/src/ui/terminal/pspp
16
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
19
20 LANG=C
21 export LANG
22
23
24 cleanup()
25 {
26      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
27         echo "NOT cleaning $TEMPDIR"
28         return ; 
29      fi
30      cd /
31      rm -rf $TEMPDIR
32 }
33
34
35 fail()
36 {
37     echo $activity
38     echo FAILED
39     cleanup;
40     exit 1;
41 }
42
43
44 no_result()
45 {
46     echo $activity
47     echo NO RESULT;
48     cleanup;
49     exit 2;
50 }
51
52 pass()
53 {
54     cleanup;
55     exit 0;
56 }
57
58 mkdir -p $TEMPDIR
59
60 cd $TEMPDIR
61
62 cat >> $TESTFILE <<EOF
63 data list list /x * gv (a8).
64 begin data.
65 3   One
66 2   One
67 3   One
68 2   One
69 3   One
70 4   Two
71 3.5 Two
72 3.0 Two
73 end data.
74
75 t-test group=gv('One', 'Two')
76         /variables = x.
77 EOF
78 if [ $? -ne 0 ] ; then no_result ; fi
79
80
81 activity="run program"
82 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
83 if [ $? -ne 0 ] ; then no_result ; fi
84
85
86 activity="compare output"
87 diff -c $TEMPDIR/pspp.csv - << EOF
88 Table: Reading free-form data from INLINE.
89 Variable,Format
90 x,F8.0
91 gv,A8
92
93 Table: Group Statistics
94 ,gv,N,Mean,Std. Deviation,S.E. Mean
95 x,One     ,5,2.60,.55,.24
96 ,Two     ,3,3.50,.50,.29
97
98 Table: Independent Samples Test
99 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
100 ,,,,,,,,,95% Confidence Interval of the Difference,
101 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
102 x,Equal variances assumed,1.13,.33,-2.32,6.00,.06,-.90,.38,-1.83,.03
103 ,Equal variances not assumed,,,-2.38,4.70,.07,-.90,.38,-1.89,.09
104 EOF
105 if [ $? -ne 0 ] ; then fail ; fi
106
107
108 pass;