Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/guidoschmidt/circadian.el
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
guidoschmidt committed Apr 30, 2024
2 parents ee8d606 + 189778a commit 85863de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
1 change: 0 additions & 1 deletion circadian.el
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ set and and sort the final list by time."
(progn
(nth (random (length theme-or-theme-list)) theme-or-theme-list))
theme-or-theme-list)))
(print theme-or-theme-list)
(circadian-enable-theme theme)))

(defun circadian-schedule()
Expand Down
44 changes: 22 additions & 22 deletions test.el
Original file line number Diff line number Diff line change
Expand Up @@ -119,36 +119,36 @@ Time A: 17:59
Time B: 17:58
B should be earlier than A
=> `circadian-a-earlier-b-p' should return t."
;; (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))))

(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))
(with-mock
;; tomorrow
(stub decode-time => '(0 30 16 28 4 2024 nil -1 nil))
(let* ((next-time (decode-time (circadian-encode-time 0 0)))
(next-day (nth 3 next-time))
(next-hour (nth 2 next-time)))
;; today
(stub decode-time => '(0 30 14 28 4 2024 nil -1 nil))
(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))
(hour (nth 2 now)))
(should (> next-hour hour))
(should (equal day next-day)))))

(with-mock
;; tomorrow
(stub decode-time => '(0 30 7 29 4 2024 nil -1 nil))
(let* ((next-time (decode-time (circadian-encode-time 0 0)))
(next-day (nth 3 next-time))
(next-hour (nth 2 next-time)))
;; today
(stub decode-time => '(0 30 14 28 4 2024 nil -1 nil))
(let* ((now (decode-time))
(day (nth 3 now))
(min (nth 3 now))
(hour (nth 3 now)))
(should (< next-min min))
(hour (nth 2 now)))
(should (< next-hour hour))
(should (equal (+ 1 day) next-day))))))

Expand Down

0 comments on commit 85863de

Please sign in to comment.