[[2 le 2], [true]],
dnl Make sure <= token can't be split:
[[2 < = 2], [error],
- [error: DEBUG EVALUATE: Syntax error in expression at `='.]],
+ [error: DEBUG EVALUATE: Syntax error at `='.]],
[[1 <= 'foobar'], [error],
[error: DEBUG EVALUATE: Type mismatch while applying numeric less-than-or-equal-to (`<=') operator: cannot convert string to number.]],
[[5 <= 'foobar'], [error],
[[2 ge 2], [true]],
dnl Make sure >= token can't be split:
[[2 > = 2], [error],
- [error: DEBUG EVALUATE: Syntax error in expression at `='.]],
+ [error: DEBUG EVALUATE: Syntax error at `='.]],
[[1 >= 'foobar'], [error],
[error: DEBUG EVALUATE: Type mismatch while applying numeric greater-than-or-equal-to (`>=') operator: cannot convert string to number.]],
[[5 ge 'foobar'], [error],
[['asdfj ' ne 'asdf'], [true]],
dnl <> token can't be split:
[[1 < > 1], [error],
- [error: DEBUG EVALUATE: Syntax error in expression at `GT'.]],
+ [error: DEBUG EVALUATE: Syntax error at `GT'.]],
dnl # ~= token can't be split:
[[1 ~ = 1], [error],
- [error: DEBUG EVALUATE: Syntax error expecting end of command at `NOT'.]])
+ [error: DEBUG EVALUATE: Syntax error at `NOT': expecting end of command.]])
CHECK_EXPR_EVAL([exp lg10 ln sqrt abs mod mod10 rnd trunc],
[[exp(10)], [22026.47]],
[[mod(0, x)], [0.00], [], [(X = 5.00)]],
[[x ** 1], [5.00], [], [(X = 5.00)]],
[[x ** 2], [25.00], [], [(X = 5.00)]])
+
+AT_SETUP([LAG function])
+AT_DATA([lag.sps], [dnl
+data list /W 1.
+begin data.
+1
+2
+3
+4
+5
+end data.
+
+compute X=lag(w,1).
+compute Y=lag(x).
+compute Z=lag(w,2).
+list.
+])
+AT_CHECK([pspp -o pspp.csv lag.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Reading 1 record from INLINE.
+Variable,Record,Columns,Format
+W,1,1- 1,F1.0
+
+Table: Data List
+W,X,Y,Z
+1,. ,. ,. @&t@
+2,1.00,. ,. @&t@
+3,2.00,1.00,1.00
+4,3.00,2.00,2.00
+5,4.00,3.00,3.00
+])
+AT_CLEANUP
+
+AT_SETUP([LAG crash bug])
+AT_DATA([lag.sps], [dnl
+DATA LIST LIST /x.
+BEGIN DATA
+1
+2
+END DATA.
+
+DO IF (x <> LAG(x) ).
+ ECHO 'hello'.
+END IF.
+
+EXECUTE.
+])
+AT_CHECK([pspp -o pspp.csv lag.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Reading free-form data from INLINE.
+Variable,Format
+x,F8.0
+
+hello
+])
+AT_CLEANUP
+
+dnl Tests for a bug which caused UNIFORM(x) to always return zero.
+AT_SETUP([UNIFORM function])
+AT_DATA([uniform.sps], [dnl
+set seed=10.
+input program.
++ loop #i = 1 to 20.
++ do repeat response=R1.
++ compute response = uniform(10).
++ end repeat.
++ end case.
++ end loop.
++ end file.
+end input program.
+
+list.
+])
+AT_CHECK([pspp -o pspp.csv uniform.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Data List
+R1
+7.71
+2.99
+.21
+4.95
+6.34
+4.43
+7.49
+8.32
+4.99
+5.83
+2.25
+.25
+1.98
+7.09
+7.61
+2.66
+1.69
+2.64
+.88
+1.50
+])
+AT_CLEANUP