3 # This program tests MISSING VALUES
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
8 # ensure that top_builddir are absolute
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 top_builddir=`cd $top_builddir; pwd`
12 PSPP=$top_builddir/src/ui/terminal/pspp
14 # ensure that top_srcdir is absolute
15 top_srcdir=`cd $top_srcdir; pwd`
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
61 # Copy this file --- it's shared with another test
62 activity="create data"
63 cp $top_srcdir/tests/data-list.data $TEMPDIR
64 if [ $? -ne 0 ] ; then no_result ; fi
67 activity="create program"
68 cat > $TEMPDIR/missing-values.stat << foobar
69 DATA LIST NOTABLE/str1 1-5 (A) str2 6-8 (A) date1 9-19 (DATE) num1 20-25
72 /* Valid: numeric missing values.
73 MISSING VALUES date1 num1 (1).
74 MISSING VALUES date1 num1 (1, 2).
75 MISSING VALUES date1 num1 (1, 2, 3).
77 /* Valid: numeric missing values using the first variable's format.
78 MISSING VALUES num1 date1 ('1').
79 MISSING VALUES num1 date1 ('1', '2').
80 MISSING VALUES num1 date1 ('1', '2', '3').
81 MISSING VALUES date1 num1 ('06-AUG-05').
82 MISSING VALUES date1 num1 ('06-AUG-05', '01-OCT-78').
83 MISSING VALUES date1 num1 ('06-AUG-05', '01-OCT-78', '14-FEB-81').
85 /* Valid: ranges of numeric missing values.
86 MISSING VALUES num1 (1 THRU 2).
87 MISSING VALUES num1 (LO THRU 2).
88 MISSING VALUES num1 (LOWEST THRU 2).
89 MISSING VALUES num1 (1 THRU HI).
90 MISSING VALUES num1 (1 THRU HIGHEST).
92 /* Valid: a range of numeric missing values, plus an individual value.
93 MISSING VALUES num1 (1 THRU 2, 3).
94 MISSING VALUES num1 (LO THRU 2, 3).
95 MISSING VALUES num1 (LOWEST THRU 2, 3).
96 MISSING VALUES num1 (1 THRU HI, -1).
97 MISSING VALUES num1 (1 THRU HIGHEST, -1).
99 /* Valid: string missing values.
100 MISSING VALUES str1 str2 longstr ('abc ','def').
102 /* Invalid: too long for str2.
103 MISSING VALUES str1 str2 longstr ('abcde').
105 /* Invalid: long string missing value longer than 8 bytes.
106 MISSING VALUES longstr ('abcdefghijk').
108 /* Invalid: no string ranges.
109 MISSING VALUES str1 ('a' THRU 'z').
111 /* Invalid: mixing string and numeric variables.
112 MISSING VALUES str1 num1 ('123').
114 /* Valid: may mix variable types when clearing missing values.
115 MISSING VALUES ALL ().
118 if [ $? -ne 0 ] ; then no_result ; fi
121 activity="run program"
122 $SUPERVISOR $PSPP --testing-mode --error-file=$TEMPDIR/errs $TEMPDIR/missing-values.stat
123 # Note vv --- there are errors in input. Therefore, the command must FAIL
124 if [ $? -eq 0 ] ; then fail ; fi
126 activity="compare error messages"
127 diff -u -w $TEMPDIR/errs - <<EOF
128 $TEMPDIR/missing-values.stat:35: error: MISSING VALUES: Missing values provided are too long to assign to variable of width 3.
129 $TEMPDIR/missing-values.stat:38: error: MISSING VALUES: Truncating missing value to maximum acceptable length (8 bytes).
130 $TEMPDIR/missing-values.stat:41: error: MISSING VALUES: Syntax error expecting string at \`THRU'.
131 $TEMPDIR/missing-values.stat:41: error: MISSING VALUES: THRU is not a variable name.
132 $TEMPDIR/missing-values.stat:44: error: MISSING VALUES: Cannot mix numeric variables (e.g. num1) and string variables (e.g. str1) within a single list.
134 if [ $? -ne 0 ] ; then fail ; fi