Fix use of "export" to work with traditional shells.
[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 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 /INDEP * DEP *.
54 begin data.
55        1        6
56        1        6
57        1        7
58        1        6
59        1       13
60        1        4
61        1        7
62        1        9
63        1        7
64        1       12
65        1       11
66        2       11
67        2        9
68        2        8
69        2        4
70        2       16
71        2        9
72        2        9
73        2        5
74        2        4
75        2       10
76        2       14
77 end data.
78 t-test /groups=indep(1.514) /var=dep.
79 EOF
80 if [ $? -ne 0 ] ; then no_result ; fi
81
82
83 activity="run program"
84 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
85 if [ $? -ne 0 ] ; then no_result ; fi
86
87
88 activity="compare output"
89 diff -B -b $TEMPDIR/pspp.list - <<EOF
90 1.1 DATA LIST.  Reading free-form data from the command file.
91 +--------+------+
92 |Variable|Format|
93 #========#======#
94 |INDEP   |F8.0  |
95 |DEP     |F8.0  |
96 +--------+------+
97
98 2.1 T-TEST.  Group Statistics
99 #===========#==#====#==============#========#
100 #     INDEP | N|Mean|Std. Deviation|SE. Mean#
101 #===========#==#====#==============#========#
102 #DEP < 1.514|11|8.00|         2.864|    .863#
103 #    >=1.514|11|9.00|         3.821|   1.152#
104 #===========#==#====#==============#========#
105
106 2.2 T-TEST.  Independent Samples Test
107 #==============================#=========#===============================================================================#
108 #                              #Levene's |                          t-test for Equality of Means                         #
109 #                              #----+----+-----+------+---------------+---------------+---------------------+------------#
110 #                              #    |    |     |      |               |               |                     |    95%     #
111 #                              #    |    |     |      |               |               |                     +------+-----#
112 #                              #  F |Sig.|  t  |  df  |Sig. (2-tailed)|Mean Difference|Std. Error Difference| Lower|Upper#
113 #==============================#====#====#=====#======#===============#===============#=====================#======#=====#
114 #DEPEqual variances assumed    #.172|.683|-.695|    20|           .495|         -1.000|                1.440|-4.003|2.003#
115 #   Equal variances not assumed#    |    |-.695|18.539|           .496|         -1.000|                1.440|-4.018|2.018#
116 #==============================#====#====#=====#======#===============#===============#=====================#======#=====#
117 EOF
118 if [ $? -ne 0 ] ; then fail ; fi
119
120
121 pass