Fix tests broken by the new table widths, caused by previous change
[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 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 / V1 TO V3 1-3.
65 mis val v1 to v3 (1).
66 begin data.
67 111
68    
69  1 
70 1 1
71 112
72 123
73 234
74 end data.
75
76 descript all/stat=all/format=serial.
77 descript all/stat=all/format=serial/missing=include.
78 descript all/stat=all/format=serial/missing=listwise.
79 descript all/stat=all/format=serial/missing=listwise include.
80
81 EOF
82 if [ $? -ne 0 ] ; then no_result ; fi
83
84
85 activity="run program"
86 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/descript.stat
87 if [ $? -ne 0 ] ; then no_result ; fi
88
89 activity="compare output"
90 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
91 diff -b $TEMPDIR/pspp.list - <<EOF
92 1.1 DATA LIST.  Reading 1 record from INLINE.
93 +--------+------+-------+------+
94 |Variable|Record|Columns|Format|
95 #========#======#=======#======#
96 |V1      |     1|  1-  1|F1.0  |
97 |V2      |     1|  2-  2|F1.0  |
98 |V3      |     1|  3-  3|F1.0  |
99 +--------+------+-------+------+
100 2.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 6.
101 +--------#-------+---------+----+---------+-------+--------+--------+---------+--------+---------+-----+-------+-------+----+
102 |Variable#Valid N|Missing N|Mean|S.E. Mean|Std Dev|Variance|Kurtosis|S.E. Kurt|Skewness|S.E. Skew|Range|Minimum|Maximum| Sum|
103 #========#=======#=========#====#=========#=======#========#========#=========#========#=========#=====#=======#=======#====#
104 |V1      #      1|        6|2.00|      .  |    .  |     .  |     .  |      .  |     .  |      .  |  .00|   2.00|   2.00|2.00|
105 |V2      #      2|        5|2.50|      .50|    .71|     .50|     .  |      .  |     .  |      .  | 1.00|   2.00|   3.00|5.00|
106 |V3      #      3|        4|3.00|      .58|   1.00|    1.00|     .  |      .  |     .00|     1.22| 2.00|   2.00|   4.00|9.00|
107 +--------#-------+---------+----+---------+-------+--------+--------+---------+--------+---------+-----+-------+-------+----+
108 3.1 DESCRIPTIVES.  Valid cases = 7; cases with missing value(s) = 3.
109 +--------#-------+---------+----+---------+-------+--------+--------+---------+--------+---------+-----+-------+-------+-----+
110 |Variable#Valid N|Missing N|Mean|S.E. Mean|Std Dev|Variance|Kurtosis|S.E. Kurt|Skewness|S.E. Skew|Range|Minimum|Maximum| Sum |
111 #========#=======#=========#====#=========#=======#========#========#=========#========#=========#=====#=======#=======#=====#
112 |V1      #      5|        2|1.20|      .20|    .45|     .20|    5.00|     2.00|    2.24|      .91| 1.00|   1.00|   2.00| 6.00|
113 |V2      #      5|        2|1.60|      .40|    .89|     .80|     .31|     2.00|    1.26|      .91| 2.00|   1.00|   3.00| 8.00|
114 |V3      #      5|        2|2.20|      .58|   1.30|    1.70|   -1.49|     2.00|     .54|      .91| 3.00|   1.00|   4.00|11.00|
115 +--------#-------+---------+----+---------+-------+--------+--------+---------+--------+---------+-----+-------+-------+-----+
116 4.1 DESCRIPTIVES.  Valid cases = 1; cases with missing value(s) = 6.
117 +--------#-------+---------+----+---------+-------+--------+--------+---------+--------+---------+-----+-------+-------+----+
118 |Variable#Valid N|Missing N|Mean|S.E. Mean|Std Dev|Variance|Kurtosis|S.E. Kurt|Skewness|S.E. Skew|Range|Minimum|Maximum| Sum|
119 #========#=======#=========#====#=========#=======#========#========#=========#========#=========#=====#=======#=======#====#
120 |V1      #      1|        0|2.00|      .  |    .  |     .  |     .  |      .  |     .  |      .  |  .00|   2.00|   2.00|2.00|
121 |V2      #      1|        0|3.00|      .  |    .  |     .  |     .  |      .  |     .  |      .  |  .00|   3.00|   3.00|3.00|
122 |V3      #      1|        0|4.00|      .  |    .  |     .  |     .  |      .  |     .  |      .  |  .00|   4.00|   4.00|4.00|
123 +--------#-------+---------+----+---------+-------+--------+--------+---------+--------+---------+-----+-------+-------+----+
124 5.1 DESCRIPTIVES.  Valid cases = 4; cases with missing value(s) = 3.
125 +--------#-------+---------+----+---------+-------+--------+--------+---------+--------+---------+-----+-------+-------+-----+
126 |Variable#Valid N|Missing N|Mean|S.E. Mean|Std Dev|Variance|Kurtosis|S.E. Kurt|Skewness|S.E. Skew|Range|Minimum|Maximum| Sum |
127 #========#=======#=========#====#=========#=======#========#========#=========#========#=========#=====#=======#=======#=====#
128 |V1      #      4|        0|1.25|      .25|    .50|     .25|    4.00|     2.62|    2.00|     1.01| 1.00|   1.00|   2.00| 5.00|
129 |V2      #      4|        0|1.75|      .48|    .96|     .92|   -1.29|     2.62|     .85|     1.01| 2.00|   1.00|   3.00| 7.00|
130 |V3      #      4|        0|2.50|      .65|   1.29|    1.67|   -1.20|     2.62|     .00|     1.01| 3.00|   1.00|   4.00|10.00|
131 +--------#-------+---------+----+---------+-------+--------+--------+---------+--------+---------+-----+-------+-------+-----+
132 EOF
133 if [ $? -ne 0 ] ; then fail ; fi
134
135
136 pass