summaryrefslogtreecommitdiffstats
path: root/tests/clock.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/clock.test')
-rw-r--r--tests/clock.test44
1 files changed, 42 insertions, 2 deletions
diff --git a/tests/clock.test b/tests/clock.test
index 7c1f756..65d3ce9 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -35753,7 +35753,7 @@ test clock-30.30 {clock add weekdays and back} -body {
}
return "OK"
} -result {OK}
-test clock-30.31 {regression test - add with int overflow} {
+test clock-30.31 {regression test - add no int overflow} {
list \
[list \
[clock add 0 1600000000 seconds 24856 days -gmt 1] \
@@ -35772,7 +35772,25 @@ test clock-30.31 {regression test - add with int overflow} {
[clock add 1600000000 0x7fffffff seconds -gmt 1]
]
} [lrepeat 2 {3747558400 3743238400 3777452800 3747486400 3747483700 3747483647}]
-
+test clock-30.32 {regression test - add no int overflow} {
+ list \
+ [list \
+ [clock add 3777452800 -1600000000 seconds -24856 days -gmt 1] \
+ [clock add 3777452800 -1600000000 seconds -815 months -gmt 1] \
+ [clock add 3777452800 -1600000000 seconds -69 years -gmt 1] \
+ [clock add 3777452800 -1600000000 seconds -596524 hours -gmt 1] \
+ [clock add 3777452800 -1600000000 seconds -35791395 minutes -gmt 1] \
+ [clock add 3777452800 -1600000000 seconds -0x7fffffff seconds -gmt 1]
+ ] \
+ [list \
+ [clock add 2177452800 -24856 days -gmt 1] \
+ [clock add 2177452800 -815 months -gmt 1] \
+ [clock add 2177452800 -69 years -gmt 1] \
+ [clock add 2177452800 -596524 hours -gmt 1] \
+ [clock add 2177452800 -35791395 minutes -gmt 1] \
+ [clock add 2177452800 -0x7fffffff seconds -gmt 1]
+ ]
+} [lrepeat 2 {29894400 34214400 0 29966400 29969100 29969153}]
# END testcases30
@@ -37012,6 +37030,28 @@ test clock-45.4 {compat: scan regression on spaces (mandatory leading/trailing s
[catch {clock scan "11 1 120" -format " %y%m%d %H%M%S" -gmt 1} ret] $ret \
[catch {clock scan "11 1 120" -format " %y%m%d %H%M%S " -gmt 1} ret] $ret
} -result [lrepeat 3 1 "input string does not match supplied format"]
+test clock-45.5 {regression test - freescan no int overflow} {
+ # note that the relative date changes currently reset the time to 00:00,
+ # this can be changed later (simply achievable by adding 00:00 if expected):
+ list \
+ [clock scan "+24856 days" -base 1600000000 -gmt 1] \
+ [clock scan "+815 months" -base 1600000000 -gmt 1] \
+ [clock scan "+69 years" -base 1600000000 -gmt 1] \
+ [clock scan "+596524 hours" -base 1600000000 -gmt 1] \
+ [clock scan "+35791395 minutes" -base 1600000000 -gmt 1] \
+ [clock scan "+2147483647 seconds" -base 1600000000 -gmt 1]
+} {3747513600 3743193600 3777408000 3747486400 3747483700 3747483647}
+test clock-45.6 {regression test - freescan no int overflow} {
+ # note that the relative date changes currently reset the time to 00:00,
+ # this can be changed later (simply achievable by adding 00:00 if expected):
+ list \
+ [clock scan "-24856 days" -base 2177452800 -gmt 1] \
+ [clock scan "-815 months" -base 2177452800 -gmt 1] \
+ [clock scan "-69 years" -base 2177452800 -gmt 1] \
+ [clock scan "-596524 hours" -base 2177452800 -gmt 1] \
+ [clock scan "-35791395 minutes" -base 2177452800 -gmt 1] \
+ [clock scan "-2147483647 seconds" -base 2177452800 -gmt 1]
+} {29894400 34214400 0 29966400 29969100 29969153}
test clock-46.1 {regression test - month zero} -constraints valid_off \
-body {