3820a5f32817e207b771cea69b9a34f8caf20d40
[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 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 / V1 TO V3 1-3.
53 mis val v1 to v3 (1).
54 begin data.
55 111
56    
57  1 
58 1 1
59 112
60 123
61 234
62 end data.
63
64 descript all/stat=all/format=serial.
65 descript all/stat=all/format=serial/missing=include.
66 descript all/stat=all/format=serial/missing=listwise.
67 descript all/stat=all/format=serial/missing=listwise include.
68
69 EOF
70 if [ $? -ne 0 ] ; then no_result ; fi
71
72
73 activity="run program"
74 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/descript.stat
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77 activity="compare output"
78 diff -B -b $TEMPDIR/pspp.list - <<EOF
79 1.1 DATA LIST.  Reading 1 record from the command file.
80 +--------+------+-------+------+
81 |Variable|Record|Columns|Format|
82 #========#======#=======#======#
83 |V1      |     1|  1-  1|F1.0  |
84 |V2      |     1|  2-  2|F1.0  |
85 |V3      |     1|  3-  3|F1.0  |
86 +--------+------+-------+------+
87
88 2.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 6.
89 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
90 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum| Sum |
91 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#=====#
92 |V1      #      1|        6|2.000|    .   |   .   |    .   |    .   |    .   |    .   |    .   | .000|  2.000|  2.000|2.000|
93 |V2      #      2|        5|2.500|    .500|   .707|    .500|    .   |    .   |    .   |    .   |1.000|  2.000|  3.000|5.000|
94 |V3      #      3|        4|3.000|    .577|  1.000|   1.000|    .   |    .   |    .000|   1.225|2.000|  2.000|  4.000|9.000|
95 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+-----+
96
97 3.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 3.
98 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
99 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
100 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
101 |V1      #      5|        2|1.200|    .200|   .447|    .200|   5.000|   2.000|   2.236|    .913|1.000|  1.000|  2.000| 6.000|
102 |V2      #      5|        2|1.600|    .400|   .894|    .800|    .312|   2.000|   1.258|    .913|2.000|  1.000|  3.000| 8.000|
103 |V3      #      5|        2|2.200|    .583|  1.304|   1.700|  -1.488|   2.000|    .541|    .913|3.000|  1.000|  4.000|11.000|
104 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
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
115 5.1 DESCRIPTIVES.  Valid cases = 4; cases with missing value(s) = 3.
116 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
117 |Variable#Valid N|Missing N| Mean|S E Mean|Std Dev|Variance|Kurtosis|S E Kurt|Skewness|S E Skew|Range|Minimum|Maximum|  Sum |
118 #========#=======#=========#=====#========#=======#========#========#========#========#========#=====#=======#=======#======#
119 |V1      #      4|        0|1.250|    .250|   .500|    .250|   4.000|   2.619|   2.000|   1.014|1.000|  1.000|  2.000| 5.000|
120 |V2      #      4|        0|1.750|    .479|   .957|    .917|  -1.289|   2.619|    .855|   1.014|2.000|  1.000|  3.000| 7.000|
121 |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|
122 +--------#-------+---------+-----+--------+-------+--------+--------+--------+--------+--------+-----+-------+-------+------+
123 EOF
124 if [ $? -ne 0 ] ; then fail ; fi
125
126
127 pass