Fixed a lot of internationalisation issues.
[pspp-builds.git] / tests / command / examine-percentiles.sh
1 #!/bin/sh
2
3 # This program tests  the PERCENTILES subcommand of the EXAMINE command.
4 # In particular it tests that it behaves properly when there are only 
5 # a few cases
6
7 TEMPDIR=/tmp/pspp-tst-$$
8 TESTFILE=$TEMPDIR/`basename $0`.sps
9
10 # ensure that top_builddir  are absolute
11 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
12 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
13 top_builddir=`cd $top_builddir; pwd`
14 PSPP=$top_builddir/src/ui/terminal/pspp
15
16 # ensure that top_srcdir is absolute
17 top_srcdir=`cd $top_srcdir; pwd`
18
19 STAT_CONFIG_PATH=$top_srcdir/config
20 export STAT_CONFIG_PATH
21
22 LANG=C
23 export LANG
24
25
26 cleanup()
27 {
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 /X *.
63 BEGIN DATA.
64 2.00 
65 8.00 
66 5.00 
67 END DATA.
68
69 EXAMINE /x
70         /PERCENTILES=HAVERAGE.
71
72 EXAMINE /x
73         /PERCENTILES=WAVERAGE.
74
75 EXAMINE /x
76         /PERCENTILES=ROUND.
77
78 EXAMINE /x
79         /PERCENTILES=EMPIRICAL.
80
81 EXAMINE /x
82         /PERCENTILES=AEMPIRICAL.
83 EOF
84 if [ $? -ne 0 ] ; then no_result ; fi
85
86 activity="run program"
87 $SUPERVISOR $PSPP -o raw-ascii $TESTFILE
88 if [ $? -ne 0 ] ; then no_result ; fi
89
90
91 activity="compare results"
92 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
93 diff -b  $TEMPDIR/pspp.list - << EOF
94 1.1 DATA LIST.  Reading free-form data from INLINE.
95 +--------+------+
96 |Variable|Format|
97 #========#======#
98 |X       |F8.0  |
99 +--------+------+
100 2.1 EXAMINE.  Case Processing Summary
101 #=#=============================#
102 # #            Cases            #
103 # #---------+---------+---------#
104 # #  Valid  | Missing |  Total  #
105 # #-+-------+-+-------+-+-------#
106 # #N|Percent|N|Percent|N|Percent#
107 #=#=#=======#=#=======#=#=======#
108 #X#3|   100%|0|     0%|3|   100%#
109 #=#=#=======#=#=======#=#=======#
110 2.2 EXAMINE.  Percentiles
111 #================#================================#
112 #                #             Percentiles        #
113 #                #---+---+----+----+----+----+----#
114 #                # 5 | 10| 25 | 50 | 75 | 90 | 95 #
115 #=#==============#===#===#====#====#====#====#====#
116 #X|HAverage      #.40|.80|2.00|5.00|8.00|8.00|8.00#
117 # |Tukey's Hinges#   |   |3.50|5.00|6.50|    |    #
118 #=#==============#===#===#====#====#====#====#====#
119 3.1 EXAMINE.  Case Processing Summary
120 #=#=============================#
121 # #            Cases            #
122 # #---------+---------+---------#
123 # #  Valid  | Missing |  Total  #
124 # #-+-------+-+-------+-+-------#
125 # #N|Percent|N|Percent|N|Percent#
126 #=#=#=======#=#=======#=#=======#
127 #X#3|   100%|0|     0%|3|   100%#
128 #=#=#=======#=#=======#=#=======#
129 3.2 EXAMINE.  Percentiles
130 #==================#================================#
131 #                  #             Percentiles        #
132 #                  #---+---+----+----+----+----+----#
133 #                  # 5 | 10| 25 | 50 | 75 | 90 | 95 #
134 #=#================#===#===#====#====#====#====#====#
135 #X|Weighted Average#.30|.60|1.50|3.50|5.75|7.10|7.55#
136 # |Tukey's Hinges  #   |   |3.50|5.00|6.50|    |    #
137 #=#================#===#===#====#====#====#====#====#
138 4.1 EXAMINE.  Case Processing Summary
139 #=#=============================#
140 # #            Cases            #
141 # #---------+---------+---------#
142 # #  Valid  | Missing |  Total  #
143 # #-+-------+-+-------+-+-------#
144 # #N|Percent|N|Percent|N|Percent#
145 #=#=#=======#=#=======#=#=======#
146 #X#3|   100%|0|     0%|3|   100%#
147 #=#=#=======#=#=======#=#=======#
148 4.2 EXAMINE.  Percentiles
149 #================#================================#
150 #                #             Percentiles        #
151 #                #---+---+----+----+----+----+----#
152 #                # 5 | 10| 25 | 50 | 75 | 90 | 95 #
153 #=#==============#===#===#====#====#====#====#====#
154 #X|Rounded       #.00|.00|2.00|5.00|5.00|8.00|8.00#
155 # |Tukey's Hinges#   |   |3.50|5.00|6.50|    |    #
156 #=#==============#===#===#====#====#====#====#====#
157 5.1 EXAMINE.  Case Processing Summary
158 #=#=============================#
159 # #            Cases            #
160 # #---------+---------+---------#
161 # #  Valid  | Missing |  Total  #
162 # #-+-------+-+-------+-+-------#
163 # #N|Percent|N|Percent|N|Percent#
164 #=#=#=======#=#=======#=#=======#
165 #X#3|   100%|0|     0%|3|   100%#
166 #=#=#=======#=#=======#=#=======#
167 5.2 EXAMINE.  Percentiles
168 #================#==================================#
169 #                #              Percentiles         #
170 #                #----+----+----+----+----+----+----#
171 #                #  5 | 10 | 25 | 50 | 75 | 90 | 95 #
172 #=#==============#====#====#====#====#====#====#====#
173 #X|Empirical     #2.00|2.00|2.00|5.00|8.00|8.00|8.00#
174 # |Tukey's Hinges#    |    |3.50|5.00|6.50|    |    #
175 #=#==============#====#====#====#====#====#====#====#
176 6.1 EXAMINE.  Case Processing Summary
177 #=#=============================#
178 # #            Cases            #
179 # #---------+---------+---------#
180 # #  Valid  | Missing |  Total  #
181 # #-+-------+-+-------+-+-------#
182 # #N|Percent|N|Percent|N|Percent#
183 #=#=#=======#=#=======#=#=======#
184 #X#3|   100%|0|     0%|3|   100%#
185 #=#=#=======#=#=======#=#=======#
186 6.2 EXAMINE.  Percentiles
187 #==========================#==================================#
188 #                          #              Percentiles         #
189 #                          #----+----+----+----+----+----+----#
190 #                          #  5 | 10 | 25 | 50 | 75 | 90 | 95 #
191 #=#========================#====#====#====#====#====#====#====#
192 #X|Empirical with averaging#2.00|2.00|2.00|5.00|8.00|8.00|8.00#
193 # |Tukey's Hinges          #    |    |3.50|5.00|6.50|    |    #
194 #=#========================#====#====#====#====#====#====#====#
195 EOF
196 if [ $? -ne 0 ] ; then fail ; fi
197
198 pass