Enabled the autoscroll feature on the datasheet.
[pspp] / tests / command / trimmed-mean.sh
1 #!/bin/sh
2
3 # This program tests  the Trimmed Mean calculation, in the case
4 # where the data is weighted towards the centre
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 LANG=C
22 export LANG
23
24
25 cleanup()
26 {
27      cd /
28      rm -rf $TEMPDIR
29 }
30
31
32 fail()
33 {
34     echo $activity
35     echo FAILED
36     cleanup;
37     exit 1;
38 }
39
40
41 no_result()
42 {
43     echo $activity
44     echo NO RESULT;
45     cleanup;
46     exit 2;
47 }
48
49 pass()
50 {
51     cleanup;
52     exit 0;
53 }
54
55 mkdir -p $TEMPDIR
56
57 cd $TEMPDIR
58
59
60 activity="create program"
61 cat > $TESTFILE <<EOF
62 DATA LIST LIST /X * C *.
63 BEGIN DATA.
64 1 1
65 2 49
66 3 2
67 END DATA.
68
69 WEIGHT BY c.
70
71 EXAMINE
72         x
73         /STATISTICS=DESCRIPTIVES
74         .
75 EOF
76 if [ $? -ne 0 ] ; then no_result ; fi
77
78
79 activity="run program"
80 $SUPERVISOR $PSPP --testing-mode $TESTFILE
81 if [ $? -ne 0 ] ; then no_result ; fi
82
83
84 activity="compare results"
85 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
86 diff -b  $TEMPDIR/pspp.list - << EOF
87 1.1 DATA LIST.  Reading free-form data from INLINE.
88 +--------+------+
89 |Variable|Format|
90 #========#======#
91 |X       |F8.0  |
92 |C       |F8.0  |
93 +--------+------+
94 2.1 EXAMINE.  Case Processing Summary
95 #=#===============================#
96 # #             Cases             #
97 # #----------+---------+----------#
98 # #   Valid  | Missing |   Total  #
99 # #--+-------+-+-------+--+-------#
100 # # N|Percent|N|Percent| N|Percent#
101 #=#==#=======#=#=======#==#=======#
102 #X#52|   100%|0|     0%|52|   100%#
103 #=#==#=======#=#=======#==#=======#
104 2.2 EXAMINE.  Descriptives
105 #==============================================#=========#==========#
106 #                                              #Statistic|Std. Error#
107 #==============================================#=========#==========#
108 #X Mean                                        #   2.02  |   .034   #
109 #  95% Confidence Interval for Mean Lower Bound#  1.952  |          #
110 #                                   Upper Bound#  2.087  |          #
111 #  5% Trimmed Mean                             #   2.00  |          #
112 #  Median                                      #   2.00  |          #
113 #  Variance                                    #   .058  |          #
114 #  Std. Deviation                              #   .242  |          #
115 #  Minimum                                     #  1.000  |          #
116 #  Maximum                                     #  3.000  |          #
117 #  Range                                       #  2.000  |          #
118 #  Interquartile Range                         #   .00   |          #
119 #  Skewness                                    #  1.194  |   .330   #
120 #  Kurtosis                                    #  15.732 |   .650   #
121 #==============================================#=========#==========#
122 EOF
123 if [ $? -ne 0 ] ; then fail ; fi
124
125 pass