Fixed some buglets in the tests
[pspp-builds.git] / tests / command / descriptives.sh
1 #!/bin/sh
2
3 # This program tests that the descriptives command actually works
4
5 TEMPDIR=/tmp/pspp-tst-$$
6
7 here=`pwd`;
8
9 # ensure that top_srcdir is absolute
10 cd $top_srcdir; top_srcdir=`pwd`
11
12 export STAT_CONFIG_PATH=$top_srcdir/config
13
14
15 cleanup()
16 {
17      rm -rf $TEMPDIR
18 }
19
20
21 fail()
22 {
23     echo $activity
24     echo FAILED
25     cleanup;
26     exit 1;
27 }
28
29
30 no_result()
31 {
32     echo $activity
33     echo NO RESULT;
34     cleanup;
35     exit 2;
36 }
37
38 pass()
39 {
40     cleanup;
41     exit 0;
42 }
43
44 mkdir -p $TEMPDIR
45
46 cd $TEMPDIR
47
48 activity="create program"
49 cat > $TEMPDIR/descript.stat <<EOF
50 title 'Test DESCRIPTIVES procedure'.
51
52 data list / v0 to v16 1-17.
53 begin data.
54 12128989012389023
55 34128080123890128
56 56127781237893217
57 78127378123793112
58 90913781237892318
59 37978547878935789
60 52878237892378279
61 12377912789378932
62 26787654347894348
63 29137178947891888
64 end data.
65
66 descript all/stat=all/format=serial.
67
68 EOF
69 if [ $? -ne 0 ] ; then no_result ; fi
70
71
72 activity="run program"
73 $here/../src/pspp -o raw-ascii $TEMPDIR/descript.stat
74 if [ $? -ne 0 ] ; then no_result ; fi
75
76 activity="compare output"
77 diff -B -b $TEMPDIR/pspp.list - <<EOF
78 1.1 DATA LIST.  Reading 1 record from the command file.
79 +--------+------+-------+------+
80 |Variable|Record|Columns|Format|
81 #========#======#=======#======#
82 |V0      |     1|  1-  1|F1.0  |
83 |V1      |     1|  2-  2|F1.0  |
84 |V2      |     1|  3-  3|F1.0  |
85 |V3      |     1|  4-  4|F1.0  |
86 |V4      |     1|  5-  5|F1.0  |
87 |V5      |     1|  6-  6|F1.0  |
88 |V6      |     1|  7-  7|F1.0  |
89 |V7      |     1|  8-  8|F1.0  |
90 |V8      |     1|  9-  9|F1.0  |
91 |V9      |     1| 10- 10|F1.0  |
92 |V10     |     1| 11- 11|F1.0  |
93 |V11     |     1| 12- 12|F1.0  |
94 |V12     |     1| 13- 13|F1.0  |
95 |V13     |     1| 14- 14|F1.0  |
96 |V14     |     1| 15- 15|F1.0  |
97 |V15     |     1| 16- 16|F1.0  |
98 |V16     |     1| 17- 17|F1.0  |
99 +--------+------+-------+------+
100
101 2.1 DESCRIPTIVES.  Valid cases = 10; cases with missing value(s) = 0.
102 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
103 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
104 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
105 |V0      #     10|        0|3.800|    .841|  2.658|   7.067|   -.035|   1.334|    .889|    .687|8.000|  1.000|  9.000|38.000|
106 |V1      #     10|        0|4.600|    .957|  3.026|   9.156|  -1.386|   1.334|   -.032|    .687|9.000|   .000|  9.000|46.000|
107 |V2      #     10|        0|4.100|   1.159|  3.665|  13.433|  -2.019|   1.334|    .476|    .687|8.000|  1.000|  9.000|41.000|
108 |V3      #     10|        0|4.100|    .875|  2.767|   7.656|  -2.049|   1.334|    .422|    .687|7.000|  1.000|  8.000|41.000|
109 |V4      #     10|        0|7.000|    .471|  1.491|   2.222|   7.152|   1.334|  -2.516|    .687|5.000|  3.000|  8.000|70.000|
110 |V5      #     10|        0|4.900|   1.027|  3.247|  10.544|  -1.401|   1.334|   -.205|    .687|9.000|   .000|  9.000|49.000|
111 |V6      #     10|        0|5.900|    .795|  2.514|   6.322|   -.290|   1.334|   -.960|    .687|7.000|  1.000|  8.000|59.000|
112 |V7      #     10|        0|4.700|   1.096|  3.466|  12.011|  -1.993|   1.334|   -.165|    .687|9.000|   .000|  9.000|47.000|
113 |V8      #     10|        0|4.100|   1.100|  3.479|  12.100|  -1.928|   1.334|    .371|    .687|9.000|   .000|  9.000|41.000|
114 |V9      #     10|        0|4.300|    .870|  2.751|   7.567|   -.875|   1.334|    .730|    .687|8.000|  1.000|  9.000|43.000|
115 |V10     #     10|        0|5.500|    .847|  2.677|   7.167|  -1.842|   1.334|   -.326|    .687|7.000|  2.000|  9.000|55.000|
116 |V11     #     10|        0|6.500|    .778|  2.461|   6.056|  -1.276|   1.334|   -.895|    .687|6.000|  3.000|  9.000|65.000|
117 |V12     #     10|        0|7.900|    .605|  1.912|   3.656|   5.241|   1.334|  -2.208|    .687|6.000|  3.000|  9.000|79.000|
118 |V13     #     10|        0|4.300|    .989|  3.129|   9.789|  -1.248|   1.334|    .333|    .687|9.000|   .000|  9.000|43.000|
119 |V14     #     10|        0|3.600|   1.013|  3.204|  10.267|   -.961|   1.334|    .809|    .687|9.000|   .000|  9.000|36.000|
120 |V15     #     10|        0|3.700|    .920|  2.908|   8.456|  -1.352|   1.334|    .710|    .687|7.000|  1.000|  8.000|37.000|
121 |V16     #     10|        0|6.400|    .909|  2.875|   8.267|  -1.142|   1.334|   -.923|    .687|7.000|  2.000|  9.000|64.000|
122 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
123 EOF
124 if [ $? -ne 0 ] ; then fail ; fi
125
126
127 pass