aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-05-24 22:53:17 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-05-24 23:08:09 +0200
commitbc89fa75db183ee68611218addea5c0975f0a725 (patch)
tree797304de5a25d9a88521c516e28144f434b8e3aa /tests
parentRemove comment about atomic boxes. (diff)
downloadcalp-bc89fa75db183ee68611218addea5c0975f0a725.tar.gz
calp-bc89fa75db183ee68611218addea5c0975f0a725.tar.xz
Fix multi day overflow in time-.
Diffstat (limited to 'tests')
-rw-r--r--tests/datetime.scm16
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/datetime.scm b/tests/datetime.scm
index b678edad..c4a725e8 100644
--- a/tests/datetime.scm
+++ b/tests/datetime.scm
@@ -9,6 +9,7 @@
leap-year?
)
((ice-9 format) format)
+ ((util) let*)
)
(test-equal "empty time"
@@ -91,9 +92,18 @@
(date day: 5)))
-(test-equal "time- self"
- #00:00:00
- (time- #10:20:30 #10:20:30))
+(let* ((diff overflow (time- #10:20:30 #10:20:30)))
+ (test-equal "time- self" #00:00:00 diff)
+ (test-equal "time- self overflow" 0 overflow))
+
+(let* ((diff overflow (time- #10:00:00 #10:00:01)))
+ (test-equal "time- overflow 1s" #23:59:59 diff)
+ (test-equal "time- overflow 1s overflow" 1 overflow))
+
+
+(let* ((diff overflow (time- #10:00:00 (time hour: (+ 48 4)))))
+ (test-equal "time- overflow multiple" #06:00:00 diff)
+ (test-equal "time- overflow multiple overflow" 2 overflow))
(test-equal "datetime-difference self"
#0000-00-00T00:00:00