Skip to content

Commit

Permalink
EDIT/test.el: extend test-circadian-time-comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
guidoschmidt committed Apr 28, 2024
1 parent 8dad94e commit 12c181d
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion test.el
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,35 @@ B should be earlier than A
;; (print "→ TEST: time comparisons")
(should (equal t (circadian-a-earlier-b-p '(7 50) '(7 51))))
(should (equal nil (circadian-a-earlier-b-p '(19 20) '(19 19))))
(should (equal t (circadian-a-earlier-b-p '(20 20) '(20 20)))))
(should (equal t (circadian-a-earlier-b-p '(20 20) '(20 20))))

(let* ((next-time (decode-time (circadian-encode-time 13 10)))
(next-day (nth 3 next-time))
(next-min (nth 1 next-time))
(next-hour (nth 2 next-time)))
(with-mock
(stub decode-time => '(43 24 14 28 4 2024 0 t 7200))
(let* ((now (decode-time))
(day (nth 3 now))
(min (nth 3 now))
(hour (nth 3 now)))
(should (< next-min min))
(should (< next-hour hour))
(should (equal (+ 1 day) next-day)))))

(let* ((next-time (decode-time (circadian-encode-time 0 0)))
(next-day (nth 3 next-time))
(next-min (nth 1 next-time))
(next-hour (nth 2 next-time)))
(with-mock
(stub decode-time => '(43 24 14 28 4 2024 0 t 7200))
(let* ((now (decode-time))
(day (nth 3 now))
(min (nth 3 now))
(hour (nth 3 now)))
(should (< next-min min))
(should (< next-hour hour))
(should (equal (+ 1 day) next-day))))))



Expand Down

0 comments on commit 12c181d

Please sign in to comment.