Consolidate quoting style in printed strings.
[pspp] / tests / command / weight.sh
1 #!/bin/sh
2
3 # This program tests the WEIGHT command
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 # ensure that top_builddir  are absolute
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 top_builddir=`cd $top_builddir; pwd`
12 PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
13
14 # ensure that top_srcdir is absolute
15 top_srcdir=`cd $top_srcdir; pwd`
16
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
19
20 LANG=C
21 export LANG
22
23
24 cleanup()
25 {
26      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
27         echo "NOT cleaning $TEMPDIR"
28         return ; 
29      fi
30      cd /
31      rm -rf $TEMPDIR
32 }
33
34
35 fail()
36 {
37     echo $activity
38     echo FAILED
39     cleanup;
40     exit 1;
41 }
42
43
44 no_result()
45 {
46     echo $activity
47     echo NO RESULT;
48     cleanup;
49     exit 2;
50 }
51
52 pass()
53 {
54     cleanup;
55     exit 0;
56 }
57
58 mkdir -p $TEMPDIR
59
60 cd $TEMPDIR
61
62 activity="create program"
63 cat > $TESTFILE << EOF
64 SET FORMAT F8.3.
65 data list file='$top_srcdir/tests/weighting.data'/AVAR 1-5 BVAR 6-10.
66 weight by BVAR.
67
68 descriptives AVAR /statistics all /format serial.
69 frequencies AVAR /statistics all.
70
71 EOF
72 if [ $? -ne 0 ] ; then no_result ; fi
73
74
75 activity="run program"
76 $SUPERVISOR $PSPP -o pspp.csv $TESTFILE
77 if [ $? -ne 0 ] ; then no_result ; fi
78
79 activity="compare results"
80 diff -c $TEMPDIR/pspp.csv - <<EOF
81 Table: Reading 1 record from \`$top_srcdir/tests/weighting.data'.
82 Variable,Record,Columns,Format
83 AVAR,1,1-  5,F5.0
84 BVAR,1,6- 10,F5.0
85
86 Table: Valid cases = 730; cases with missing value(s) = 0.
87 Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum
88 AVAR,730,0,31.515,.405,10.937,119.608,2.411,.181,1.345,.090,76.000,18.000,94.000,23006.00
89
90 Table: AVAR
91 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
92 ,18,1,.137,.137,.137
93 ,19,7,.959,.959,1.096
94 ,20,26,3.562,3.562,4.658
95 ,21,76,10.411,10.411,15.068
96 ,22,57,7.808,7.808,22.877
97 ,23,58,7.945,7.945,30.822
98 ,24,38,5.205,5.205,36.027
99 ,25,38,5.205,5.205,41.233
100 ,26,30,4.110,4.110,45.342
101 ,27,21,2.877,2.877,48.219
102 ,28,23,3.151,3.151,51.370
103 ,29,24,3.288,3.288,54.658
104 ,30,23,3.151,3.151,57.808
105 ,31,14,1.918,1.918,59.726
106 ,32,21,2.877,2.877,62.603
107 ,33,21,2.877,2.877,65.479
108 ,34,14,1.918,1.918,67.397
109 ,35,14,1.918,1.918,69.315
110 ,36,17,2.329,2.329,71.644
111 ,37,11,1.507,1.507,73.151
112 ,38,16,2.192,2.192,75.342
113 ,39,14,1.918,1.918,77.260
114 ,40,15,2.055,2.055,79.315
115 ,41,14,1.918,1.918,81.233
116 ,42,14,1.918,1.918,83.151
117 ,43,8,1.096,1.096,84.247
118 ,44,15,2.055,2.055,86.301
119 ,45,10,1.370,1.370,87.671
120 ,46,12,1.644,1.644,89.315
121 ,47,13,1.781,1.781,91.096
122 ,48,13,1.781,1.781,92.877
123 ,49,5,.685,.685,93.562
124 ,50,5,.685,.685,94.247
125 ,51,3,.411,.411,94.658
126 ,52,7,.959,.959,95.616
127 ,53,6,.822,.822,96.438
128 ,54,2,.274,.274,96.712
129 ,55,2,.274,.274,96.986
130 ,56,2,.274,.274,97.260
131 ,57,3,.411,.411,97.671
132 ,58,1,.137,.137,97.808
133 ,59,3,.411,.411,98.219
134 ,61,1,.137,.137,98.356
135 ,62,3,.411,.411,98.767
136 ,63,1,.137,.137,98.904
137 ,64,1,.137,.137,99.041
138 ,65,2,.274,.274,99.315
139 ,70,1,.137,.137,99.452
140 ,78,1,.137,.137,99.589
141 ,79,1,.137,.137,99.726
142 ,80,1,.137,.137,99.863
143 ,94,1,.137,.137,100.000
144 Total,,730,100.0,100.0,
145
146 Table: AVAR
147 N,Valid,730
148 ,Missing,0
149 Mean,,31.515
150 S.E. Mean,,.405
151 Mode,,21.000
152 Std Dev,,10.937
153 Variance,,119.608
154 Kurtosis,,2.411
155 S.E. Kurt,,.181
156 Skewness,,1.345
157 S.E. Skew,,.090
158 Range,,76.000
159 Minimum,,18.000
160 Maximum,,94.000
161 Sum,,23006.00
162 Percentiles,50 (Median),29
163 EOF
164 if [ $? -ne 0 ] ; then fail ; fi
165
166
167 pass;