dnl PSPP - a program for statistical analysis. dnl Copyright (C) 2017 Free Software Foundation, Inc. dnl dnl This program is free software: you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation, either version 3 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program. If not, see . dnl AT_BANNER([expression parsing]) AT_SETUP([parse expression with unknown variable crash]) AT_DATA([parse.sps], [dnl INPUT PROGRAM. LOOP c=1 to 10. COMPUTE var1=NORMAL(100). END CASE. END LOOP. END FILE. END INPUT PROGRAM. IF ( y > 0 ) . COMPUTE x=y. END IF. ]) AT_CHECK([pspp -O format=csv parse.sps], [1], [dnl parse.sps:10: error: IF: Unknown identifier y. parse.sps:11: error: Stopping syntax file processing here to avoid a cascade of dependent command failures. ]) AT_CLEANUP AT_SETUP([parsing numeric expression with type mismatch]) AT_DATA([parse.sps], [dnl DATA LIST NOTABLE/x 1(A). IF 'foo'. ]) AT_CHECK([pspp -O format=csv parse.sps], [1], [dnl "parse.sps:2: error: IF: Type mismatch: expression has string type, but a numeric value is required here." ]) AT_CLEANUP AT_SETUP([parsing string expression with type mismatch]) AT_KEYWORDS([expression negative]) AT_DATA([parse.sps], [dnl DATA LIST NOTABLE/x 1(A). COMPUTE x=1. ]) AT_CHECK([pspp -O format=csv parse.sps], [1], [dnl "parse.sps:2: error: COMPUTE: Type mismatch: expression has number type, but a string value is required here." ]) AT_CLEANUP AT_SETUP([parse expression with unknown system variable]) AT_KEYWORDS([expression negative]) AT_DATA([parse.sps], [dnl DATA LIST NOTABLE/x 1. COMPUTE x=$nonexistent. ]) AT_CHECK([pspp -O format=csv parse.sps], [1], [dnl parse.sps:2: error: COMPUTE: Unknown system variable $nonexistent. ]) AT_CLEANUP AT_SETUP([parse expression with unknown identifier]) AT_KEYWORDS([expression negative]) AT_DATA([parse.sps], [dnl DATA LIST NOTABLE/x 1. COMPUTE x=y. ]) AT_CHECK([pspp -O format=csv parse.sps], [1], [dnl parse.sps:2: error: COMPUTE: Unknown identifier y. ]) AT_CLEANUP AT_SETUP([parse expression with extension function in compatibility mode]) AT_KEYWORDS([expression negative]) AT_DATA([parse.sps], [dnl DEBUG EVALUATE/ACOS(0)*0. ]) AT_CHECK([pspp --testing-mode --syntax=compatible -O format=csv parse.sps], [0], [dnl parse.sps:1: warning: DEBUG EVALUATE: ACOS(number) is a PSPP extension. 0.00 ]) AT_CLEANUP AT_SETUP([LAG expression following TEMPORARY]) AT_KEYWORDS([expression negative]) AT_DATA([parse.sps], [dnl DATA LIST NOTABLE/x 1. TEMPORARY COMPUTE y=LAG(x). ]) AT_CHECK([pspp -O format=csv parse.sps], [1], [dnl parse.sps:3: error: COMPUTE: LAG(num_variable) may not appear after TEMPORARY. ]) AT_CLEANUP AT_SETUP([parse expression with invalid logical expression]) AT_DATA([parse.sps], [dnl INPUT PROGRAM. LOOP c=1 to 10. COMPUTE var1=NORMAL(100). END CASE. END LOOP. END FILE. END INPUT PROGRAM. SELECT IF 2. ]) AT_CHECK([pspp -O format=csv parse.sps], [1], [dnl "parse.sps:9: error: SELECT IF: A logical expression was found to have a value other than 0 (false), 1 (true), or the system-missing value. The result was forced to 0." ]) AT_CLEANUP