Skip to content

tests: the date and string functions of COMPUTE against R and the guide's rules - #451

Merged
TonisOrmisson merged 1 commit into
mainfrom
dm-str
Nov 26, 2026
Merged

TonisOrmisson merged 1 commit into
mainfrom
dm-str

Conversation

@TonisOrmisson

Copy link
Copy Markdown
Contributor

Test-only, no engine change. 1371 date, numeric and string values: DATE.DMY, DATE.MDY, DATE.MOYR, DATE.QYR, DATE.WKYR, DATE.YRDAY (excess days roll into the next month, months 1 to 13, invalid arguments system-missing), YRMODA, TIME.HMS, TIME.DAYS, CTIME., XDATE. of eight datetimes, DATEDIFF in every unit and DATESUM with the closest and rollover methods; INDEX, CHAR.INDEX, RINDEX, CHAR.RINDEX with and without a divisor, CHAR.LENGTH, LENGTH, CHAR.MBLEN, MBLEN.BYTE, the pad, substring, trim, REPLACE, STRUNC, STRING and NUMBER functions, with two- and three-byte characters; and a check that a call with the wrong number of arguments is an error. Expected values are R's (as.Date, POSIXlt, regexpr, substr, nchar in characters and bytes, sprintf) with the guide's rules written out where R has none. No defect found. Where two readings fit, the engine's recorded choices stand: SUBSTR, INDEX, RINDEX, LPAD and RPAD count characters (2026-11-12), a DATEDIFF month is complete once the day and time of day are reached, the F format drops the zero before the point.

The review also made the numeric-function test of #449 use our own examples: the first version reused a few of the guide's example values (RND and TRUNC with a multiple, the floating point sum); they are replaced by invented ones, and whole results below 1e15 are now compared exactly. RND and TRUNC near 1e15 are left out on purpose (the fuzz bits grow with the value). Review: low on the worktree, then medium in five rounds (the low level skips test files); round one: the guide's own example dates, times and strings were reused, replaced; later rounds: the F format zero (a recorded choice, noted), exact whole numbers, wrong-arity errors, stale target values; the last round had nits only.

…de's rules; the numeric examples are our own
@TonisOrmisson
TonisOrmisson merged commit 057ed2d into main Nov 26, 2026
3 checks passed
@TonisOrmisson
TonisOrmisson deleted the dm-str branch November 26, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant