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