fb9901cb1adb0b7b5200fdb24ecbb3a2fbbfdd68
[pspp-builds.git] / tests / command / t-test-1-indep-val.sh
1 #!/bin/sh
2
3 # This program tests that the T-TEST /GROUPS command works properly 
4 # when a single value in the independent variable is given.
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
22 cleanup()
23 {
24      cd /
25      rm -rf $TEMPDIR
26 }
27
28
29 fail()
30 {
31     echo $activity
32     echo FAILED
33     cleanup;
34     exit 1;
35 }
36
37
38 no_result()
39 {
40     echo $activity
41     echo NO RESULT;
42     cleanup;
43     exit 2;
44 }
45
46 pass()
47 {
48     cleanup;
49     exit 0;
50 }
51
52 mkdir -p $TEMPDIR
53
54 cd $TEMPDIR
55
56 activity="create program"
57 cat > $TESTFILE <<EOF
58 data list list /INDEP * DEP *.
59 begin data.
60        1        6
61        1        6
62        1        7
63        1        6
64        1       13
65        1        4
66        1        7
67        1        9
68        1        7
69        1       12
70        1       11
71        2       11
72        2        9
73        2        8
74        2        4
75        2       16
76        2        9
77        2        9
78        2        5
79        2        4
80        2       10
81        2       14
82 end data.
83 t-test /groups=indep(1.514) /var=dep.
84 EOF
85 if [ $? -ne 0 ] ; then no_result ; fi
86
87
88 activity="run program"
89 $SUPERVISOR $PSPP -o raw-ascii $TESTFILE
90 if [ $? -ne 0 ] ; then no_result ; fi
91
92
93 activity="compare output"
94 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
95 diff  -b $TEMPDIR/pspp.list - <<EOF
96 1.1 DATA LIST.  Reading free-form data from INLINE.
97 +--------+------+
98 |Variable|Format|
99 #========#======#
100 |INDEP   |F8.0  |
101 |DEP     |F8.0  |
102 +--------+------+
103 2.1 T-TEST.  Group Statistics
104 #===========#==#====#==============#========#
105 #     INDEP | N|Mean|Std. Deviation|SE. Mean#
106 #===========#==#====#==============#========#
107 #DEP < 1.514|11|8.00|         2.864|    .863#
108 #    >=1.514|11|9.00|         3.821|   1.152#
109 #===========#==#====#==============#========#
110 2.2 T-TEST.  Independent Samples Test
111 #==============================#=========#===============================================================================#
112 #                              #Levene's |                          t-test for Equality of Means                         #
113 #                              #----+----+-----+------+---------------+---------------+---------------------+------------#
114 #                              #    |    |     |      |               |               |                     |    95%     #
115 #                              #    |    |     |      |               |               |                     +------+-----#
116 #                              #  F |Sig.|  t  |  df  |Sig. (2-tailed)|Mean Difference|Std. Error Difference| Lower|Upper#
117 #==============================#====#====#=====#======#===============#===============#=====================#======#=====#
118 #DEPEqual variances assumed    #.172|.683|-.695|    20|           .495|         -1.000|                1.440|-4.003|2.003#
119 #   Equal variances not assumed#    |    |-.695|18.539|           .496|         -1.000|                1.440|-4.018|2.018#
120 #==============================#====#====#=====#======#===============#===============#=====================#======#=====#
121 EOF
122 if [ $? -ne 0 ] ; then fail ; fi
123
124
125 pass