AT_BANNER([MISSING VALUES])

AT_SETUP([MISSING VALUES valid cases])
AT_DATA([missing-values.sps], [dnl
DATA LIST NOTABLE/str1 1-5 (A) str2 6-8 (A) date1 9-19 (DATE) num1 20-25
                  longstr 26-36 (A).

* Numeric missing values.
MISSING VALUES date1 num1 (1).
MISSING VALUES date1 num1 (1, 2).
MISSING VALUES date1 num1 (1, 2, 3).

* Numeric missing values using the first variable's format.
MISSING VALUES num1 date1 ('1').
MISSING VALUES num1 date1 ('1', '2').
MISSING VALUES num1 date1 ('1', '2', '3').
MISSING VALUES date1 num1 ('06-AUG-05').
MISSING VALUES date1 num1 ('06-AUG-05', '01-OCT-78').
MISSING VALUES date1 num1 ('06-AUG-05', '01-OCT-78', '14-FEB-81').

* Ranges of numeric missing values.
MISSING VALUES num1 (1 THRU 2).
MISSING VALUES num1 (LO THRU 2).
MISSING VALUES num1 (LOWEST THRU 2).
MISSING VALUES num1 (1 THRU HI).
MISSING VALUES num1 (1 THRU HIGHEST).

* A range of numeric missing values, plus an individual value.
MISSING VALUES num1 (1 THRU 2, 3).
MISSING VALUES num1 (LO THRU 2, 3).
MISSING VALUES num1 (LOWEST THRU 2, 3).
MISSING VALUES num1 (1 THRU HI, -1).
MISSING VALUES num1 (1 THRU HIGHEST, -1).

* String missing values.
MISSING VALUES str1 str2 longstr ('abc  ','def').

* May mix variable types when clearing missing values.
MISSING VALUES ALL ().
])
AT_CHECK([pspp -O format=csv missing-values.sps])
AT_CLEANUP

AT_SETUP([MISSING VALUES invalid cases])
AT_DATA([missing-values.sps], [dnl
DATA LIST NOTABLE/str1 1-5 (A) str2 6-8 (A) date1 9-19 (DATE) num1 20-25
                  longstr 26-36 (A).

* Too long for str2.
MISSING VALUES str1 str2 longstr ('abcde').

* Long string missing value longer than 8 bytes.
MISSING VALUES longstr ('abcdefghijk').

* No string ranges.
MISSING VALUES str1 ('a' THRU 'z').

* Mixing string and numeric variables.
MISSING VALUES str1 num1 ('123').
])
AT_CHECK([pspp -O format=csv missing-values.sps], [1], [dnl
missing-values.sps:5: error: MISSING VALUES: Missing values provided are too long to assign to variable of width 3.

missing-values.sps:8: error: MISSING VALUES: Truncating missing value to maximum acceptable length (8 bytes).

missing-values.sps:11.26-11.29: error: MISSING VALUES: Syntax error at `THRU': expecting string.

missing-values.sps:11: error: MISSING VALUES: THRU is not a variable name.

missing-values.sps:14: error: MISSING VALUES: Cannot mix numeric variables (e.g. num1) and string variables (e.g. str1) within a single list.
])
AT_CLEANUP
