Extend a calendar test.

tests/hard_coded/calendar_test.{m,exp}:
    Add further tests of end of month day clamping.

tests/hard_coded/calendar_init_data.m:
    Fix typo.
This commit is contained in:
Julien Fischer
2026-03-13 17:02:12 +11:00
parent 953ea7667f
commit 526ede3f75
3 changed files with 5 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
%---------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%---------------------------------------------------------------------------%
% Test calendar.init_data/8 and calendar.det_init_date/7.
% Test calendar.init_date/8 and calendar.det_init_date/7.
%---------------------------------------------------------------------------%
:- module calendar_init_date.

View File

@@ -14,6 +14,8 @@ Adding durations to date-times:
1901-12-31 00:00:00 + P1D = 1902-01-01 00:00:00
1901-12-31 00:00:00 + P1M = 1902-01-31 00:00:00
1901-12-31 00:00:00 + P1Y = 1902-12-31 00:00:00
2020-02-29 00:00:00 + P1Y = 2021-02-28 00:00:00
2020-02-29 00:00:00 + -P1Y = 2019-02-28 00:00:00
1901-12-31 00:00:00 + PT1H = 1901-12-31 01:00:00
1901-12-31 00:00:00 + PT1M = 1901-12-31 00:01:00
1901-12-31 00:00:00 + PT1S = 1901-12-31 00:00:01

View File

@@ -32,6 +32,8 @@ main(!IO) :-
test_add_dur("1901-12-31 00:00:00", "P1D", !IO),
test_add_dur("1901-12-31 00:00:00", "P1M", !IO),
test_add_dur("1901-12-31 00:00:00", "P1Y", !IO),
test_add_dur("2020-02-29 00:00:00", "P1Y", !IO),
test_add_dur("2020-02-29 00:00:00", "-P1Y", !IO),
test_add_dur("1901-12-31 00:00:00", "PT1H", !IO),
test_add_dur("1901-12-31 00:00:00", "PT1M", !IO),
test_add_dur("1901-12-31 00:00:00", "PT1S", !IO),