8572266f2a07750d6c0d9aa5b7774141e75e668f
[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 here=`pwd`;
8
9 # ensure that top_srcdir is absolute
10 cd $top_srcdir; top_srcdir=`pwd`
11
12 STAT_CONFIG_PATH=$top_srcdir/config
13 export STAT_CONFIG_PATH
14
15
16 cleanup()
17 {
18      cd /
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 > $TEMPDIR/descript.stat <<EOF
52 title 'Test DESCRIPTIVES procedure'.
53
54 data list / V1 TO V3 1-3.
55 mis val v1 to v3 (1).
56 begin data.
57 111
58    
59  1 
60 1 1
61 112
62 123
63 234
64 end data.
65
66 descript all/stat=all/format=serial.
67 descript all/stat=all/format=serial/missing=include.
68 descript all/stat=all/format=serial/missing=listwise.
69 descript all/stat=all/format=serial/missing=listwise include.
70
71 EOF
72 if [ $? -ne 0 ] ; then no_result ; fi
73
74
75 activity="run program"
76 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/descript.stat
77 if [ $? -ne 0 ] ; then no_result ; fi
78
79 activity="compare output"
80 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
81 diff -b $TEMPDIR/pspp.list - <<EOF
82 1.1 DATA LIST.  Reading 1 record from INLINE.
83 +--------+------+-------+------+
84 |Variable|Record|Columns|Format|
85 #========#======#=======#======#
86 |V1      |     1|  1-  1|F1.0  |
87 |V2      |     1|  2-  2|F1.0  |
88 |V3      |     1|  3-  3|F1.0  |
89 +--------+------+-------+------+
90 2.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 6.
91 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
92 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
93 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
94 |V1      #      1|        6|2.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  2.000|  2.000|2.000|
95 |V2      #      2|        5|2.500|    .500|   .707|    .500|    .   |    .   |    .   |    .   |1.000|  2.000|  3.000|5.000|
96 |V3      #      3|        4|3.000|    .577|  1.000|   1.000|    .   |    .   |    .000|   1.225|2.000|  2.000|  4.000|9.000|
97 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
98 3.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 3.
99 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
100 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
101 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
102 |V1      #      5|        2|1.200|    .200|   .447|    .200|   5.000|   2.000|   2.236|    .913|1.000|  1.000|  2.000| 6.000|
103 |V2      #      5|        2|1.600|    .400|   .894|    .800|    .312|   2.000|   1.258|    .913|2.000|  1.000|  3.000| 8.000|
104 |V3      #      5|        2|2.200|    .583|  1.304|   1.700|  -1.488|   2.000|    .541|    .913|3.000|  1.000|  4.000|11.000|
105 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
106 4.1 DESCRIPTIVES.  Valid cases = 1; cases with missing value(s) = 6.
107 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
108 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
109 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
110 |V1      #      1|        0|2.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  2.000|  2.000|2.000|
111 |V2      #      1|        0|3.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  3.000|  3.000|3.000|
112 |V3      #      1|        0|4.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  4.000|  4.000|4.000|
113 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
114 5.1 DESCRIPTIVES.  Valid cases = 4; cases with missing value(s) = 3.
115 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
116 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
117 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
118 |V1      #      4|        0|1.250|    .250|   .500|    .250|   4.000|   2.619|   2.000|   1.014|1.000|  1.000|  2.000| 5.000|
119 |V2      #      4|        0|1.750|    .479|   .957|    .917|  -1.289|   2.619|    .855|   1.014|2.000|  1.000|  3.000| 7.000|
120 |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|
121 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
122 EOF
123 if [ $? -ne 0 ] ; then fail ; fi
124
125
126 pass