Rework glm.q to use new covariance routines
[pspp] / tests / stats / descript-basic.sh
1 #!/bin/sh
2
3 # This program tests that the descriptives command actually works
4
5 TEMPDIR=/tmp/pspp-tst-$$
6
7 # ensure that top_builddir  are absolute
8 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 top_builddir=`cd $top_builddir; pwd`
11 PSPP=$top_builddir/src/ui/terminal/pspp
12
13 # ensure that top_srcdir is absolute
14 top_srcdir=`cd $top_srcdir; pwd`
15
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
18
19 LANG=C
20 export LANG
21
22 cleanup()
23 {
24      if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
25         echo "NOT cleaning $TEMPDIR" 
26         return ; 
27      fi
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 > $TEMPDIR/descript.stat <<EOF
62 title 'Test DESCRIPTIVES procedure'.
63
64 data list / V0 to V16 1-17.
65 begin data.
66 12128989012389023
67 34128080123890128
68 56127781237893217
69 78127378123793112
70 90913781237892318
71 37978547878935789
72 52878237892378279
73 12377912789378932
74 26787654347894348
75 29137178947891888
76 end data.
77
78 descript all/stat=all/format=serial.
79
80 EOF
81 if [ $? -ne 0 ] ; then no_result ; fi
82
83
84 activity="run program"
85 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/descript.stat
86 if [ $? -ne 0 ] ; then no_result ; fi
87
88 activity="compare output"
89 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
90 diff -b $TEMPDIR/pspp.list - <<EOF
91 1.1 DATA LIST.  Reading 1 record from INLINE.
92 +--------+------+-------+------+
93 |Variable|Record|Columns|Format|
94 #========#======#=======#======#
95 |V0      |     1|  1-  1|F1.0  |
96 |V1      |     1|  2-  2|F1.0  |
97 |V2      |     1|  3-  3|F1.0  |
98 |V3      |     1|  4-  4|F1.0  |
99 |V4      |     1|  5-  5|F1.0  |
100 |V5      |     1|  6-  6|F1.0  |
101 |V6      |     1|  7-  7|F1.0  |
102 |V7      |     1|  8-  8|F1.0  |
103 |V8      |     1|  9-  9|F1.0  |
104 |V9      |     1| 10- 10|F1.0  |
105 |V10     |     1| 11- 11|F1.0  |
106 |V11     |     1| 12- 12|F1.0  |
107 |V12     |     1| 13- 13|F1.0  |
108 |V13     |     1| 14- 14|F1.0  |
109 |V14     |     1| 15- 15|F1.0  |
110 |V15     |     1| 16- 16|F1.0  |
111 |V16     |     1| 17- 17|F1.0  |
112 +--------+------+-------+------+
113 2.1 DESCRIPTIVES.  Valid cases = 10; cases with missing value(s) = 0.
114 +--------#-------+---------+----+---------+-------+--------+--------+---------+--------+---------+-----+-------+-------+-----+
115 |Variable#Valid N|Missing N|Mean|S.E. Mean|Std Dev|Variance|Kurtosis|S.E. Kurt|Skewness|S.E. Skew|Range|Minimum|Maximum| Sum |
116 #========#=======#=========#====#=========#=======#========#========#=========#========#=========#=====#=======#=======#=====#
117 |V0      #     10|        0|3.80|      .84|   2.66|    7.07|    -.03|     1.33|     .89|      .69| 8.00|   1.00|   9.00|38.00|
118 |V1      #     10|        0|4.60|      .96|   3.03|    9.16|   -1.39|     1.33|    -.03|      .69| 9.00|    .00|   9.00|46.00|
119 |V2      #     10|        0|4.10|     1.16|   3.67|   13.43|   -2.02|     1.33|     .48|      .69| 8.00|   1.00|   9.00|41.00|
120 |V3      #     10|        0|4.10|      .87|   2.77|    7.66|   -2.05|     1.33|     .42|      .69| 7.00|   1.00|   8.00|41.00|
121 |V4      #     10|        0|7.00|      .47|   1.49|    2.22|    7.15|     1.33|   -2.52|      .69| 5.00|   3.00|   8.00|70.00|
122 |V5      #     10|        0|4.90|     1.03|   3.25|   10.54|   -1.40|     1.33|    -.20|      .69| 9.00|    .00|   9.00|49.00|
123 |V6      #     10|        0|5.90|      .80|   2.51|    6.32|    -.29|     1.33|    -.96|      .69| 7.00|   1.00|   8.00|59.00|
124 |V7      #     10|        0|4.70|     1.10|   3.47|   12.01|   -1.99|     1.33|    -.16|      .69| 9.00|    .00|   9.00|47.00|
125 |V8      #     10|        0|4.10|     1.10|   3.48|   12.10|   -1.93|     1.33|     .37|      .69| 9.00|    .00|   9.00|41.00|
126 |V9      #     10|        0|4.30|      .87|   2.75|    7.57|    -.87|     1.33|     .73|      .69| 8.00|   1.00|   9.00|43.00|
127 |V10     #     10|        0|5.50|      .85|   2.68|    7.17|   -1.84|     1.33|    -.33|      .69| 7.00|   2.00|   9.00|55.00|
128 |V11     #     10|        0|6.50|      .78|   2.46|    6.06|   -1.28|     1.33|    -.89|      .69| 6.00|   3.00|   9.00|65.00|
129 |V12     #     10|        0|7.90|      .60|   1.91|    3.66|    5.24|     1.33|   -2.21|      .69| 6.00|   3.00|   9.00|79.00|
130 |V13     #     10|        0|4.30|      .99|   3.13|    9.79|   -1.25|     1.33|     .33|      .69| 9.00|    .00|   9.00|43.00|
131 |V14     #     10|        0|3.60|     1.01|   3.20|   10.27|    -.96|     1.33|     .81|      .69| 9.00|    .00|   9.00|36.00|
132 |V15     #     10|        0|3.70|      .92|   2.91|    8.46|   -1.35|     1.33|     .71|      .69| 7.00|   1.00|   8.00|37.00|
133 |V16     #     10|        0|6.40|      .91|   2.88|    8.27|   -1.14|     1.33|    -.92|      .69| 7.00|   2.00|   9.00|64.00|
134 +--------#-------+---------+----+---------+-------+--------+--------+---------+--------+---------+-----+-------+-------+-----+
135 EOF
136 if [ $? -ne 0 ] ; then fail ; fi
137
138
139 pass