Implemented long variable names a la spss V12.
[pspp-builds.git] / 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 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 export STAT_CONFIG_PATH=$top_srcdir/config
14
15
16 cleanup()
17 {
18      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then return ; fi
19      rm -rf $TEMPDIR
20 }
21
22
23 fail()
24 {
25     echo $activity
26     echo FAILED
27     cleanup;
28     exit 1;
29 }
30
31
32 no_result()
33 {
34     echo $activity
35     echo NO RESULT;
36     cleanup;
37     exit 2;
38 }
39
40 pass()
41 {
42     cleanup;
43     exit 0;
44 }
45
46 mkdir -p $TEMPDIR
47
48 cd $TEMPDIR
49
50 activity="create program"
51 cat > $TESTFILE << EOF
52 data list file='$top_srcdir/tests/weighting.data'/AVAR 1-5 BVAR 6-10.
53 weight by BVAR.
54
55 descriptives AVAR /statistics all /format serial.
56 frequencies AVAR /statistics all /format condense.
57
58 EOF
59 if [ $? -ne 0 ] ; then no_result ; fi
60
61
62 activity="run program"
63 $SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE
64 if [ $? -ne 0 ] ; then no_result ; fi
65
66 activity="compare results"
67 diff -B -b $TEMPDIR/pspp.list - <<EOF
68 1.1 DATA LIST.  Reading 1 record from file $top_srcdir/tests/weighting.data.
69 +--------+------+-------+------+
70 |Variable|Record|Columns|Format|
71 #========#======#=======#======#
72 |AVAR    |     1|  1-  5|F5.0  |
73 |BVAR    |     1|  6- 10|F5.0  |
74 +--------+------+-------+------+
75
76 2.1 DESCRIPTIVES.  Valid cases = 730; cases with missing value(s) = 0.
77 +--------#-------+---------+------+--------+-------+--------+--------+--------+--------+--------+------+-------+-------+---------+
78 |Variable#Valid N|Missing N| Mean |S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew| Range|Minimum|Maximum|   Sum   |
79 #========#=======#=========#======#========#=======#========#========#========#========#========#======#=======#=======#=========#
80 |AVAR    #    730|        0|31.515|    .405| 10.937| 119.608|   2.411|    .181|   1.345|    .090|76.000| 18.000| 94.000|23006.000|
81 +--------#-------+---------+------+--------+-------+--------+--------+--------+--------+--------+------+-------+-------+---------+
82
83 3.1 FREQUENCIES.  AVAR: 
84 +--------+--------+---+---+
85 |        |        |   |Cum|
86 |  Value |  Freq  |Pct|Pct|
87 #========#========#===#===#
88 |      18|       1|  0|  0|
89 |      19|       7|  1|  1|
90 |      20|      26|  4|  5|
91 |      21|      76| 10| 15|
92 |      22|      57|  8| 23|
93 |      23|      58|  8| 31|
94 |      24|      38|  5| 36|
95 |      25|      38|  5| 41|
96 |      26|      30|  4| 45|
97 |      27|      21|  3| 48|
98 |      28|      23|  3| 51|
99 |      29|      24|  3| 55|
100 |      30|      23|  3| 58|
101 |      31|      14|  2| 60|
102 |      32|      21|  3| 63|
103 |      33|      21|  3| 65|
104 |      34|      14|  2| 67|
105 |      35|      14|  2| 69|
106 |      36|      17|  2| 72|
107 |      37|      11|  2| 73|
108 |      38|      16|  2| 75|
109 |      39|      14|  2| 77|
110 |      40|      15|  2| 79|
111 |      41|      14|  2| 81|
112 |      42|      14|  2| 83|
113 |      43|       8|  1| 84|
114 |      44|      15|  2| 86|
115 |      45|      10|  1| 88|
116 |      46|      12|  2| 89|
117 |      47|      13|  2| 91|
118 |      48|      13|  2| 93|
119 |      49|       5|  1| 94|
120 |      50|       5|  1| 94|
121 |      51|       3|  0| 95|
122 |      52|       7|  1| 96|
123 |      53|       6|  1| 96|
124 |      54|       2|  0| 97|
125 |      55|       2|  0| 97|
126 |      56|       2|  0| 97|
127 |      57|       3|  0| 98|
128 |      58|       1|  0| 98|
129 |      59|       3|  0| 98|
130 |      61|       1|  0| 98|
131 |      62|       3|  0| 99|
132 |      63|       1|  0| 99|
133 |      64|       1|  0| 99|
134 |      65|       2|  0| 99|
135 |      70|       1|  0| 99|
136 |      78|       1|  0|100|
137 |      79|       1|  0|100|
138 |      80|       1|  0|100|
139 |      94|       1|  0|100|
140 +--------+--------+---+---+
141
142 +-----------------+---------+
143 |N         Valid  |      730|
144 |          Missing|        0|
145 |Mean             |   31.515|
146 |S.E. Mean        |     .405|
147 |Median           |   28.500|
148 |Mode             |   21.000|
149 |Std Dev          |   10.937|
150 |Variance         |  119.608|
151 |Kurtosis         |    2.411|
152 |S.E. Kurt        |     .181|
153 |Skewness         |    1.345|
154 |S.E. Skew        |     .090|
155 |Range            |   76.000|
156 |Minimum          |   18.000|
157 |Maximum          |   94.000|
158 |Sum              |23006.000|
159 +-----------------+---------+
160 EOF
161 if [ $? -ne 0 ] ; then fail ; fi
162
163
164 pass;