: fmt_for_output (FMT_A, width, 0));
}
-/* Checks whether SPEC is valid for USE and returns nonzero if so.
- Otherwise, emits an error message and returns zero. */
-bool
-fmt_check (const struct fmt_spec *spec, enum fmt_use use)
+/* Checks whether SPEC is valid for USE and returns NULL if so. Otherwise,
+ returns a malloc()'d string that describes the error. The caller must
+ eventually free() the string. */
+char *
+fmt_check__ (const struct fmt_spec *spec, enum fmt_use use)
{
char str[FMT_STRING_LEN_MAX + 1];
int min_w, max_w, max_d;
fmt_to_string (spec, str);
if (use == FMT_FOR_INPUT && !fmt_usable_for_input (spec->type))
- {
- msg (SE, _("Format %s may not be used for input."), str);
- return false;
- }
+ return xasprintf (_("Format %s may not be used for input."), str);
if (spec->w % fmt_step_width (spec->type))
{
assert (fmt_step_width (spec->type) == 2);
- if (use == FMT_FOR_INPUT)
- msg (SE, _("Input format %s specifies width %d, "
- "but %s requires an even width."),
- str, spec->w, fmt_name (spec->type));
- else
- msg (SE, _("Output format %s specifies width %d, "
- "but %s requires an even width."),
- str, spec->w, fmt_name (spec->type));
- return false;
+ return (use == FMT_FOR_INPUT
+ ? xasprintf (_("Input format %s specifies width %d, "
+ "but %s requires an even width."),
+ str, spec->w, fmt_name (spec->type))
+ : xasprintf (_("Output format %s specifies width %d, "
+ "but %s requires an even width."),
+ str, spec->w, fmt_name (spec->type)));
}
min_w = fmt_min_width (spec->type, use);
max_w = fmt_max_width (spec->type, use);
if (spec->w < min_w || spec->w > max_w)
- {
- if (use == FMT_FOR_INPUT)
- msg (SE, _("Input format %s specifies width %d, but "
- "%s requires a width between %d and %d."),
- str, spec->w, fmt_name (spec->type), min_w, max_w);
- else
- msg (SE, _("Output format %s specifies width %d, but "
- "%s requires a width between %d and %d."),
- str, spec->w, fmt_name (spec->type), min_w, max_w);
- return false;
- }
+ return (use == FMT_FOR_INPUT
+ ? xasprintf (_("Input format %s specifies width %d, but "
+ "%s requires a width between %d and %d."),
+ str, spec->w, fmt_name (spec->type), min_w, max_w)
+ : xasprintf (_("Output format %s specifies width %d, but "
+ "%s requires a width between %d and %d."),
+ str, spec->w, fmt_name (spec->type), min_w, max_w));
max_d = fmt_max_decimals (spec->type, spec->w, use);
if (!fmt_takes_decimals (spec->type) && spec->d != 0)
- {
- if (use == FMT_FOR_INPUT)
- msg (SE, ngettext ("Input format %s specifies %d decimal place, but "
- "%s does not allow any decimals.",
- "Input format %s specifies %d decimal places, but "
- "%s does not allow any decimals.",
+ return (use == FMT_FOR_INPUT
+ ? xasprintf (ngettext (
+ "Input format %s specifies %d decimal "
+ "place, but %s does not allow any decimals.",
+ "Input format %s specifies %d decimal "
+ "places, but %s does not allow any "
+ "decimals.",
spec->d),
- str, spec->d, fmt_name (spec->type));
- else
- msg (SE, ngettext ("Output format %s specifies %d decimal place, but "
- "%s does not allow any decimals.",
+ str, spec->d, fmt_name (spec->type))
+ : xasprintf (ngettext (
+ "Output format %s specifies %d decimal "
+ "place, but %s does not allow any decimals.",
"Output format %s specifies %d decimal places, but "
"%s does not allow any decimals.",
spec->d),
- str, spec->d, fmt_name (spec->type));
- return false;
- }
+ str, spec->d, fmt_name (spec->type)));
else if (spec->d > max_d)
{
if (max_d > 0)
- {
- if (use == FMT_FOR_INPUT)
- msg (SE, ngettext ("Input format %s specifies %d decimal place, "
+ return (use == FMT_FOR_INPUT
+ ? xasprintf (ngettext (
+ "Input format %s specifies %d decimal place, "
"but the given width allows at most "
"%d decimals.",
"Input format %s specifies %d decimal places, "
"but the given width allows at most "
"%d decimals.",
spec->d),
- str, spec->d, max_d);
- else
- msg (SE, ngettext ("Output format %s specifies %d decimal place, "
+ str, spec->d, max_d)
+ : xasprintf (ngettext (
+ "Output format %s specifies %d decimal place, "
"but the given width allows at most "
"%d decimals.",
"Output format %s specifies %d decimal places, "
"but the given width allows at most "
"%d decimals.",
spec->d),
- str, spec->d, max_d);
- }
+ str, spec->d, max_d));
else
- {
- if (use == FMT_FOR_INPUT)
- msg (SE, ngettext ("Input format %s specifies %d decimal place, "
+ return (use == FMT_FOR_INPUT
+ ? xasprintf (ngettext (
+ "Input format %s specifies %d decimal place, "
"but the given width does not allow "
"for any decimals.",
"Input format %s specifies %d decimal places, "
"but the given width does not allow "
"for any decimals.",
spec->d),
- str, spec->d);
- else
- msg (SE, ngettext ("Output format %s specifies %d decimal place, "
+ str, spec->d)
+ : xasprintf (ngettext (
+ "Output format %s specifies %d decimal place, "
"but the given width does not allow "
"for any decimals.",
"Output format %s specifies %d decimal places, "
"but the given width does not allow "
"for any decimals.",
spec->d),
- str, spec->d);
- }
+ str, spec->d));
+ }
+
+ return NULL;
+}
+
+static bool
+fmt_emit_and_free_error (char *error)
+{
+ if (error)
+ {
+ msg (SE, "%s", error);
+ free (error);
return false;
}
+ else
+ return true;
+}
- return true;
+/* Checks whether SPEC is valid for USE and returns nonzero if so. Otherwise,
+ emits an error message for the current source location and returns zero. */
+bool
+fmt_check (const struct fmt_spec *spec, enum fmt_use use)
+{
+ return fmt_emit_and_free_error (fmt_check__ (spec, use));
}
/* Checks whether SPEC is valid as an input format and returns
return fmt_check (spec, FMT_FOR_OUTPUT);
}
+/* Checks that FORMAT is appropriate for a variable of the given VAR_TYPE and
+ returns NULL if so. Otherwise returns a malloc()'d error message that the
+ calelr must eventually free(). */
+char *
+fmt_check_type_compat__ (const struct fmt_spec *format, enum val_type var_type)
+{
+ assert (val_type_is_valid (var_type));
+ if ((var_type == VAL_STRING) != (fmt_is_string (format->type) != 0))
+ {
+ char str[FMT_STRING_LEN_MAX + 1];
+ return xasprintf (_("%s variables are not compatible with %s format %s."),
+ var_type == VAL_STRING ? _("String") : _("Numeric"),
+ var_type == VAL_STRING ? _("numeric") : _("string"),
+ fmt_to_string (format, str));
+ }
+ return NULL;
+}
+
/* Checks that FORMAT is appropriate for a variable of the given
VAR_TYPE and returns true if so. Otherwise returns false and
emits an error message. */
bool
fmt_check_type_compat (const struct fmt_spec *format, enum val_type var_type)
{
- assert (val_type_is_valid (var_type));
- if ((var_type == VAL_STRING) != (fmt_is_string (format->type) != 0))
+ return fmt_emit_and_free_error (fmt_check_type_compat__ (format, var_type));
+}
+
+/* Checks that FORMAT is appropriate for a variable of the given WIDTH and
+ returns NULL if so. Otherwise returns a malloc()'d error message that the
+ calelr must eventually free(). */
+char *
+fmt_check_width_compat__ (const struct fmt_spec *format, int width)
+{
+ char *error = fmt_check_type_compat__ (format, val_type_from_width (width));
+ if (error)
+ return error;
+
+ if (fmt_var_width (format) != width)
{
char str[FMT_STRING_LEN_MAX + 1];
- msg (SE, _("%s variables are not compatible with %s format %s."),
- var_type == VAL_STRING ? _("String") : _("Numeric"),
- var_type == VAL_STRING ? _("numeric") : _("string"),
- fmt_to_string (format, str));
- return false;
+ return xasprintf (_("String variable with width %d is not compatible "
+ "with format %s."),
+ width, fmt_to_string (format, str));
}
- return true;
+
+ return NULL;
}
/* Checks that FORMAT is appropriate for a variable of the given
bool
fmt_check_width_compat (const struct fmt_spec *format, int width)
{
- if (!fmt_check_type_compat (format, val_type_from_width (width)))
- return false;
- if (fmt_var_width (format) != width)
- {
- char str[FMT_STRING_LEN_MAX + 1];
- msg (SE, _("String variable with width %d is not compatible with "
- "format %s."),
- width, fmt_to_string (format, str));
- return false;
- }
- return true;
+ return fmt_emit_and_free_error (fmt_check_width_compat__ (format, width));
}
/* Returns the width corresponding to FORMAT. The return value
7 | DEBUG EVALUATE /number("123", a8).
| ^~~~~~~~~~~~~~~~~
+evaluate.sps:7.31-7.32: note: DEBUG EVALUATE: Numeric variables are not
+compatible with string format A8.
+ 7 | DEBUG EVALUATE /number("123", a8).
+ | ^~
+
number("123", a8) => error
evaluate.sps:8.17-8.37: error: DEBUG EVALUATE: Type mismatch invoking
8 | DEBUG EVALUATE /number("123", cca1.2).
| ^~~~~~~~~~~~~~~~~~~~~
+evaluate.sps:8.31-8.36: note: DEBUG EVALUATE: Format CCA1.2 may not be used for
+input.
+ 8 | DEBUG EVALUATE /number("123", cca1.2).
+ | ^~~~~~
+
number("123", cca1.2) => error
])
done
AS_BOX([$opt])
sed "s/opt/$opt/" < evaluate-base.sps > evaluate.sps
AT_CHECK([pspp --testing-mode evaluate.sps], [1], [dnl
+string(123.56, f5.1) => "123.6"
+
+string($sysmis, f5.1) => " . "
+
+evaluate.sps:5.17-5.33: error: DEBUG EVALUATE: Type mismatch invoking
+STRING(number, num_output_format) as string(string, format).
+ 5 | DEBUG EVALUATE /string("abc", A5).
+ | ^~~~~~~~~~~~~~~~~
+
+evaluate.sps:5.31-5.32: note: DEBUG EVALUATE: Numeric variables are not
+compatible with string format A5.
+ 5 | DEBUG EVALUATE /string("abc", A5).
+ | ^~
+
+string("abc", A5) => error
+
+evaluate.sps:6.17-6.31: error: DEBUG EVALUATE: Type mismatch invoking
+STRING(number, num_output_format) as string(number, format).
+ 6 | DEBUG EVALUATE /string(123, e1).
+ | ^~~~~~~~~~~~~~~
+
+evaluate.sps:6.29-6.30: note: DEBUG EVALUATE: Output format E1.0 specifies
+width 1, but E requires a width between 6 and 40.
+ 6 | DEBUG EVALUATE /string(123, e1).
+ | ^~
+
+string(123, e1) => error
+
+string(123, e6.0) => "1E+002"
])
done
AT_CLEANUP
DEBUG EVALUATE /strunc('a c ', 2).
DEBUG EVALUATE /strunc('a c ', 1).
DEBUG EVALUATE /strunc('a c ', 0).
+
+DEBUG EVALUATE /strunc('a c ', 0.75).
DEBUG EVALUATE /strunc('a c ', -1).
DEBUG EVALUATE /strunc('a c ', $sysmis).
+
DEBUG EVALUATE /strunc(' abc ', 9).
DEBUG EVALUATE /strunc(' abc ', 8).
DEBUG EVALUATE /strunc(' abc ', 7).
DEBUG EVALUATE /strunc(' abc ', 3).
DEBUG EVALUATE /strunc(' abc ', 2).
DEBUG EVALUATE /strunc(' abc ', 1).
+
+DEBUG EVALUATE /strunc(' abc ', 1.5).
DEBUG EVALUATE /strunc(' abc ', -1).
DEBUG EVALUATE /strunc(' abc ', $sysmis).
])
AS_BOX([$opt])
sed "s/opt/$opt/" < evaluate-base.sps > evaluate.sps
AT_CHECK([pspp --testing-mode evaluate.sps], [1], [dnl
+strunc('a c ', 9) => "a c"
+
+strunc('a c ', 7) => "a c"
+
+strunc('a c ', 6) => "a c"
+
+strunc('a c ', 5) => "a c"
+
+strunc('a c ', 4) => "a c"
+
+strunc('a c ', 3) => "a c"
+
+strunc('a c ', 2) => "a"
+
+strunc('a c ', 1) => "a"
+
+strunc('a c ', 0) => ""
+
+evaluate.sps:13.34-13.37: error: DEBUG EVALUATE: Treating unexpected non-
+integer value 0.75 as missing.
+ 13 | DEBUG EVALUATE /strunc('a c ', 0.75).
+ | ^~~~
+
+strunc('a c ', 0.75) => "a c "
+
+strunc('a c ', -1) => ""
+
+strunc('a c ', $sysmis) => "a c "
+
+strunc(' abc ', 9) => " abc"
+
+strunc(' abc ', 8) => " abc"
+
+strunc(' abc ', 7) => " abc"
+
+strunc(' abc ', 6) => " abc"
+
+strunc(' abc ', 5) => " abc"
+
+strunc(' abc ', 4) => " ab"
+
+strunc(' abc ', 3) => " a"
+
+strunc(' abc ', 2) => ""
+
+strunc(' abc ', 1) => ""
+
+evaluate.sps:27.35-27.37: error: DEBUG EVALUATE: Treating unexpected non-
+integer value 1.5 as missing.
+ 27 | DEBUG EVALUATE /strunc(' abc ', 1.5).
+ | ^~~
+
+strunc(' abc ', 1.5) => " abc "
+
+strunc(' abc ', -1) => ""
+
+strunc(' abc ', $sysmis) => " abc "
])
done
AT_CLEANUP
AT_SETUP([expressions - SUBSTR])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /substr('abcdefgh', -5).
DEBUG EVALUATE /substr('abcdefgh', 0).
AT_SETUP([expressions - UPCASE])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /upcase('abcdefghijklmnopqrstuvwxyz!@%&*089').
DEBUG EVALUATE /upcase('').
AT_SETUP([expressions - TIME.DAYS])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /time.days(1).
DEBUG EVALUATE /time.days(-1).
AT_SETUP([expressions - TIME.HMS])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /time.hms(4,50,38).
DEBUG EVALUATE /time.hms(12,31,35).
AT_SETUP([expressions - CTIME.*])
AT_KEYWORDS([expression expressions evaluate ctime])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /ctime.days(106272).
DEBUG EVALUATE /ctime.hours(106272).
AT_SETUP([expressions - DATE.DMY])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /date.dmy('a',1,2).
DEBUG EVALUATE /date.dmy(1,'a',2).
AT_SETUP([expressions - YRMOD])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
dnl FIXME: check out-of-range and nearly out-of-range values
DEBUG EVALUATE /yrmoda(1582,10,15).
AT_SETUP([expressions - DATE.MDY])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
])
AT_SETUP([expressions - DATE.MOYR])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /ctime.days(date.moyr(1,2000)).
DEBUG EVALUATE /ctime.days(date.moyr(2,2000)).
AT_SETUP([expressions - DATE.QYR])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /ctime.days(date.qyr(1,2000)).
DEBUG EVALUATE /ctime.days(date.qyr(2,2000)).
AT_SETUP([expressions - DATE.WKYR])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /ctime.days(date.wkyr(1,2000)).
DEBUG EVALUATE /ctime.days(date.wkyr(15,1999)).
AT_SETUP([expressions - DATE.YRDAY])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /ctime.days(date.yrday(2000,1)).
DEBUG EVALUATE /ctime.days(date.yrday(2000,100)).
AT_SETUP([expressions - XDATE.DATE])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.date(date.mdy(6,10,1648) + time.hms(0,0,0)) / 86400.
DEBUG EVALUATE /xdate.date(date.mdy(6,30,1680) + time.hms(4,50,38)) / 86400.
AT_SETUP([expressions - XDATE.HOUR])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.hour(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.hour(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - XDATE.JDAY])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.jday(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.jday(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - XDATE.MDAY])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.mday(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.mday(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - XDATE.MINUTE])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.minute(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.minute(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - XDATE.MONTH])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.month(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.month(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - XDATE.QUARTER])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.quarter(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.quarter(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - XDATE.SECOND])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.second(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.second(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - XDATE.TDAY])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.tday(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.tday(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - XDATE.TIME])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.time(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.time(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - XDATE.WEEK])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.week(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.week(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - XDATE.WKDAY])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.wkday(date.mdy(6,10,1648)).
DEBUG EVALUATE /xdate.wkday(date.mdy(6,30,1680)).
AT_SETUP([expressions - XDATE.YEAR])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /xdate.year(date.mdy(6,10,1648) + time.hms(0,0,0)).
DEBUG EVALUATE /xdate.year(date.mdy(6,30,1680) + time.hms(4,50,38)).
AT_SETUP([expressions - DATEDIFF])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /datediff(date.mdy(6,10,1648), date.mdy(6,30,1680), 'years').
DEBUG EVALUATE /datediff(date.mdy(6,30,1680), date.mdy(7,24,1716), 'years').
AT_SETUP([expressions - DATESUM with non-leap year])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /ctime.days(datesum(date.mdy(1,31,1900), 1, 'months') - date.mdy(1,1,1900)).
DEBUG EVALUATE /ctime.days(datesum(date.mdy(1,31,1900), 2, 'months') - date.mdy(1,1,1900)).
AT_SETUP([expressions - DATESUM with leap year])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
])
AT_SETUP([expressions - DATESUM])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /ctime.days(datesum(date.mdy(6,10,1648), 1, 'weeks') - date.mdy(6,10,1648)).
DEBUG EVALUATE /ctime.days(datesum(date.mdy(6,30,1680), 2.5, 'weeks') - date.mdy(6,30,1680)).
AT_SETUP([expressions - DATESUM preserves time of day for units of days and longer])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /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))).
DEBUG EVALUATE /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))).
dnl These test values are from Applied Statistics, Algorithm AS 310.
AT_SETUP([expressions - NCDF.BETA])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /1000 * ncdf.beta(.868,10,20,150).
DEBUG EVALUATE /1000 * ncdf.beta(.9,10,10,120).
dnl Tests correctness of generic optimizations in optimize_tree().
AT_SETUP([expressions - generic tree optimizations])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE (x=10) /x + 0.
DEBUG EVALUATE (x=-3) /x - 0.
AT_SETUP([expressions - negative checks])
AT_KEYWORDS([expression expressions evaluate])
-AT_DATA([evaluate-base.sps], [
+AT_DATA([evaluate-base.sps], [dnl
DEBUG EVALUATE SET opt.
DEBUG EVALUATE /$nonexistent.
DEBUG EVALUATE /RANGE(1, 2).