Fix use of "export" to work with traditional shells.
[pspp-builds.git] / tests / command / t-test-groups.sh
1 #!/bin/sh
2
3 # This program tests that the T-TEST /GROUPS command works
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 STAT_CONFIG_PATH=$top_srcdir/config
14 export STAT_CONFIG_PATH
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 * INDEP * DEP1 * DEP2 *.
53 begin data.
54 1  1.1 1 3
55 2  1.1 2 4
56 3  1.1 2 4 
57 4  1.1 2 4 
58 5  1.1 3 5
59 6  2.1 3 1
60 7  2.1 4 2
61 8  2.1 4 2
62 9  2.1 4 2
63 10 2.1 5 3
64 11 3.1 2 2
65 end data.
66
67 * Note that this last case should be IGNORED since it doesn't have a dependent variable of either 1 or 2
68
69 t-test /GROUPS=indep(1.1,2.1) /var=dep1 dep2.
70 EOF
71 if [ $? -ne 0 ] ; then no_result ; fi
72
73
74 activity="run program"
75 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
76 if [ $? -ne 0 ] ; then no_result ; fi
77
78 activity="compare output"
79 diff -B -b $TEMPDIR/pspp.list - <<EOF
80 1.1 DATA LIST.  Reading free-form data from the command file.
81 +--------+------+
82 |Variable|Format|
83 #========#======#
84 |ID      |F8.0  |
85 |INDEP   |F8.0  |
86 |DEP1    |F8.0  |
87 |DEP2    |F8.0  |
88 +--------+------+
89
90 2.1 T-TEST.  Group Statistics
91 #==========#=#====#==============#========#
92 #     INDEP|N|Mean|Std. Deviation|SE. Mean#
93 #==========#=#====#==============#========#
94 #DEP1 1.1  |5|2.00|          .707|    .316#
95 #     2.1  |5|4.00|          .707|    .316#
96 #DEP2 1.1  |5|4.00|          .707|    .316#
97 #     2.1  |5|2.00|          .707|    .316#
98 #==========#=#====#==============#========#
99
100 2.2 T-TEST.  Independent Samples Test
101 #===============================#==========#===============================================================================#
102 #                               # Levene's |                          t-test for Equality of Means                         #
103 #                               #----+-----+------+-----+---------------+---------------+---------------------+------------#
104 #                               #    |     |      |     |               |               |                     |    95%     #
105 #                               #    |     |      |     |               |               |                     +------+-----#
106 #                               # F  | Sig.|   t  |  df |Sig. (2-tailed)|Mean Difference|Std. Error Difference| Lower|Upper#
107 #===============================#====#=====#======#=====#===============#===============#=====================#======#=====#
108 #DEP1Equal variances assumed    #.000|1.000|-4.472|    8|           .002|         -2.000|                 .447|-3.031|-.969#
109 #    Equal variances not assumed#    |     |-4.472|8.000|           .002|         -2.000|                 .447|-3.031|-.969#
110 #DEP2Equal variances assumed    #.000|1.000| 4.472|    8|           .002|          2.000|                 .447|  .969|3.031#
111 #    Equal variances not assumed#    |     | 4.472|8.000|           .002|          2.000|                 .447|  .969|3.031#
112 #===============================#====#=====#======#=====#===============#===============#=====================#======#=====#
113 EOF
114 if [ $? -ne 0 ] ; then fail ; fi
115
116
117 pass