AT_DATA([evaluate.sps],
[set mxwarn 1000.
set mxerr 1000.
+set epoch 1940.
m4_foreach([check], [m4_shift($@)],
[DEBUG EVALUATE NOOPT m4_argn(4, check)/[]m4_car(check).
DEBUG EVALUATE m4_argn(4, check)/[]m4_car(check).
])])
AT_CAPTURE_FILE([evaluate.sps])
- m4_pushdef([i], [2])
+ m4_pushdef([i], [3])
AT_CHECK([pspp --testing-mode --error-file=- --no-output evaluate.sps],
- [m4_if(m4_bregexp([m4_foreach([check], [m4_shift($@)], [m4_argn(3, check)])], [error:]), [-1], [0], [1])],
+ [m4_if(m4_bregexp([m4_foreach([check], [m4_shift($@)], [m4_argn(3, check)])], [error:]), [-1], [0], [1])],
+ [stdout])
+ # Use sed to transform "file:line.column:" into plain "file:line:",
+ # because column numbers change between opt and noopt versions.
+ AT_CHECK([[sed 's/\(evaluate.sps:[0-9]\{1,\}\)\.[0-9]\{1,\}:/\1:/' stdout]],
+ [0],
[m4_foreach([check], [m4_shift($@)],
[m4_define([i], m4_incr(i))dnl
m4_if(m4_argn(3, check), [], [], [evaluate.sps:[]i[]: m4_argn(3, check)
[error: DEBUG EVALUATE: Syntax error at `>'.]],
dnl # ~= token can't be split:
[[1 ~ = 1], [error],
- [error: DEBUG EVALUATE: Syntax error at `NOT': expecting end of command.]])
+ [error: DEBUG EVALUATE: Syntax error at `~': expecting end of command.]])
CHECK_EXPR_EVAL([exp lg10 ln sqrt abs mod mod10 rnd trunc],
[[exp(10)], [22026.47]],
[[any('a', 'a ', 'b', 'c')], [true]],
[[any('b ', 'a', 'b', 'c')], [true]],
[[any('c ', 'a', 'b', 'c ')], [true]],
- [[any(a, 'b', 'c', 'd')], [error],
+ [[any(a10, 'b', 'c', 'd')], [error],
[error: DEBUG EVALUATE: Function invocation any(format, string, string, string) does not match any known function. Candidates are:
ANY(number, number[, number]...)
ANY(string, string[, string]...).]],
[[datediff(date.mdy(7,18,2094), date.mdy(11,10,2038), 'quarters')], [222.00]],
[[datediff(date.mdy(2,29,1904), date.mdy(2,29,1900), 'quarters')], [15.00]],
[[datediff(date.mdy(2,29,1908), date.mdy(2,29,1904), 'quarters')], [16.00]],
- [[datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'quarters')], [11.00]])
+ [[datediff(date.mdy(2,28,1903), date.mdy(2,29,1900), 'quarters')], [11.00]],
+
+dnl time of day is significant for DATEDIFF
+ [[datediff(date.mdy(10,15,1910) + 234, date.mdy(10,10,1910) + 123, 'days')],
+ [5.00]],
+ [[datediff(date.mdy(10,15,1910) + 123, date.mdy(10,10,1910) + 234, 'days')],
+ [4.00]],
+ [[datediff(date.mdy(10,24,1910) + 234, date.mdy(10,10,1910) + 123, 'weeks')],
+ [2.00]],
+ [[datediff(date.mdy(10,24,1910) + 123, date.mdy(10,10,1910) + 234, 'weeks')],
+ [1.00]],
+ [[datediff(date.mdy(10,10,1910) + 234, date.mdy(5,10,1910) + 123, 'months')],
+ [5.00]],
+ [[datediff(date.mdy(10,10,1910) + 123, date.mdy(5,10,1910) + 234, 'months')],
+ [4.00]],
+ [[datediff(date.mdy(5,10,1919) + 234, date.mdy(5,10,1910) + 123, 'years')],
+ [9.00]],
+ [[datediff(date.mdy(5,10,1919) + 123, date.mdy(5,10,1910) + 234, 'years')],
+ [8.00]],
+
+ [[datediff(date.mdy(10,10,1910) + 123, date.mdy(10,15,1910) + 234, 'days')],
+ [-5.00]],
+ [[datediff(date.mdy(10,10,1910) + 234, date.mdy(10,15,1910) + 123, 'days')],
+ [-4.00]],
+ [[datediff(date.mdy(10,10,1910) + 123, date.mdy(10,24,1910) + 234, 'weeks')],
+ [-2.00]],
+ [[datediff(date.mdy(10,10,1910) + 234, date.mdy(10,24,1910) + 123, 'weeks')],
+ [-1.00]],
+ [[datediff(date.mdy(5,10,1910) + 123, date.mdy(10,10,1910) + 234, 'months')],
+ [-5.00]],
+ [[datediff(date.mdy(5,10,1910) + 234, date.mdy(10,10,1910) + 123, 'months')],
+ [-4.00]],
+ [[datediff(date.mdy(5,10,1910) + 123, date.mdy(5,10,1919) + 234, 'years')],
+ [-9.00]],
+ [[datediff(date.mdy(5,10,1910) + 234, date.mdy(5,10,1919) + 123, 'years')],
+ [-8.00]])
CHECK_EXPR_EVAL([datesum],
dnl DATESUM with non-leap year
[[ctime.days(datesum(date.mdy(6,10,1648), 1, 'hours') - date.mdy(6,10,1648))], [0.04]],
[[ctime.days(datesum(date.mdy(6,30,1680), 2.5, 'hours') - date.mdy(6,30,1680))], [0.10]],
[[ctime.days(datesum(date.mdy(6,19,1768), -4, 'hours') - date.mdy(6,19,1768))], [-0.17]],
- [[ctime.days(datesum(date.mdy(8,2,1819), 5, 'hours') - date.mdy(8,2,1819))], [0.21]])
+ [[ctime.days(datesum(date.mdy(8,2,1819), 5, 'hours') - date.mdy(8,2,1819))], [0.21]],
+
+dnl DATESUM preserves time-of-day for units of days and longer.
+ [[ctime.days(datesum(date.mdy(8,2,1819) + time.hms(1,2,3), 5, 'days') - (date.mdy(8,2,1819) + time.hms(1,2,3)))], [5.00]],
+ [[ctime.days(datesum(date.mdy(8,2,1819) + time.hms(1,2,3), 5, 'weeks') - (date.mdy(8,2,1819) + time.hms(1,2,3)))], [35.00]],
+ [[ctime.days(datesum(date.mdy(8,2,1819) + time.hms(1,2,3), 5, 'months') - (date.mdy(8,2,1819) + time.hms(1,2,3)))], [153.00]],
+ [[ctime.days(datesum(date.mdy(8,2,1819) + time.hms(1,2,3), 5, 'years') - (date.mdy(8,2,1819) + time.hms(1,2,3)))], [1827.00]])
CHECK_EXPR_EVAL([miscellaneous],
dnl These test values are from Applied Statistics, Algorithm AS 310.