Checkin of new directory structure.
[pspp-builds.git] / tests / stats / descript-missing.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
12 # ensure that top_srcdir is absolute
13 top_srcdir=`cd $top_srcdir; pwd`
14
15 STAT_CONFIG_PATH=$top_srcdir/config
16 export STAT_CONFIG_PATH
17
18
19 cleanup()
20 {
21      cd /
22      rm -rf $TEMPDIR
23 }
24
25
26 fail()
27 {
28     echo $activity
29     echo FAILED
30     cleanup;
31     exit 1;
32 }
33
34
35 no_result()
36 {
37     echo $activity
38     echo NO RESULT;
39     cleanup;
40     exit 2;
41 }
42
43 pass()
44 {
45     cleanup;
46     exit 0;
47 }
48
49 mkdir -p $TEMPDIR
50
51 cd $TEMPDIR
52
53 activity="create program"
54 cat > $TEMPDIR/descript.stat <<EOF
55 title 'Test DESCRIPTIVES procedure'.
56
57 data list / V1 TO V3 1-3.
58 mis val v1 to v3 (1).
59 begin data.
60 111
61    
62  1 
63 1 1
64 112
65 123
66 234
67 end data.
68
69 descript all/stat=all/format=serial.
70 descript all/stat=all/format=serial/missing=include.
71 descript all/stat=all/format=serial/missing=listwise.
72 descript all/stat=all/format=serial/missing=listwise include.
73
74 EOF
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77
78 activity="run program"
79 $SUPERVISOR $top_builddir/src/pspp -o raw-ascii $TEMPDIR/descript.stat
80 if [ $? -ne 0 ] ; then no_result ; fi
81
82 activity="compare output"
83 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
84 diff -b $TEMPDIR/pspp.list - <<EOF
85 1.1 DATA LIST.  Reading 1 record from INLINE.
86 +--------+------+-------+------+
87 |Variable|Record|Columns|Format|
88 #========#======#=======#======#
89 |V1      |     1|  1-  1|F1.0  |
90 |V2      |     1|  2-  2|F1.0  |
91 |V3      |     1|  3-  3|F1.0  |
92 +--------+------+-------+------+
93 2.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 6.
94 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
95 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
96 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
97 |V1      #      1|        6|2.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  2.000|  2.000|2.000|
98 |V2      #      2|        5|2.500|    .500|   .707|    .500|    .   |    .   |    .   |    .   |1.000|  2.000|  3.000|5.000|
99 |V3      #      3|        4|3.000|    .577|  1.000|   1.000|    .   |    .   |    .000|   1.225|2.000|  2.000|  4.000|9.000|
100 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
101 3.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 3.
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 |V1      #      5|        2|1.200|    .200|   .447|    .200|   5.000|   2.000|   2.236|    .913|1.000|  1.000|  2.000| 6.000|
106 |V2      #      5|        2|1.600|    .400|   .894|    .800|    .312|   2.000|   1.258|    .913|2.000|  1.000|  3.000| 8.000|
107 |V3      #      5|        2|2.200|    .583|  1.304|   1.700|  -1.488|   2.000|    .541|    .913|3.000|  1.000|  4.000|11.000|
108 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
109 4.1 DESCRIPTIVES.  Valid cases = 1; cases with missing value(s) = 6.
110 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
111 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
112 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
113 |V1      #      1|        0|2.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  2.000|  2.000|2.000|
114 |V2      #      1|        0|3.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  3.000|  3.000|3.000|
115 |V3      #      1|        0|4.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  4.000|  4.000|4.000|
116 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
117 5.1 DESCRIPTIVES.  Valid cases = 4; cases with missing value(s) = 3.
118 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
119 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
120 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
121 |V1      #      4|        0|1.250|    .250|   .500|    .250|   4.000|   2.619|   2.000|   1.014|1.000|  1.000|  2.000| 5.000|
122 |V2      #      4|        0|1.750|    .479|   .957|    .917|  -1.289|   2.619|    .855|   1.014|2.000|  1.000|  3.000| 7.000|
123 |V3      #      4|        0|2.500|    .645|  1.291|   1.667|  -1.200|   2.619|    .000|   1.014|3.000|  1.000|  4.000|10.000|
124 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
125 EOF
126 if [ $? -ne 0 ] ; then fail ; fi
127
128
129 pass