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
55 # Copy this file --- it's shared with another test
56 activity="create data"
57 cp $top_srcdir/tests/data-list.data $TEMPDIR
58 if [ $? -ne 0 ] ; then no_result ; fi
61 activity="create program"
62 cat > $TEMPDIR/missing-values.stat << foobar
63 DATA LIST NOTABLE/str1 1-5 (A) str2 6-8 (A) date1 9-19 (DATE) num1 20-25.
65 /* Valid: numeric missing values.
66 MISSING VALUES date1 num1 (1).
67 MISSING VALUES date1 num1 (1, 2).
68 MISSING VALUES date1 num1 (1, 2, 3).
70 /* Valid: numeric missing values using the first variable's format.
71 MISSING VALUES num1 date1 ('1').
72 MISSING VALUES num1 date1 ('1', '2').
73 MISSING VALUES num1 date1 ('1', '2', '3').
74 MISSING VALUES date1 num1 ('06-AUG-05').
75 MISSING VALUES date1 num1 ('06-AUG-05', '01-OCT-78').
76 MISSING VALUES date1 num1 ('06-AUG-05', '01-OCT-78', '14-FEB-81').
78 /* Valid: ranges of numeric missing values.
79 MISSING VALUES num1 (1 THRU 2).
80 MISSING VALUES num1 (LO THRU 2).
81 MISSING VALUES num1 (LOWEST THRU 2).
82 MISSING VALUES num1 (1 THRU HI).
83 MISSING VALUES num1 (1 THRU HIGHEST).
85 /* Valid: a range of numeric missing values, plus an individual value.
86 MISSING VALUES num1 (1 THRU 2, 3).
87 MISSING VALUES num1 (LO THRU 2, 3).
88 MISSING VALUES num1 (LOWEST THRU 2, 3).
89 MISSING VALUES num1 (1 THRU HI, -1).
90 MISSING VALUES num1 (1 THRU HIGHEST, -1).
92 /* Valid: string missing values.
93 MISSING VALUES str1 str2 ('abc ','def').
95 /* Invalid: too long for str2.
96 MISSING VALUES str1 str2 ('abcde').
98 /* Invalid: no string ranges.
99 MISSING VALUES str1 ('a' THRU 'z').
101 /* Invalid: mixing string and numeric variables.
102 MISSING VALUES str1 num1 ('123').
104 /* Valid: may mix variable types when clearing missing values.
105 MISSING VALUES ALL ().
108 if [ $? -ne 0 ] ; then no_result ; fi
111 activity="run program"
112 $SUPERVISOR $PSPP --testing-mode -o raw-ascii --testing-mode $TEMPDIR/missing-values.stat > $TEMPDIR/errs
113 # Note vv --- there are errors in input. Therefore, the command must FAIL
114 if [ $? -eq 0 ] ; then fail ; fi
116 activity="compare error messages"
117 diff -w $TEMPDIR/errs - <<EOF
118 $TEMPDIR/missing-values.stat:34: error: MISSING VALUES: Missing values provided are too long to assign to variable of width 3.
119 $TEMPDIR/missing-values.stat:34: warning: Skipping the rest of this command. Part of this command may have been executed.
120 $TEMPDIR/missing-values.stat:37: error: MISSING VALUES: Syntax error expecting string at \`THRU'.
121 $TEMPDIR/missing-values.stat:37: error: MISSING VALUES: THRU is not a variable name.
122 $TEMPDIR/missing-values.stat:37: warning: Skipping the rest of this command. Part of this command may have been executed.
123 $TEMPDIR/missing-values.stat:40: error: MISSING VALUES: Cannot mix numeric variables (e.g. num1) and string variables (e.g. str1) within a single list.
124 $TEMPDIR/missing-values.stat:40: warning: Skipping the rest of this command. Part of this command may have been executed.
126 if [ $? -ne 0 ] ; then fail ; fi